/* ═══════════════════════════════════════════════════════
   DigiStore – Main Stylesheet
   ═══════════════════════════════════════════════════════ */

:root {
  --primary: #6c63ff;
  --primary-dark: #5751d5;
  --primary-light: #8b85ff;
  --secondary: #f5a623;
  --success: #2ecc71;
  --danger: #e74c3c;
  --warning: #f39c12;
  --info: #3498db;
  /* Dark mode (default) */
  --bg: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-card2: #16213e;
  --bg-input: #0f0f1a;
  --bg-deep: #0a0a14;
  --border: #2a2a4a;
  --text: #e0e0e0;
  --text-muted: #888;
  --text-light: #bbb;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(108,99,255,.18);
  --shadow-lg: 0 8px 40px rgba(108,99,255,.25);
  --transition: all .25s cubic-bezier(.4,0,.2,1);
  --navbar-h: 64px;
}

/* ─── Light Mode ─────────────────────────────────────────── */
body.light {
  --bg: #f4f5f7;
  --bg-card: #ffffff;
  --bg-card2: #eef0f6;
  --bg-input: #ffffff;
  --bg-deep: #e8eaf0;
  --border: #d0d4e4;
  --text: #1a1a2e;
  --text-muted: #5a5f78;
  --text-light: #333;
  --shadow: 0 4px 24px rgba(108,99,255,.10);
  --shadow-lg: 0 8px 40px rgba(108,99,255,.14);
}
body.light .navbar {
  background: rgba(255,255,255,0.97);
  border-bottom-color: var(--border);
}
body.light ::-webkit-scrollbar-track { background: #dde0ea; }
body.light .dropdown-menu {
  background: #ffffff;
  border-color: var(--border);
}
body.light code {
  background: #eef0f5;
  color: #5751d5;
}
body.light .navbar.menu-open .nav-links {
  background: #ffffff;
}
body.light .hero {
  background: linear-gradient(135deg, #e8eaf0 0%, #eef0f6 40%, #e4e8f5 100%);
}
body.light .product-img {
  background: linear-gradient(135deg, #dde0ea, #e8eaf0);
}
body.light .inbox-item.unread .inbox-subject {
  color: #1a1a2e;
}
body.light tbody tr { border-bottom-color: var(--border); }
body.light .inbox-item { border-bottom-color: var(--border); }
body.light .order-summary-row { border-bottom-color: var(--border); }
body.light .twofa-qr { background: #fff; }
body.light .notice-bar { opacity: .95; }
/* Smooth transitions when switching themes — only on body itself */
body {
  transition: background-color .3s ease, color .2s ease;
}

/* ─── Theme Toggle Button ────────────────────────────────── */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}
.theme-toggle:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  transform: rotate(20deg);
}

/* ─── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--primary-light); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary); }
img { max-width: 100%; display: block; }
ul { list-style: none; }
button, input, select, textarea { font-family: inherit; }
main { flex: 1; }

/* ─── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-card); }
::-webkit-scrollbar-thumb { background: var(--primary-dark); border-radius: 4px; }

/* ─── Notice Bar ─────────────────────────────────────────── */
.notice-bar {
  background: linear-gradient(90deg, var(--primary-dark), var(--primary));
  color: #fff;
  padding: 8px 20px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}
.notice-bar .notice-scroll {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
}
.notice-bar .notice-scroll span {
  display: inline-block;
  animation: marquee 30s linear infinite;
}
.notice-bar .close-notice { cursor: pointer; opacity: .7; }
.notice-bar .close-notice:hover { opacity: 1; }
@keyframes marquee { 0%{transform:translateX(100%)} 100%{transform:translateX(-100%)} }

/* ─── Navbar ─────────────────────────────────────────────── */
.navbar {
  background: rgba(26,26,46,.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--navbar-h);
  position: sticky;
  top: 0;
  z-index: 1000;
}
.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 20px;
}
.nav-brand {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-search {
  flex: 1;
  max-width: 400px;
  position: relative;
}
.nav-search input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 40px 8px 16px;
  border-radius: 24px;
  font-size: 14px;
  transition: var(--transition);
}
.nav-search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108,99,255,.2); }
.nav-search .search-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}
.nav-links { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav-link {
  color: var(--text-light);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.nav-link:hover, .nav-link.active { background: rgba(108,99,255,.15); color: var(--primary-light); }
.nav-cart { position: relative; }
.nav-balance-pill { background: rgba(46,204,113,.15); color: var(--success); border: 1px solid rgba(46,204,113,.3); padding: 5px 12px; border-radius: 20px; font-size: 13px; font-weight: 700; text-decoration: none; transition: var(--transition); white-space: nowrap; }
.nav-balance-pill:hover { background: rgba(46,204,113,.25); }
.cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-currency {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
}
.nav-currency:focus { outline: none; border-color: var(--primary); }

/* ── User avatar button ───────────────────────── */
.nav-user-btn {
  background: none;
  border: none;
  cursor: pointer;
  gap: 6px;
  padding: 5px 8px;
}
.nav-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nav-chevron { transition: transform .2s ease; }
.dropdown.open .nav-chevron { transform: rotate(180deg); }
.nav-username { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Dropdown ─────────────────────────────────── */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  min-width: 200px;
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 1100;
  animation: dropIn .15s ease;
}
@keyframes dropIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:none; } }
.dropdown:hover .dropdown-menu,
.dropdown.open .dropdown-menu { display: block; }
.dropdown-user-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 8px;
}
.dropdown-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.dropdown-item:hover { background: rgba(108,99,255,.15); color: var(--primary-light); }
.dropdown-item.active { background: rgba(108,99,255,.1); color: var(--primary-light); font-weight: 600; }
.dropdown-item-danger:hover { background: rgba(231,76,60,.12); color: #e74c3c; }
.dropdown-divider { border: none; border-top: 1px solid var(--border); margin: 6px 0; }

/* Language row inside dropdown */
.dropdown-lang-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
}
.dropdown-lang-label { font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.dropdown-lang-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  flex: 1;
  max-width: 110px;
}
.dropdown-lang-select:focus { outline: none; border-color: var(--primary); }

