@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Poppins:wght@400;500;600&display=swap');

:root {
  --bg-primary:    #0f0a0e;
  --bg-secondary:  #1a1018;
  --bg-card:       rgba(255,255,255,0.04);
  --bg-card-hover: rgba(255,255,255,0.07);
  --sidebar-bg:    #130e12;
  --sidebar-w:     260px;

  --rose:       #c9768a;
  --rose-light: #e8a0b0;
  --gold:       #d4a96a;
  --gold-light: #f0c98a;
  --plum:       #8b5a72;
  --cream:      #f5ede8;

  --accent:     #c9768a;
  --accent-2:   #d4a96a;

  --text-primary:   #f0e8eb;
  --text-secondary: #9a8590;
  --text-muted:     #6b5a62;

  --border:     rgba(201,118,138,0.15);
  --border-2:   rgba(255,255,255,0.06);

  --success: #5dbf8a;
  --warning: #f0b955;
  --danger:  #e06070;
  --info:    #60a8d4;

  --radius:    14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --shadow:    0 8px 32px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 12px rgba(0,0,0,0.3);
  --glow:      0 0 20px rgba(201,118,138,0.2);

  --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
}

body.light-theme {
  --bg-primary:    #f8f6f7;
  --bg-secondary:  #ffffff;
  --bg-card:       rgba(0,0,0,0.03);
  --bg-card-hover: rgba(0,0,0,0.05);
  --sidebar-bg:    #ffffff;
  
  --text-primary:   #2d1e26;
  --text-secondary: #5a4b54;
  --text-muted:     #8a7b83;
  
  --border:     rgba(201,118,138,0.25);
  --border-2:   rgba(0,0,0,0.08);
  
  --shadow:    0 8px 32px rgba(201,118,138,0.1);
  --shadow-sm: 0 2px 12px rgba(0,0,0,0.05);
  --sidebar-shadow: 10px 0 30px rgba(0,0,0,0.02);
}

body.light-theme .sidebar { border-right: 1px solid var(--border-2); }
body.light-theme .top-header { background: rgba(255,255,255,0.85); }
body.light-theme .nav-item:hover { background: rgba(201,118,138,0.05); }
body.light-theme .card { box-shadow: var(--shadow-sm); }
body.light-theme .stat-card { box-shadow: var(--shadow-sm); }
body.light-theme .stat-card:hover { box-shadow: 0 10px 20px rgba(201,118,138,0.08); }
body.light-theme .form-control { background: #fff; }
body.light-theme .cat-tab { background: #fff; }
body.light-theme .product-item { background: #fff; }
body.light-theme .pos-sidebar { background: #fff; }
body.light-theme .cart-summary { background: #fdfafb; }

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Scrollbar ─────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--plum); border-radius: 10px; }

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

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  background: var(--bg-primary);
  transition: margin var(--transition);
}

.page-wrapper {
  padding: 28px 32px;
  max-width: 1600px;
}

/* ── Sidebar ────────────────────────────────────── */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

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

.brand-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--rose), var(--plum));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: var(--glow);
  flex-shrink: 0;
}

.brand-text h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.3px;
}

.brand-text span {
  font-size: 11px;
  color: var(--text-muted);
}

.sidebar-nav { flex: 1; padding: 16px 12px; }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  padding: 8px 8px 4px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  margin-bottom: 2px;
  position: relative;
}

.nav-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(201,118,138,0.2), rgba(139,90,114,0.15));
  color: var(--rose-light);
  border: 1px solid rgba(201,118,138,0.25);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--rose);
  border-radius: 0 3px 3px 0;
}

.nav-icon { font-size: 17px; width: 22px; text-align: center; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-2);
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rose), var(--gold));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-info .user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-info .user-role { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }

.logout-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all var(--transition);
  font-size: 15px;
}
.logout-btn:hover { color: var(--danger); background: rgba(224,96,112,0.1); }

