/* ============================================================
   ARTHVANA POS — Main Stylesheet
   Light Theme | High Contrast | Fashion Retail Optimized
   ============================================================ */

/* ── Google Fonts ──────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  /* Primary palette */
  --bg:           #F5F6FA;
  --surface:      #FFFFFF;
  --surface-2:    #F0F1F5;
  --border:       #E2E4EB;
  --border-strong:#C8CAD4;

  /* Text */
  --text-primary: #111827;
  --text-secondary:#4B5563;
  --text-muted:   #9CA3AF;
  --text-inverse: #FFFFFF;

  /* Brand */
  --brand:        #1A1A2E;
  --brand-mid:    #2D2D4E;
  --brand-light:  #E8E8F5;
  --gold:         #C8973A;
  --gold-light:   #FDF3E0;
  --gold-dark:    #A67829;

  /* Status */
  --success:      #16A34A;
  --success-bg:   #F0FDF4;
  --warning:      #D97706;
  --warning-bg:   #FFFBEB;
  --danger:       #DC2626;
  --danger-bg:    #FEF2F2;
  --info:         #2563EB;
  --info-bg:      #EFF6FF;

  /* Layout */
  --sidebar-w:    240px;
  --topbar-h:     60px;
  --bottomnav-h:  64px;
  --radius:       10px;
  --radius-lg:    16px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:       0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.12);

  /* Typography */
  --font-main:    'Plus Jakarta Sans', system-ui, sans-serif;
  --font-display: 'Space Grotesk', system-ui, sans-serif;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
input, select, textarea { font-family: inherit; }

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

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--brand);
  color: var(--text-inverse);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.3s ease;
}

.sidebar-logo {
  padding: 1.5rem 1.2rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo .store-logo-img {
  width: 44px; height: 44px;
  border-radius: 10px;
  object-fit: contain;
  background: rgba(255,255,255,0.1);
  margin-bottom: 10px;
}
.sidebar-logo .logo-placeholder {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 800; font-size: 1.2rem;
  color: var(--brand);
  margin-bottom: 10px;
}
.sidebar-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.3px;
  color: #fff;
}
.sidebar-brand span { color: var(--gold); }
.sidebar-tagline {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.45);
  margin-top: 2px;
}

.sidebar-store-name {
  padding: 0.9rem 1.2rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-nav { flex: 1; padding: 0.8rem 0; }

.nav-section-label {
  padding: 0.6rem 1.2rem 0.3rem;
  font-size: 0.65rem;
  font-weight: 700;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1.2rem;
  margin: 2px 0.6rem;
  border-radius: 8px;
  color: rgba(255,255,255,0.7);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.15s ease;
  cursor: pointer;
}
.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}
.nav-item.active {
  background: var(--gold);
  color: var(--brand);
  font-weight: 700;
}
.nav-item .nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}
.nav-item.active .nav-icon { opacity: 1; }

