/* =========================================================================
   Mini Mart Inventory - custom styles layered on top of Bootstrap 5.
   Kept deliberately small: Bootstrap utility classes handle most layout,
   this file only covers the sidebar shell, brand colors, and small
   inventory-specific touches (stat cards, low-stock highlighting, receipt).
   ========================================================================= */

:root {
  --brand: #2e7d32;      /* primary green - inventory/retail feel */
  --brand-dark: #1b5e20;
  --brand-light: #e8f5e9;
  --sidebar-width: 250px;
  --topbar-height: 60px;
}

body {
  background-color: #f4f6f8;
  font-size: 0.95rem;
}

/* ---------------------------------------------------------------------
   App shell: fixed sidebar + topbar, scrollable content area
   --------------------------------------------------------------------- */
.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--brand-dark), var(--brand));
  color: #fff;
  overflow-y: auto;
  z-index: 1030;
  transition: transform 0.25s ease;
}

.app-sidebar .brand {
  padding: 1rem 1.25rem;
  font-weight: 700;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.app-sidebar .nav-link {
  color: rgba(255, 255, 255, 0.85);
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border-left: 3px solid transparent;
}

.app-sidebar .nav-link i {
  width: 1.25rem;
  text-align: center;
}

.app-sidebar .nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.app-sidebar .nav-link.active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-left-color: #fff;
  font-weight: 600;
}

.app-sidebar .nav-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.55);
  padding: 1rem 1.25rem 0.25rem;
}

.app-main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.app-content {
  padding: 1.5rem;
  flex: 1;
}

.sidebar-toggle {
  display: none;
}

@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.show {
    transform: translateX(0);
  }
  .app-main {
    margin-left: 0;
  }
  .sidebar-toggle {
    display: inline-flex;
  }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1025;
  }
  .sidebar-backdrop.show {
    display: block;
  }
}

/* ---------------------------------------------------------------------
   Stat / dashboard cards
   --------------------------------------------------------------------- */
.stat-card {
  border: none;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  height: 100%;
}

.stat-card .stat-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: #fff;
}

.stat-card .stat-value {
  font-size: 1.6rem;
  font-weight: 700;
}

.bg-icon-green  { background: #2e7d32; }
.bg-icon-blue   { background: #1565c0; }
.bg-icon-amber  { background: #ef6c00; }
.bg-icon-red    { background: #c62828; }
.bg-icon-purple { background: #6a1b9a; }

.card {
  border-radius: 0.75rem;
  border: 1px solid #e9ecef;
}

.card-header {
  background: #fff;
  border-bottom: 1px solid #e9ecef;
  font-weight: 600;
}

/* ---------------------------------------------------------------------
   Inventory-specific highlighting
   --------------------------------------------------------------------- */
tr.low-stock td {
  background-color: #fff3e0 !important;
}

.badge-low-stock {
  background-color: #ef6c00;
}

.badge-out-of-stock {
  background-color: #c62828;
}

.pos-card {
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.pos-card:hover {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.pos-card:active {
  transform: translateY(0);
}

/* Compact POS tiles - roughly 60% the footprint of the original cards
   (smaller image, tighter padding, smaller type) so more fit on screen at once. */
.pos-card-sm .card-body {
  padding: 0.3rem;
}

.pos-card-sm .fw-semibold {
  font-size: 0.7rem;
  line-height: 1.15;
}

.pos-card-sm .text-success,
.pos-card-sm .badge {
  font-size: 0.65rem;
}

.pos-card-sm .badge {
  padding: 0.25em 0.4em;
}

.product-thumb {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 0.4rem;
  background: #f1f3f5;
}

.table-responsive {
  border-radius: 0.5rem;
}

/* ---------------------------------------------------------------------
   Login page
   --------------------------------------------------------------------- */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  padding: 1rem;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  border-radius: 1rem;
  border: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* ---------------------------------------------------------------------
   Receipt (print layout)
   --------------------------------------------------------------------- */
.receipt {
  max-width: 340px;
  margin: 0 auto;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
}

.receipt hr {
  border-top: 1px dashed #999;
}

.receipt table {
  width: 100%;
}

@media print {
  .no-print {
    display: none !important;
  }
  body {
    background: #fff;
  }
}

/* Dark theme toggle (optional light/dark switch) */
[data-bs-theme="dark"] body,
body[data-bs-theme="dark"] {
  background-color: #14181b;
}

[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .app-topbar {
  background-color: #1e2328;
  border-color: #2b3238;
  color: #e9ecef;
}

[data-bs-theme="dark"] tr.low-stock td {
  background-color: #4a3418 !important;
  color: #f1f1f1;
}