/* ── Top Header ─────────────────────────────────── */
.top-header {
  height: 64px;
  background: rgba(19,14,18,0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 32px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-title { font-size: 20px; font-weight: 700; color: var(--text-primary); flex: 1; }
.page-subtitle { font-size: 13px; color: var(--text-muted); font-weight: 400; margin-left: 8px; }

.header-actions { display: flex; align-items: center; gap: 10px; }

.header-time {
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  background: var(--bg-card);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-2);
}

/* ── Cards ──────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 24px;
  transition: all var(--transition);
}

.card:hover { border-color: var(--border); background: var(--bg-card-hover); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent-gradient, linear-gradient(90deg, var(--rose), var(--gold)));
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--border);
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.rose   { background: rgba(201,118,138,0.15); }
.stat-icon.gold   { background: rgba(212,169,106,0.15); }
.stat-icon.green  { background: rgba(93,191,138,0.15); }
.stat-icon.blue   { background: rgba(96,168,212,0.15); }
.stat-icon.purple { background: rgba(139,90,114,0.15); }

.stat-body { flex: 1; min-width: 0; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.stat-value { font-size: 26px; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.stat-up   { color: var(--success); }
.stat-down { color: var(--danger); }

/* ── Buttons ────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--rose), var(--plum));
  color: #fff;
  box-shadow: 0 4px 15px rgba(201,118,138,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(201,118,138,0.4); }

.btn-gold {
  background: linear-gradient(135deg, var(--gold), #b8853a);
  color: #fff;
  box-shadow: 0 4px 15px rgba(212,169,106,0.3);
}
.btn-gold:hover { transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--rose); color: var(--rose); background: rgba(201,118,138,0.08); }

.btn-success { background: linear-gradient(135deg, #4aad76, #2d8a56); color: #fff; }
.btn-danger  { background: linear-gradient(135deg, var(--danger), #b84050); color: #fff; }
.btn-sm { padding: 6px 13px; font-size: 12px; }
.btn-lg { padding: 13px 28px; font-size: 16px; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); background: var(--bg-card); border: 1px solid var(--border-2); color: var(--text-secondary); cursor: pointer; transition: all var(--transition); font-size: 16px; display: inline-flex; }
.btn-icon:hover { border-color: var(--rose); color: var(--rose); }

/* ── Forms ──────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 7px; }

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  transition: all var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--rose);
  background: rgba(201,118,138,0.05);
  box-shadow: 0 0 0 3px rgba(201,118,138,0.1);
}

.form-control::placeholder { color: var(--text-muted); }
select.form-control option { background: var(--bg-secondary); color: var(--text-primary); }

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

/* ── Tables ─────────────────────────────────────── */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); }

table { width: 100%; border-collapse: collapse; }

thead th {
  background: rgba(255,255,255,0.03);
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-2);
  white-space: nowrap;
}

tbody td {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

tbody tr:hover { background: var(--bg-card-hover); }
tbody tr:last-child td { border-bottom: none; }

/* ── Badges ─────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success { background: rgba(93,191,138,0.15); color: var(--success); }
.badge-warning { background: rgba(240,185,85,0.15); color: var(--warning); }
.badge-danger  { background: rgba(224,96,112,0.15); color: var(--danger); }
.badge-info    { background: rgba(96,168,212,0.15); color: var(--info); }
.badge-rose    { background: rgba(201,118,138,0.15); color: var(--rose-light); }

/* ── Modals ─────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px) scale(0.98);
  transition: all var(--transition);
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}

.modal-overlay.active .modal { transform: translateY(0) scale(1); }

.modal-header {
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--border-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 17px; font-weight: 700; }

.modal-close {
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  color: var(--text-muted);
  width: 32px; height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all var(--transition);
}
.modal-close:hover { border-color: var(--danger); color: var(--danger); }

.modal-body    { padding: 24px; }
.modal-footer  { padding: 16px 24px; border-top: 1px solid var(--border-2); display: flex; gap: 10px; justify-content: flex-end; }

/* ── Toast Notifications ────────────────────────── */
.toast-container {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  max-width: 380px;
  box-shadow: var(--shadow);
  animation: slideInRight 0.3s ease;
  font-size: 14px;
}

.toast.success { border-color: var(--success); }
.toast.error   { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }

@keyframes slideInRight {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes fadeOut {
  to { opacity: 0; transform: translateX(120%); }
}

/* ── Search Bar ─────────────────────────────────── */
.search-bar {
  position: relative;
}

.search-bar input {
  padding-left: 38px;
}

.search-bar .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 15px;
  pointer-events: none;
}

/* ── Empty State ────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 52px; margin-bottom: 12px; opacity: 0.5; }
.empty-state h3 { font-size: 16px; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; }

/* ── Page Header ────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-heading h2 { font-size: 22px; font-weight: 700; }
.page-heading p  { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ── Grids ──────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ── Utility ────────────────────────────────────── */
.text-rose    { color: var(--rose); }
.text-gold    { color: var(--gold); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-muted   { color: var(--text-muted); }
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.fw-700       { font-weight: 700; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex  { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

.divider { height: 1px; background: var(--border-2); margin: 16px 0; }

/* ── Loading Spinner ────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--rose);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-260px); transition: transform var(--transition); }
  .sidebar.open { transform: translateX(0); --sidebar-w: 260px; }
  .main-content { margin-left: 0; }
  .page-wrapper { padding: 16px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