/* ── Hamburger → X ────────────────────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 8px;
  background: none;
  border: none;
  flex-shrink: 0;
  margin-left: 4px;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .25s ease, opacity .2s ease, width .2s ease;
  transform-origin: center;
}
.navbar.menu-open .hamburger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.navbar.menu-open .hamburger span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.navbar.menu-open .hamburger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile action bar (always beside hamburger on small screens) */
.nav-mobile-bar { display: none; align-items: center; gap: 2px; margin-left: auto; }
.theme-toggle-sm {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 5px 8px;
  font-size: 16px;
  cursor: pointer;
  transition: var(--transition);
}
.theme-toggle-sm:hover { background: rgba(108,99,255,.12); }

/* Mobile search inside nav menu */
.nav-mobile-search { display: none; }

/* ─── Hero Section ───────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 40%, #16213e 100%);
  padding: 80px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(108,99,255,.15) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  pointer-events: none;
}
.hero h1 { font-size: clamp(28px, 5vw, 52px); font-weight: 800; line-height: 1.2; margin-bottom: 16px; }
.hero h1 span { background: linear-gradient(135deg, var(--primary), var(--secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero p { font-size: 18px; color: var(--text-muted); max-width: 600px; margin: 0 auto 32px; }
.hero-btns { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-secondary { background: rgba(108,99,255,.15); color: var(--primary-light); border: 1px solid rgba(108,99,255,.3); }
.btn-secondary:hover { background: rgba(108,99,255,.25); color: var(--primary-light); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #27ae60; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d68910; color: #fff; }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg-card); color: var(--text); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }
.btn-icon { width: 36px; height: 36px; padding: 0; justify-content: center; border-radius: var(--radius-sm); }

/* ─── Container ──────────────────────────────────────────── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 20px; }
.container-sm { max-width: 800px; margin: 0 auto; padding: 0 20px; }
.container-xs { max-width: 480px; margin: 0 auto; padding: 0 20px; }
.section { padding: 60px 20px; }
.section-title { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.section-sub { color: var(--text-muted); margin-bottom: 32px; }

/* ─── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: var(--transition);
}
.card:hover { border-color: rgba(108,99,255,.4); box-shadow: var(--shadow); }
.card-header { font-size: 18px; font-weight: 700; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }

/* ─── Product Grid ───────────────────────────────────────── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}
.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  position: relative;
}
.product-card:hover { border-color: var(--primary); box-shadow: var(--shadow-lg); transform: translateY(-4px); }
.product-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.product-badge.sale { background: var(--danger); }
.product-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
}
.product-body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.product-cat { font-size: 12px; color: var(--primary-light); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.product-name { font-size: 16px; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.product-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; flex: 1; line-height: 1.5; }
.product-price { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.product-price .price { font-size: 22px; font-weight: 800; color: var(--primary-light); }
.product-price .price-orig { font-size: 14px; color: var(--text-muted); text-decoration: line-through; margin-left: 2px; }
.product-price .discount { background: rgba(231,76,60,.15); color: var(--danger); font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.product-price .discount-pill { background: linear-gradient(135deg,#f44336,#e53935); color: #fff; font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 20px; letter-spacing:.5px; }
.product-name-link { text-decoration: none; color: inherit; }
.product-name-link:hover .product-name { color: var(--primary-light); }
.product-footer { display: flex; gap: 8px; }
.product-footer .btn { flex: 1; font-size: 13px; padding: 9px 12px; }
.stock-badge { font-size: 12px; color: var(--success); display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.stock-badge.low { color: var(--warning); }
.stock-badge.out { color: var(--danger); }

/* ─── Category Filter ────────────────────────────────────── */
.category-filter { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 32px; }
.category-btn {
  padding: 8px 18px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.category-btn:hover, .category-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ─── Forms ──────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-light); margin-bottom: 6px; }
