/* =========================================================
   One Dollar Shop POS — Premium Dark Theme (v4 — dark pass)
   ========================================================= */

:root {
  --bg-body: #0a0d16;
  --bg-surface: #141a2b;
  --bg-surface-2: #1a2136;
  --bg-surface-hover: #212a42;
  --border-color: #262f47;
  --border-color-soft: #1e2538;
  --text-primary: #f1f4fa;
  --text-secondary: #9aa6c3;
  --text-muted: #69749a;

  --accent-blue: #4d6fff;
  --accent-blue-soft: rgba(77, 111, 255, 0.15);
  --accent-emerald: #16c98d;
  --accent-emerald-soft: rgba(22, 201, 141, 0.15);
  --accent-amber: #f5a623;
  --accent-amber-soft: rgba(245, 166, 35, 0.15);
  --accent-red: #f4425f;
  --accent-red-soft: rgba(244, 66, 95, 0.15);
  --accent-purple: #9d6bff;
  --accent-purple-soft: rgba(157, 107, 255, 0.15);

  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 16px 40px rgba(0, 0, 0, 0.45);
  --ease: cubic-bezier(.2, .7, .3, 1);
  --sidebar-width: 268px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background:
    radial-gradient(900px circle at 0% -10%, rgba(76,141,255,0.07) 0%, transparent 55%),
    radial-gradient(700px circle at 100% 0%, rgba(155,107,255,0.06) 0%, transparent 50%),
    var(--bg-body);
  color: var(--text-primary);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14.5px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; transition: color .15s var(--ease); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #33405f; }
::-webkit-scrollbar-track { background: transparent; }
::selection { background: var(--accent-blue-soft); color: var(--text-primary); }

/* Gentle fade-in for the main content area on every page load */
@keyframes pageFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.page-content { padding: 26px 28px 60px; animation: pageFadeIn .35s var(--ease); }

/* ---------- Layout ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #131a2b 0%, #0d1220 100%);
  border-right: 1px solid var(--border-color-soft);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform .25s var(--ease);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
  border-bottom: 1px solid var(--border-color-soft);
}

.sidebar-brand .logo-badge {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 18px;
  box-shadow: 0 6px 18px rgba(76,141,255,0.4), inset 0 1px 0 rgba(255,255,255,0.15);
  overflow: hidden;
}
.sidebar-brand .logo-badge img { width: 100%; height: 100%; object-fit: cover; }

.sidebar-brand .brand-text { line-height: 1.2; }
.sidebar-brand .brand-text strong { display: block; font-size: 15px; letter-spacing: -.01em; }
.sidebar-brand .brand-text span { font-size: 11.5px; color: var(--text-muted); }

.sidebar-nav { padding: 14px 12px; overflow-y: auto; flex: 1; }
.nav-section-title {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--text-muted); padding: 16px 12px 6px;
  font-weight: 700;
}

.nav-link-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 13.7px; font-weight: 500;
  margin-bottom: 2px; transition: background .15s var(--ease), color .15s var(--ease), transform .1s var(--ease);
  position: relative;
}
.nav-link-item i { width: 18px; text-align: center; font-size: 15px; transition: transform .15s var(--ease); }
.nav-link-item:hover { background: var(--bg-surface-hover); color: var(--text-primary); }
.nav-link-item:hover i { transform: scale(1.08); }
.nav-link-item:active { transform: scale(.98); }
.nav-link-item.active {
  background: var(--accent-blue-soft); color: var(--accent-blue);
  font-weight: 600;
}
.nav-link-item.active::before {
  content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 4px 4px 0;
  background: var(--accent-blue); box-shadow: 0 0 10px var(--accent-blue);
}

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
}

.topbar {
  height: 68px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--border-color-soft);
  background: rgba(12, 16, 25, 0.78);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  position: sticky; top: 0; z-index: 900;
}

.topbar .search-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 8px 14px;
  display: flex; align-items: center; gap: 10px;
  width: 340px;
  color: var(--text-muted);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.topbar .search-box:focus-within { border-color: var(--accent-blue); box-shadow: 0 0 0 3px var(--accent-blue-soft); }
.topbar .search-box input {
  background: transparent; border: none; outline: none;
  color: var(--text-primary); width: 100%; font-size: 13.5px;
}

/* ---------- Cards ---------- */
.card-glass {
  background: linear-gradient(180deg, var(--bg-surface) 0%, #141a29 100%);
  border: 1px solid var(--border-color-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  transition: border-color .2s var(--ease);
}

.stat-card {
  background: linear-gradient(180deg, var(--bg-surface) 0%, #141a29 100%);
  border: 1px solid var(--border-color-soft);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex; align-items: center; gap: 16px;
  transition: transform .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.stat-card:hover { transform: translateY(-4px); border-color: #33405f; box-shadow: var(--shadow-lift); }

.stat-icon {
  width: 50px; height: 50px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
  transition: transform .2s var(--ease);
}
.stat-card:hover .stat-icon { transform: scale(1.06) rotate(-2deg); }
.stat-icon.blue { background: var(--accent-blue-soft); color: var(--accent-blue); }
.stat-icon.emerald { background: var(--accent-emerald-soft); color: var(--accent-emerald); }
.stat-icon.amber { background: var(--accent-amber-soft); color: var(--accent-amber); }
.stat-icon.red { background: var(--accent-red-soft); color: var(--accent-red); }
.stat-icon.purple { background: var(--accent-purple-soft); color: var(--accent-purple); }

.stat-label { font-size: 12.5px; color: var(--text-muted); font-weight: 500; margin-bottom: 3px; }
.stat-value { font-size: 21px; font-weight: 700; color: var(--text-primary); letter-spacing: -.01em; }
.stat-trend { font-size: 11.5px; font-weight: 600; }
.stat-trend.up { color: var(--accent-emerald); }
.stat-trend.down { color: var(--accent-red); }

/* ---------- Buttons ---------- */
.btn-brand {
  background: linear-gradient(135deg, var(--accent-blue), #3a6fe0);
  border: none; color: #fff; font-weight: 600;
  border-radius: var(--radius-sm); padding: 9px 18px;
  box-shadow: 0 6px 16px rgba(76,141,255,0.28);
  transition: filter .15s var(--ease), transform .1s var(--ease), box-shadow .15s var(--ease);
}
.btn-brand:hover { filter: brightness(1.1); color: #fff; box-shadow: 0 8px 22px rgba(76,141,255,0.4); transform: translateY(-1px); }
.btn-brand:active { transform: translateY(0); }

.btn-emerald {
  background: linear-gradient(135deg, var(--accent-emerald), #1aa877);
  border: none; color: #fff; font-weight: 600;
  border-radius: var(--radius-sm); padding: 9px 18px;
  box-shadow: 0 6px 16px rgba(34,197,139,0.25);
  transition: filter .15s var(--ease), transform .1s var(--ease), box-shadow .15s var(--ease);
}
.btn-emerald:hover { filter: brightness(1.1); color: #fff; box-shadow: 0 8px 22px rgba(34,197,139,0.35); transform: translateY(-1px); }
.btn-emerald:active { transform: translateY(0); }

.btn-outline-soft {
  background: var(--bg-surface-2); border: 1px solid var(--border-color);
  color: var(--text-secondary); border-radius: var(--radius-sm);
  padding: 9px 16px; font-weight: 500;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.btn-outline-soft:hover { background: var(--bg-surface-hover); color: var(--text-primary); border-color: #3a4a6b; }

.btn-close-white { filter: invert(1) grayscale(100%) brightness(200%); opacity: .7; }
.btn-close-white:hover { opacity: 1; }

/* ---------- Tables ---------- */
.table-premium {
  width: 100%; border-collapse: separate; border-spacing: 0;
}
.table-premium thead th {
  background: var(--bg-surface-2); color: var(--text-muted);
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  padding: 13px 16px; border-bottom: 1px solid var(--border-color);
  font-weight: 700; white-space: nowrap;
}
.table-premium thead th:first-child { border-top-left-radius: var(--radius-sm); }
.table-premium thead th:last-child { border-top-right-radius: var(--radius-sm); }
.table-premium tbody td {
  padding: 13px 16px; border-bottom: 1px solid var(--border-color-soft);
  color: var(--text-primary); font-size: 13.5px; vertical-align: middle;
  transition: background .1s var(--ease);
}
.table-premium tbody tr { transition: background .12s var(--ease); }
.table-premium tbody tr:hover { background: var(--bg-surface-2); }
.table-premium tbody tr:last-child td { border-bottom: none; }

/* ---------- Badges ---------- */
.badge-soft { padding: 5px 11px; border-radius: 20px; font-size: 11.5px; font-weight: 600; letter-spacing: .01em; }
.badge-soft.blue { background: var(--accent-blue-soft); color: var(--accent-blue); }
.badge-soft.emerald { background: var(--accent-emerald-soft); color: var(--accent-emerald); }
.badge-soft.amber { background: var(--accent-amber-soft); color: var(--accent-amber); }
.badge-soft.red { background: var(--accent-red-soft); color: var(--accent-red); }
.badge-soft.purple { background: var(--accent-purple-soft); color: var(--accent-purple); }
.badge-soft.gray { background: var(--bg-surface-2); color: var(--text-muted); }

/* ---------- Forms ---------- */
.form-control, .form-select {
  background: var(--bg-surface-2); border: 1px solid var(--border-color);
  color: var(--text-primary); border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 13.8px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.form-control:focus, .form-select:focus {
  background: var(--bg-surface-2); border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-blue-soft); color: var(--text-primary);
}
.form-control:hover:not(:focus), .form-select:hover:not(:focus) { border-color: #35426a; }
.form-label { font-size: 12.8px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
::placeholder { color: var(--text-muted); opacity: 1; }

.form-check-input {
  background-color: var(--bg-surface-2); border-color: var(--border-color);
}
.form-check-input:checked { background-color: var(--accent-blue); border-color: var(--accent-blue); }
.form-check-input:focus { box-shadow: 0 0 0 3px var(--accent-blue-soft); }

/* ---------- Modals (themed globally so every module's modal matches, no inline styles needed) ---------- */
.modal-content {
  background: linear-gradient(180deg, var(--bg-surface) 0%, #131826 100%) !important;
  border: 1px solid var(--border-color-soft) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-lift);
}
.modal-header, .modal-footer { border-color: var(--border-color-soft) !important; }
.modal-backdrop.show { opacity: .65; }
.dropdown-menu {
  background: var(--bg-surface) !important; border: 1px solid var(--border-color-soft) !important;
  box-shadow: var(--shadow-lift); border-radius: var(--radius-md);
}
.dropdown-item { color: var(--text-secondary); border-radius: var(--radius-sm); margin: 2px 4px; width: calc(100% - 8px); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--bg-surface-hover); color: var(--text-primary); }
.dropdown-divider { border-color: var(--border-color-soft); }

/* ---------- Alerts ---------- */
.alert { border-radius: var(--radius-md); border: 1px solid transparent; }
.alert-danger { background: var(--accent-red-soft); color: var(--accent-red); }
.alert-success { background: var(--accent-emerald-soft); color: var(--accent-emerald); }
.alert-warning { background: var(--accent-amber-soft); color: var(--accent-amber); }
.alert-info { background: var(--accent-blue-soft); color: var(--accent-blue); }

/* ---------- Pagination ---------- */
.page-link {
  background: var(--bg-surface-2); border: 1px solid var(--border-color);
  color: var(--text-secondary);
}
.page-link:hover { background: var(--bg-surface-hover); color: var(--text-primary); }
.page-item.active .page-link { background: var(--accent-blue); border-color: var(--accent-blue); color: #fff; }

/* ---------- Login Page ---------- */
.auth-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(700px circle at 15% 15%, rgba(76,141,255,0.12) 0%, transparent 55%),
    radial-gradient(600px circle at 85% 85%, rgba(155,107,255,0.10) 0%, transparent 50%),
    #0a0d16;
  padding: 20px;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: linear-gradient(180deg, var(--bg-surface) 0%, #131826 100%);
  border: 1px solid var(--border-color-soft);
  border-radius: 22px; padding: 40px 36px;
  box-shadow: 0 30px 70px rgba(0,0,0,0.5);
  animation: fadeUp .5s var(--ease);
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px);} to { opacity: 1; transform: translateY(0);} }

.auth-logo {
  width: 62px; height: 62px; border-radius: 18px; margin: 0 auto 18px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; color: #fff;
  box-shadow: 0 12px 30px rgba(76,141,255,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
  overflow: hidden;
}
.auth-logo img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Misc ---------- */
.text-muted-soft { color: var(--text-muted) !important; }
.divider-soft { border-color: var(--border-color-soft); }
.section-title { font-size: 20px; font-weight: 700; margin-bottom: 2px; letter-spacing: -.015em; }
.section-subtitle { font-size: 12.8px; color: var(--text-muted); }

.text-success { color: var(--accent-emerald) !important; }
.text-danger { color: var(--accent-red) !important; }
.text-warning { color: var(--accent-amber) !important; }

hr { opacity: 1; border-color: var(--border-color-soft); }

@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); box-shadow: 20px 0 60px rgba(0,0,0,0.5); }
  .main-content { margin-left: 0; }
  .page-content { padding: 18px 16px 50px; }
}
