/* =========================================================================
   Mobile Inventory & Invoicing Management System — style.css
   Light, card-based admin theme with teal/cyan accents.
   ========================================================================= */

:root {
  --accent: #14b8a6;
  --accent-dark: #0f9488;
  --accent-cyan: #22d3ee;
  --sidebar-bg: #0f172a;
  --sidebar-bg-hover: #1e293b;
  --page-bg: #f4f6f9;
  --card-border: #e9edf2;
  --text-muted-soft: #7b8a9a;
  --radius-lg: 14px;
  --radius-md: 10px;
}

body {
  background-color: var(--page-bg);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: #1f2937;
}

/* ---------------------------------------------------------------------
   AUTH / LOGIN PAGE
   --------------------------------------------------------------------- */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #134e4a 55%, #0f9488 100%);
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35);
  overflow: hidden;
}

.auth-card .brand-badge {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.5rem;
  margin: 0 auto 1rem;
}

.auth-card .btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border: none;
}

.auth-card .btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
}

/* ---------------------------------------------------------------------
   APP SHELL: SIDEBAR + TOPBAR + CONTENT
   --------------------------------------------------------------------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 1030;
}

.sidebar .sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1.25rem 1.25rem;
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar .sidebar-brand .logo-dot {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0f172a;
}

.sidebar .nav {
  padding: 0.75rem;
  flex-grow: 1;
}

.sidebar .nav-link {
  color: #cbd5e1;
  border-radius: var(--radius-md);
  padding: 0.65rem 0.9rem;
  margin-bottom: 0.15rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.925rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar .nav-link i {
  font-size: 1.05rem;
  width: 20px;
  text-align: center;
}

.sidebar .nav-link:hover {
  background: var(--sidebar-bg-hover);
  color: #fff;
}

.sidebar .nav-link.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  font-weight: 600;
}

.sidebar .sidebar-footer {
  padding: 1rem 1.25rem;
  font-size: 0.75rem;
  color: #64748b;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.main-col {
  flex-grow: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--card-border);
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.topbar .admin-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-cyan));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

#sidebarToggle {
  display: none;
  border: none;
  background: transparent;
  font-size: 1.4rem;
  color: #1f2937;
}

.content-area {
  padding: 1.5rem;
  flex-grow: 1;
}

/* ---------------------------------------------------------------------
   CARDS / SUMMARY WIDGETS
   --------------------------------------------------------------------- */
.card {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
}

.stat-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
  padding: 1.25rem;
  background: #fff;
  height: 100%;
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: #fff;
}

.stat-card .stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: #0f172a;
}

.stat-card .stat-label {
  color: var(--text-muted-soft);
  font-size: 0.85rem;
}

.icon-teal { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); }
.icon-cyan { background: linear-gradient(135deg, var(--accent-cyan), #0891b2); }
.icon-amber { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.icon-violet { background: linear-gradient(135deg, #a78bfa, #7c3aed); }

/* ---------------------------------------------------------------------
   TABLES
   --------------------------------------------------------------------- */
.table thead th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted-soft);
  border-bottom-width: 1px;
  white-space: nowrap;
}

.table td {
  vertical-align: middle;
}

.table-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
  overflow: hidden;
}

.section-title {
  font-weight: 700;
  color: #0f172a;
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  border: none;
}

.btn-accent:hover {
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  color: #fff;
}

.avatar-sm {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #eef2f7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--accent-dark);
  font-size: 0.8rem;
}

/* ---------------------------------------------------------------------
   INVOICE PREVIEW / PRINT
   --------------------------------------------------------------------- */
.invoice-box {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
  padding: 2rem;
}

.invoice-box .invoice-brand {
  font-weight: 700;
  font-size: 1.3rem;
  color: #0f172a;
}

@media print {
  .sidebar, .topbar, .no-print {
    display: none !important;
  }
  .content-area {
    padding: 0 !important;
  }
  .main-col {
    width: 100% !important;
  }
  .invoice-box {
    border: none !important;
    box-shadow: none !important;
  }
  body {
    background: #fff !important;
  }
}

/* ---------------------------------------------------------------------
   POS / THERMAL RECEIPT — LIVE PREVIEW + PRINT LAYOUT
   Shown on screen as an actual styled preview (not hidden) so the admin
   can check formatting before printing. data-width="80" or "58" (set by
   the radio toggle in invoice-view.php) controls both the on-screen
   preview size and the @page size used when printing.
   --------------------------------------------------------------------- */
.pos-preview-wrap {
  display: flex;
  justify-content: center;
  padding: 32px 16px;
  background: #eef1f5;
  border-radius: var(--radius-lg);
}

.pos-receipt-box {
  background: #fff;
  color: #111827;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
  padding: 18px 16px;
  width: 72mm;         /* 80mm paper, minus margins */
  transition: width 0.15s ease;
}

.pos-receipt-box[data-width="58"] {
  width: 50mm;         /* 58mm paper, minus margins */
  font-size: 11px;
}

.pos-header {
  text-align: center;
  margin-bottom: 8px;
}

.pos-store-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin-bottom: 2px;
}

.pos-receipt-box[data-width="58"] .pos-store-name {
  font-size: 13px;
}

.pos-store-line {
  font-size: 11px;
  color: #4b5563;
  line-height: 1.4;
}

.pos-divider-strong {
  border-top: 2px solid #111827;
  margin: 10px 0 8px;
}

.pos-divider {
  border-top: 1px dashed #9ca3af;
  margin: 8px 0;
}

.pos-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #374151;
  margin-bottom: 3px;
}

.pos-item {
  margin-bottom: 6px;
}

.pos-item-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #111827;
}

.pos-item-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: #6b7280;
  margin-top: 1px;
}

.pos-total-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 2px solid #111827;
  border-radius: 6px;
  padding: 6px 10px;
  margin-top: 10px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.02em;
}

.pos-footer {
  text-align: center;
  font-size: 10.5px;
  color: #6b7280;
  margin-top: 14px;
  line-height: 1.5;
}

/* ---------------------------------------------------------------------
   RESPONSIVE: SIDEBAR COLLAPSES TO OFFCANVAS ON SMALL SCREENS
   --------------------------------------------------------------------- */
@media (max-width: 991.98px) {
  #sidebarToggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.15);
  }

  .sidebar.show {
    transform: translateX(0);
  }
}

/* Low stock row highlight */
.row-low-stock {
  background-color: #fff8e6 !important;
}

.row-out-of-stock {
  background-color: #fdecec !important;
}

/* Utility */
.cursor-pointer { cursor: pointer; }
.text-accent { color: var(--accent-dark) !important; }