.form-label.required::after { content: ' *'; color: var(--danger); }
.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: var(--transition);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108,99,255,.15); }
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { appearance: none; cursor: pointer; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 16px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.form-check input[type=checkbox], .form-check input[type=radio] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.input-group { display: flex; }
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; white-space: nowrap; }
.input-addon {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-right: none;
  padding: 10px 14px;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  display: flex;
  align-items: center;
  white-space: nowrap;
}
.input-group .input-addon + .form-control { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.password-toggle { position: relative; }
.password-toggle .form-control { padding-right: 44px; }
.password-toggle .toggle-btn { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; }

/* ─── Auth Pages ─────────────────────────────────────────── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 20px; background: radial-gradient(circle at 30% 50%, rgba(108,99,255,.08), transparent 60%), radial-gradient(circle at 70% 50%, rgba(245,166,35,.06), transparent 60%), var(--bg); }
.auth-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: 18px; padding: 40px; width: 100%; max-width: 440px; box-shadow: var(--shadow-lg); }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo .logo-text { font-size: 28px; font-weight: 800; background: linear-gradient(135deg, var(--primary), var(--secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.auth-title { font-size: 24px; font-weight: 700; text-align: center; margin-bottom: 6px; }
.auth-sub { text-align: center; color: var(--text-muted); font-size: 14px; margin-bottom: 28px; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--text-muted); font-size: 13px; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; border-top: 1px solid var(--border); }

/* ─── Alerts ─────────────────────────────────────────────── */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid transparent;
}
.alert-success { background: rgba(46,204,113,.12); border-color: rgba(46,204,113,.3); color: #2ecc71; }
.alert-danger  { background: rgba(231,76,60,.12);  border-color: rgba(231,76,60,.3);  color: #e74c3c; }
.alert-warning { background: rgba(243,156,18,.12); border-color: rgba(243,156,18,.3); color: #f39c12; }
.alert-info    { background: rgba(52,152,219,.12); border-color: rgba(52,152,219,.3); color: #3498db; }
.alert-close { margin-left: auto; cursor: pointer; opacity: .7; font-size: 18px; line-height: 1; }
.alert-close:hover { opacity: 1; }

/* ─── Tables ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead { background: var(--bg-card2); }
thead th { padding: 12px 16px; text-align: left; font-weight: 600; color: var(--text-light); font-size: 13px; text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody tr { border-bottom: 1px solid rgba(42,42,74,.5); transition: var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(108,99,255,.05); }
tbody td { padding: 14px 16px; vertical-align: middle; }

/* ─── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-success  { background: rgba(46,204,113,.15);  color: var(--success); }
.badge-danger   { background: rgba(231,76,60,.15);   color: var(--danger); }
.badge-warning  { background: rgba(243,156,18,.15);  color: var(--warning); }
.badge-info     { background: rgba(52,152,219,.15);  color: var(--info); }
.badge-primary  { background: rgba(108,99,255,.15);  color: var(--primary-light); }
.badge-muted    { background: rgba(136,136,136,.15); color: var(--text-muted); }

/* ─── Stats Cards ────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 20px; margin-bottom: 32px; }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}
.stat-card:hover { border-color: rgba(108,99,255,.4); box-shadow: var(--shadow); }
.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.stat-icon.purple { background: rgba(108,99,255,.15); }
.stat-icon.green  { background: rgba(46,204,113,.15); }
.stat-icon.orange { background: rgba(245,166,35,.15); }
.stat-icon.red    { background: rgba(231,76,60,.15); }
.stat-info .stat-value { font-size: 28px; font-weight: 800; line-height: 1; }
.stat-info .stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ─── Dashboard Sidebar ──────────────────────────────────── */
.dashboard-layout { display: grid; grid-template-columns: 240px 1fr; gap: 24px; max-width: 1280px; margin: 0 auto; padding: 32px 20px; }
.sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  height: fit-content;
  position: sticky;
  top: calc(var(--navbar-h) + 16px);
}
.sidebar-user { text-align: center; padding: 16px 0 20px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.sidebar-avatar { width: 64px; height: 64px; background: linear-gradient(135deg, var(--primary), var(--secondary)); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; color: #fff; margin: 0 auto 10px; }
.sidebar-name { font-size: 15px; font-weight: 700; }
.sidebar-balance { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.sidebar-balance span { color: var(--success); font-weight: 600; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
}
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(108,99,255,.15); color: var(--primary-light); }
.sidebar-nav a .badge { margin-left: auto; }

/* ─── Admin Layout ───────────────────────────────────────── */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 250px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 0;
  flex-shrink: 0;
  overflow-y: auto;
  position: sticky;
  top: 0;
  height: 100vh;
}
.admin-sidebar-header { padding: 20px 16px; border-bottom: 1px solid var(--border); }
.admin-logo { font-size: 20px; font-weight: 800; background: linear-gradient(135deg, var(--primary), var(--secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.admin-logo-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.admin-nav { padding: 12px; }
.admin-nav-section { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .8px; padding: 12px 8px 6px; margin-top: 8px; }
.admin-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
}
.admin-nav a:hover, .admin-nav a.active { background: rgba(108,99,255,.15); color: var(--primary-light); }
.admin-nav a .nav-icon { width: 18px; text-align: center; }
.admin-content { flex: 1; padding: 28px; overflow-x: auto; }
.admin-content-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.admin-content-header h1 { font-size: 24px; font-weight: 700; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.breadcrumb a { color: var(--primary-light); }

/* ─── Cart / Checkout ────────────────────────────────────── */
.cart-table-wrap td:last-child { text-align: right; white-space: nowrap; }
.cart-qty { display: flex; align-items: center; gap: 8px; }
.cart-qty button { width: 28px; height: 28px; background: var(--bg-card2); border: 1px solid var(--border); color: var(--text); border-radius: 6px; cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; transition: var(--transition); }
.cart-qty button:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.cart-qty span { min-width: 30px; text-align: center; font-weight: 700; }
.order-summary { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.order-summary-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid rgba(42,42,74,.5); font-size: 14px; }
.order-summary-row:last-child { border-bottom: none; font-size: 18px; font-weight: 700; }

/* ─── Payment Upload ─────────────────────────────────────── */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-input);
}
.upload-area:hover, .upload-area.drag-over { border-color: var(--primary); background: rgba(108,99,255,.05); }
.upload-area .upload-icon { font-size: 40px; margin-bottom: 12px; }
.upload-area p { color: var(--text-muted); font-size: 14px; }
.upload-area p strong { color: var(--primary-light); }

/* ─── 2FA ────────────────────────────────────────────────── */
.twofa-box { text-align: center; }
.twofa-qr { display: inline-block; background: #fff; padding: 12px; border-radius: var(--radius); margin: 20px auto; }
.twofa-qr img { display: block; }
.secret-key-box { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px; font-family: monospace; font-size: 16px; letter-spacing: 3px; word-break: break-all; text-align: center; color: var(--secondary); margin: 12px 0; }
.otp-inputs { display: flex; gap: 10px; justify-content: center; margin: 20px 0; }
.otp-inputs input {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: var(--transition);
}
.otp-inputs input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108,99,255,.2); }

/* ─── Inbox ──────────────────────────────────────────────── */
.inbox-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid rgba(42,42,74,.5);
  cursor: pointer;
  transition: var(--transition);
}
.inbox-item:hover { background: rgba(108,99,255,.05); }
.inbox-item.unread { border-left: 3px solid var(--primary); }
.inbox-item.unread .inbox-subject { color: #fff; font-weight: 600; }
.inbox-icon { width: 40px; height: 40px; background: rgba(108,99,255,.15); border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 18px; }
.inbox-meta { flex: 1; min-width: 0; }
.inbox-subject { font-size: 15px; color: var(--text-light); margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-preview { font-size: 13px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-time { font-size: 12px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }

/* ─── Delivery Box ───────────────────────────────────────── */
.delivery-box {
  background: linear-gradient(135deg, rgba(46,204,113,.1), rgba(108,99,255,.1));
  border: 1px solid rgba(46,204,113,.3);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
}
.delivery-box h4 { color: var(--success); margin-bottom: 8px; font-size: 15px; }
.delivery-data { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; font-family: monospace; font-size: 14px; white-space: pre-wrap; word-break: break-all; color: var(--text); }

/* ─── Pagination ─────────────────────────────────────────── */
.pagination { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 24px; }
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.page-btn:hover, .page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn.disabled { opacity: .4; pointer-events: none; }

/* ─── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(.95);
  transition: var(--transition);
  box-shadow: var(--shadow-lg);
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 20px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 22px; line-height: 1; transition: var(--transition); }
.modal-close:hover { color: var(--danger); }

/* ─── Toast ──────────────────────────────────────────────── */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column-reverse; gap: 10px; }
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  min-width: 280px;
  max-width: 380px;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: slideInRight .3s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
@keyframes slideInRight { from{transform:translateX(100%);opacity:0} to{transform:translateX(0);opacity:1} }
@keyframes fadeOut { to{opacity:0;transform:translateX(100%)} }

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

/* ─── Tabs ───────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab-btn {
  padding: 10px 18px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: var(--transition);
}
.tab-btn.active, .tab-btn:hover { color: var(--primary-light); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ─── Footer ─────────────────────────────────────────────── */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 48px 20px 24px;
  margin-top: auto;
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 32px; max-width: 1280px; margin: 0 auto; }
.footer-brand .brand-name { font-size: 22px; font-weight: 800; background: linear-gradient(135deg, var(--primary), var(--secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.footer-brand p { color: var(--text-muted); font-size: 13px; margin-top: 8px; line-height: 1.7; }
.footer-heading { font-size: 14px; font-weight: 700; color: var(--text-light); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 14px; }
.footer-links { display: flex; flex-direction: column; gap: 8px; }
.footer-links a { color: var(--text-muted); font-size: 13px; transition: var(--transition); }
.footer-links a:hover { color: var(--primary-light); }
.social-links { display: flex; gap: 10px; margin-top: 12px; }
.social-link {
  width: 36px;
  height: 36px;
  background: rgba(108,99,255,.1);
  border: 1px solid rgba(108,99,255,.2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-light);
  font-size: 16px;
  transition: var(--transition);
}
.social-link:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.footer-bottom { max-width: 1280px; margin: 32px auto 0; padding-top: 20px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--text-muted); }

/* ─── Utilities ──────────────────────────────────────────── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary-light); }
.fw-700 { font-weight: 700; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.w-100 { width: 100%; }
.hidden { display: none !important; }
.copy-btn { cursor: pointer; color: var(--primary-light); transition: var(--transition); }
.copy-btn:hover { color: var(--primary); }

/* ─── RTL Support ────────────────────────────────────────── */
[dir="rtl"] .nav-links { margin-left: 0; margin-right: auto; }
[dir="rtl"] .dropdown-menu { right: auto; left: 0; }
[dir="rtl"] .admin-sidebar { border-right: none; border-left: 1px solid var(--border); }
[dir="rtl"] .sidebar-nav a .badge { margin-left: 0; margin-right: auto; }
[dir="rtl"] .alert-close { margin-left: 0; margin-right: auto; }

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .dashboard-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; height: auto; position: static; }
  .admin-nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .admin-nav-section { display: none; }
  .admin-nav a { padding: 8px 12px; }
  /* Hide username label on medium screens to save space */
  .nav-username { display: none; }
}
@media (max-width: 768px) {
  /* Hide desktop search & nav-links by default */
  .nav-search { display: none; }
  .nav-links { display: none; }
  /* Show mobile bar and hamburger */
  .nav-mobile-bar { display: flex; }
  .hamburger { display: flex; }

  /* Open state: slide-down menu */
  .navbar.menu-open .nav-links {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--navbar-h);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px 16px;
    gap: 4px;
    z-index: 1050;
    max-height: calc(100dvh - var(--navbar-h));
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,.35);
  }
  /* Mobile search visible inside open menu */
  .navbar.menu-open .nav-mobile-search {
    display: flex;
    padding: 4px 0 8px;
    width: 100%;
  }
  .navbar.menu-open .nav-mobile-search .nav-search { max-width: 100%; }
  /* Full-width links in mobile menu */
  .navbar.menu-open .nav-link {
    width: 100%;
    padding: 13px 14px;
    font-size: 15px;
    border-radius: var(--radius-sm);
  }
  /* Currency & balance pill full-width in mobile */
  .navbar.menu-open .nav-currency { width: 100%; padding: 10px 14px; font-size: 14px; }
  .navbar.menu-open .nav-balance-pill { width: 100%; text-align: center; justify-content: center; padding: 11px 14px; font-size: 14px; }
  /* Dropdown stays inside menu on mobile */
  .navbar.menu-open .dropdown { width: 100%; }
  .navbar.menu-open .dropdown-menu {
    position: static;
    box-shadow: none;
    border: 1px solid var(--border);
    margin-top: 6px;
    border-radius: var(--radius);
    animation: none;
    display: none;
    width: 100%;
  }
  .navbar.menu-open .dropdown.open .dropdown-menu { display: block; }
  .navbar.menu-open .nav-user-btn { width: 100%; }
  /* Hide theme toggle & cart inside expanded nav (they're in mobile bar) */
  .navbar.menu-open .theme-toggle:not(.theme-toggle-sm) { display: none; }
  .navbar.menu-open .nav-cart:not(.nav-mobile-bar .nav-cart) { display: none; }
  /* Guest lang dropdown full width on mobile */
  .navbar.menu-open .dropdown-lang-guest { width: 100%; }
  .navbar.menu-open .dropdown-lang-guest .nav-lang-btn { width: 100%; }
  .navbar.menu-open .dropdown-lang-guest .dropdown-menu { width: 100%; min-width: unset; }

  .hero { padding: 60px 20px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .otp-inputs input { width: 40px; height: 48px; font-size: 18px; }
  .auth-box { padding: 28px 20px; }
  #toast-container { bottom: 16px; right: 16px; left: 16px; }
  .toast { min-width: auto; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .product-grid { grid-template-columns: 1fr; }
  .hero-btns { flex-direction: column; align-items: center; }
  .nav-brand { font-size: 18px; }
}
