/* ========================================================
   System Magazynowy WMS - Czysty, nowoczesny CSS
   Responsywny i zoptymalizowany pod urządzenia mobilne
   ======================================================== */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-500: #64748b;
  --gray-700: #334155;
  --gray-900: #0f172a;
  --border-radius: 10px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: #f8fafc;
  color: var(--gray-900);
  line-height: 1.5;
  font-size: 15px;
  padding-bottom: 75px; /* Przestrzeń pod mobilny pasek nawigacji */
}

@media (min-width: 768px) {
  body {
    padding-bottom: 30px;
  }
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ================== Top Navigation (Desktop) ================== */
.navbar {
  background: #ffffff;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--gray-900);
  text-decoration: none !important;
}

.brand-icon {
  width: 34px;
  height: 34px;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 18px;
}

.nav-links {
  display: none;
  gap: 6px;
}

@media (min-width: 768px) {
  .nav-links {
    display: flex;
    align-items: center;
  }
}

.nav-link {
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--gray-700);
  font-weight: 500;
  text-decoration: none !important;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link:hover, .nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--gray-500);
}

.user-pill {
  background: var(--gray-100);
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
  color: var(--gray-700);
}

/* ================== Mobile Bottom Bar ================== */
.mobile-bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  border-top: 1px solid var(--gray-200);
  height: 65px;
  z-index: 100;
  justify-content: space-around;
  align-items: center;
  padding: 0 4px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

@media (min-width: 768px) {
  .mobile-bottom-nav {
    display: none;
  }
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--gray-500);
  font-size: 11px;
  font-weight: 500;
  text-decoration: none !important;
  height: 100%;
}

.mobile-nav-item.active {
  color: var(--primary);
  font-weight: 600;
}

.mobile-nav-item svg {
  width: 22px;
  height: 22px;
  margin-bottom: 2px;
}

.scanner-btn-highlight {
  position: relative;
  top: -14px;
  background: var(--primary);
  color: #fff !important;
  border-radius: 50%;
  width: 54px;
  height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
  border: 3px solid #ffffff;
}

.scanner-btn-highlight svg {
  width: 26px;
  height: 26px;
  margin: 0;
}

/* ================== Main Container ================== */
.container {
  max-width: 1200px;
  margin: 20px auto;
  padding: 0 16px;
}

/* ================== Cards & Panels ================== */
.card {
  background: #ffffff;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--gray-100);
  padding-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--gray-900);
}

/* ================== Stat Grids ================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.orange { background: var(--warning-light); color: var(--warning); }

.stat-info .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
}

.stat-info .stat-label {
  font-size: 0.85rem;
  color: var(--gray-500);
}

/* ================== Buttons ================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none !important;
  transition: all 0.15s ease;
  min-height: 40px;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-success {
  background: var(--success);
  color: #ffffff;
}
.btn-success:hover {
  background: #15803d;
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}
.btn-danger:hover {
  background: #b91c1c;
}

.btn-outline {
  background: #ffffff;
  border-color: var(--gray-300);
  color: var(--gray-700);
}
.btn-outline:hover {
  background: var(--gray-100);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  min-height: 32px;
}

.btn-block {
  width: 100%;
}

/* ================== Tables ================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

table.data-table th {
  background: var(--gray-50);
  color: var(--gray-500);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-200);
}

table.data-table td {
  padding: 14px;
  border-bottom: 1px solid var(--gray-200);
  vertical-align: middle;
}

table.data-table tr:hover td {
  background-color: #fafbfc;
}

/* ================== Badges ================== */
.badge {
  display: inline-block;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger  { background: var(--danger-light); color: var(--danger); }
.badge-gray    { background: var(--gray-100); color: var(--gray-700); }
.badge-primary { background: var(--primary-light); color: var(--primary); }

/* ================== Forms ================== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--gray-700);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  background-color: #ffffff;
  color: var(--gray-900);
  transition: border-color 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

textarea.form-control {
  min-height: 80px;
  resize: vertical;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.form-col {
  flex: 1;
  min-width: 220px;
}

/* ================== Alerts / Flash ================== */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-success { background: var(--success-light); color: #166534; border: 1px solid #bbf7d0; }
.alert-danger  { background: var(--danger-light); color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-light); color: #854d0e; border: 1px solid #fde68a; }
.alert-info    { background: var(--primary-light); color: #1e40af; border: 1px solid #bfdbfe; }

/* ================== Scanner UI ================== */
.scanner-viewport {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  background: #000;
}

#reader {
  width: 100%;
  min-height: 280px;
}

.scanner-laser {
  position: absolute;
  top: 50%;
  left: 10%;
  right: 10%;
  height: 2px;
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
  pointer-events: none;
  animation: scanLaser 2s infinite alternate ease-in-out;
}

@keyframes scanLaser {
  0% { transform: translateY(-70px); }
  100% { transform: translateY(70px); }
}

/* ================== Product Images & Gallery ================== */
.product-thumbnail {
  width: 50px;
  height: 50px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--gray-200);
  background: #fff;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.gallery-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--gray-200);
  aspect-ratio: 1;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ================== Print Styling (Barcode labels) ================== */
@media print {
  body {
    background: #fff;
    padding: 0;
  }
  .navbar, .mobile-bottom-nav, .no-print, .btn {
    display: none !important;
  }
  .card {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  .barcode-label {
    page-break-inside: avoid;
    border: 1px dashed #ccc;
    padding: 10px;
    margin: 10px;
    display: inline-block;
    text-align: center;
  }
}