.sidebar-footer {
  padding: 1rem 1.2rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.68rem;
  color: rgba(255,255,255,0.25);
  text-align: center;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1.2rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8rem;
  color: var(--brand);
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name {
  font-size: 0.82rem; font-weight: 600;
  color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-role {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.45);
  text-transform: capitalize;
}
.logout-btn {
  background: none; border: none;
  color: rgba(255,255,255,0.4);
  padding: 4px;
  border-radius: 6px;
  transition: color 0.15s;
}
.logout-btn:hover { color: var(--danger); }

/* ── Main Content Area ─────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Top Bar ───────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.topbar-time {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}
.menu-toggle {
  display: none;
  background: none;
  border: none;
  padding: 6px;
  color: var(--text-primary);
  border-radius: 8px;
}

/* ── Page Content ──────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 1.5rem;
}

/* ── Page Header ───────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.page-header h1 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
}
.page-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.card-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}
.card-body { padding: 1.4rem; }

/* ── Stat Cards ────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.4rem;
  box-shadow: var(--shadow-sm);
}
.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.stat-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.stat-card.gold-accent { border-left: 4px solid var(--gold); }
.stat-card.green-accent { border-left: 4px solid var(--success); }
.stat-card.red-accent { border-left: 4px solid var(--danger); }
.stat-card.blue-accent { border-left: 4px solid var(--info); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  line-height: 1;
}
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-mid); }
.btn-gold { background: var(--gold); color: var(--brand); }
.btn-gold:hover { background: var(--gold-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border-strong);
  color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-full { width: 100%; }
.btn-icon { padding: 8px; border-radius: 8px; }

/* ── Form Elements ─────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}
.form-control {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--text-primary);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200,151,58,0.15);
}
.form-control::placeholder { color: var(--text-muted); }
select.form-control { appearance: none; cursor: pointer; }
.form-row { display: grid; gap: 1rem; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.input-group { position: relative; }
.input-prefix, .input-suffix {
  position: absolute; top: 50%; transform: translateY(-50%);
  font-size: 0.85rem; color: var(--text-muted); font-weight: 500;
  pointer-events: none;
}
.input-prefix { left: 12px; }
.input-suffix { right: 12px; }
.input-group .form-control { padding-left: 30px; }
.input-group.has-suffix .form-control { padding-right: 40px; }

/* ── Tables ────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
thead th {
  background: var(--surface-2);
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger);  }
.badge-info    { background: var(--info-bg);     color: var(--info);    }
.badge-neutral { background: var(--surface-2);   color: var(--text-muted); }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.modal-header {
  padding: 1.2rem 1.4rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-weight: 700; font-size: 1rem; }
.modal-close {
  background: none; border: none;
  color: var(--text-muted);
  font-size: 1.3rem; line-height: 1;
  padding: 4px 8px; border-radius: 6px;
  transition: all 0.15s;
}
.modal-close:hover { background: var(--surface-2); color: var(--text-primary); }
.modal-body { padding: 1.4rem; }
.modal-footer {
  padding: 1rem 1.4rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* ── Toast Notifications ───────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 1rem; right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.toast {
  background: var(--brand);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 320px;
  pointer-events: auto;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger);  }
.toast.warning { background: var(--warning); }
@keyframes toastIn {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes toastOut {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(40px); opacity: 0; }
}

/* ── Toggle Switch ─────────────────────────────────────────── */
.toggle-switch { position: relative; display: inline-flex; align-items: center; gap: 0.6rem; cursor: pointer; }
.toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
  width: 44px; height: 24px;
  background: var(--border-strong);
  border-radius: 12px;
  position: relative;
  transition: background 0.2s;
}
.toggle-track::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-track { background: var(--success); }
.toggle-switch input:checked + .toggle-track::after { transform: translateX(20px); }

/* ── Search Bar ────────────────────────────────────────────── */
.search-bar {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0 12px;
  transition: border-color 0.15s;
}
.search-bar:focus-within { border-color: var(--gold); }
.search-bar input {
  border: none; background: none;
  padding: 9px 0; font-size: 0.9rem;
  color: var(--text-primary); flex: 1; outline: none;
}
.search-bar svg { color: var(--text-muted); flex-shrink: 0; }

/* ── Alert Bar ─────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  display: flex; align-items: flex-start; gap: 0.5rem;
}
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #bbf7d0; }
.alert-error   { background: var(--danger-bg);  color: var(--danger);  border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid #fed7aa; }
.alert-info    { background: var(--info-bg);    color: var(--info);    border: 1px solid #bfdbfe; }

/* ── Footer ────────────────────────────────────────────────── */
.app-footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: auto;
}

/* ── Bottom Nav (Mobile) ───────────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottomnav-h);
  background: var(--brand);
  z-index: 100;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.bottom-nav-inner {
  display: flex;
  height: 100%;
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: rgba(255,255,255,0.55);
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: color 0.15s;
  cursor: pointer;
}
.bottom-nav-item svg { width: 22px; height: 22px; }
.bottom-nav-item.active { color: var(--gold); }
.bottom-nav-item:active { background: rgba(255,255,255,0.06); }

/* ── Utility Classes ───────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-sm { font-size: 0.8rem; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger);  }
.text-gold    { color: var(--gold);    }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
.tag {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ── Responsive — Mobile ───────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,0.25);
  }
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
  }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0; }
  .menu-toggle { display: flex; align-items: center; justify-content: center; }
  .bottom-nav { display: block; }
  .page-content { padding: 1rem; padding-bottom: calc(var(--bottomnav-h) + 1rem); }
  .topbar { padding: 0 1rem; }
  .form-row.cols-2,
  .form-row.cols-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .modal { max-height: 95vh; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .topbar-time { display: none; }
}

/* ── Print — General ───────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .bottom-nav, .app-footer,
  .btn, .no-print { display: none !important; }
  .main-content { margin-left: 0; }
  body { background: #fff; }
}
