/* ═══════════════════════════════════════════════════════════
   VPNYAR Design System — Professional Edition
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-soft: #94a3b8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-soft: #eff6ff;
  --primary-glow: rgba(29, 78, 216, 0.18);
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --danger: #dc2626;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.1);
  --shadow-primary: 0 8px 24px rgba(29, 78, 216, 0.25);
  --font: 'Vazirmatn', system-ui, -apple-system, sans-serif;
  --header-h: 68px;
}

.dark {
  --bg: #0b1120;
  --surface: #111827;
  --surface-2: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-soft: #64748b;
  --border: #1e293b;
  --border-strong: #334155;
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-soft: #1e3a5f;
  --primary-glow: rgba(59, 130, 246, 0.2);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow: 0 4px 16px rgba(0,0,0,0.3);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.4);
  --shadow-primary: 0 8px 24px rgba(59, 130, 246, 0.3);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-soft); }

/* ─── Utilities ─── */
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.fade-in { animation: fadeIn 0.35s ease-out; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Header ─── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
}
.site-header .inner {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; gap: 16px;
}
.logo {
  font-weight: 800; font-size: 1.35rem; letter-spacing: -0.5px;
  color: var(--primary); text-decoration: none;
  display: flex; align-items: center; gap: 8px;
}
.logo span { color: var(--text); font-weight: 700; }
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-links a {
  padding: 8px 14px; border-radius: 10px; font-size: 0.9rem; font-weight: 500;
  color: var(--text-muted); text-decoration: none; transition: all 0.2s;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--primary); background: var(--primary-soft);
}
.header-actions { display: flex; align-items: center; gap: 8px; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: 12px; font-weight: 600; font-size: 0.9rem;
  border: none; cursor: pointer; transition: all 0.2s ease;
  text-decoration: none; white-space: nowrap; font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--primary); color: #fff;
  box-shadow: var(--shadow-primary);
}
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 10px 28px rgba(29,78,216,0.35); }
.btn-secondary {
  background: var(--surface); color: var(--text);
  border: 1.5px solid var(--border); box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.btn-ghost {
  background: transparent; color: var(--text-muted); padding: 8px 12px;
}
.btn-ghost:hover { color: var(--primary); background: var(--primary-soft); }
.btn-sm { padding: 7px 14px; font-size: 0.82rem; border-radius: 10px; }
.btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: 14px; }
.btn-icon {
  width: 40px; height: 40px; padding: 0; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }

/* ─── Hero ─── */
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--radius-lg);
  margin: 24px 0 40px;
  min-height: 340px;
  display: flex; align-items: center;
  background: linear-gradient(135deg, #0f2b6e 0%, #1d4ed8 45%, #0ea5e9 100%);
  color: #fff;
  box-shadow: var(--shadow-lg);
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(255,255,255,0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(14,165,233,0.25) 0%, transparent 45%),
    linear-gradient(180deg, transparent 60%, rgba(0,0,0,0.15) 100%);
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.6; pointer-events: none;
}
.hero-content {
  position: relative; z-index: 2;
  padding: 48px 40px; max-width: 560px;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.15); backdrop-filter: blur(8px);
  padding: 6px 14px; border-radius: 99px; font-size: 0.8rem; font-weight: 500;
  margin-bottom: 16px; border: 1px solid rgba(255,255,255,0.2);
}
.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800;
  line-height: 1.25; margin: 0 0 12px; letter-spacing: -0.5px;
}
.hero p {
  font-size: 1.05rem; opacity: 0.9; margin: 0 0 28px; line-height: 1.7;
  font-weight: 400;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .btn-primary {
  background: #fff; color: #1d4ed8; box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.hero .btn-primary:hover { background: #f0f9ff; transform: translateY(-1px); }
.hero .btn-secondary {
  background: rgba(255,255,255,0.12); color: #fff;
  border: 1.5px solid rgba(255,255,255,0.3); backdrop-filter: blur(6px);
}
.hero .btn-secondary:hover { background: rgba(255,255,255,0.22); border-color: #fff; }

/* Decorative element on the right side of hero */
.hero-deco {
  position: absolute; left: 5%; top: 50%; transform: translateY(-50%);
  width: 280px; height: 280px; opacity: 0.15;
  background: radial-gradient(circle, #fff 0%, transparent 70%);
  border-radius: 50%; pointer-events: none;
}

/* ─── Section ─── */
.section { margin-bottom: 48px; }
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; gap: 12px;
}
.section-title {
  font-size: 1.25rem; font-weight: 700; margin: 0;
  display: flex; align-items: center; gap: 10px;
}
.section-title::before {
  content: ''; width: 4px; height: 20px;
  background: var(--primary); border-radius: 4px;
}
.section-link {
  font-size: 0.88rem; font-weight: 500; color: var(--primary);
  text-decoration: none;
}
.section-link:hover { text-decoration: underline; }

/* ─── Category Cards ─── */
.cat-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.cat-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 28px 20px;
  text-align: center; cursor: pointer; transition: all 0.25s ease;
  text-decoration: none; color: inherit;
  box-shadow: var(--shadow-sm);
}
.cat-card:hover {
  border-color: var(--primary); transform: translateY(-4px);
  box-shadow: var(--shadow), 0 0 0 1px var(--primary-glow);
}
.cat-card .icon {
  width: 56px; height: 56px; margin: 0 auto 14px;
  background: var(--primary-soft); border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem; transition: transform 0.25s;
}
.cat-card:hover .icon { transform: scale(1.08); }
.cat-card h3 { font-size: 0.95rem; font-weight: 600; margin: 0; }

/* ─── Product Cards ─── */
.prod-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.prod-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: all 0.25s ease; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
}
.prod-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
}
.prod-card-img {
  height: 140px; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.prod-card-img img {
  width: 100%; height: 100%; object-fit: cover;
}
.prod-card-img .emoji {
  font-size: 3.2rem; line-height: 1;
}
.prod-badge {
  position: absolute; top: 12px; right: 12px;
  background: var(--primary); color: #fff;
  font-size: 0.72rem; font-weight: 600;
  padding: 4px 10px; border-radius: 99px;
}
.prod-card-body {
  padding: 18px 18px 16px; flex: 1; display: flex; flex-direction: column;
}
.prod-card-body h3 {
  font-size: 1rem; font-weight: 700; margin: 0 0 6px; line-height: 1.4;
}
.prod-card-body .short {
  font-size: 0.82rem; color: var(--text-muted); margin: 0 0 12px;
  line-height: 1.55; flex: 1;
}
.prod-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-top: auto; padding-top: 12px;
  border-top: 1px solid var(--border);
}
.prod-price {
  font-size: 1.1rem; font-weight: 800; color: var(--primary);
  letter-spacing: -0.3px;
}
.prod-price small {
  font-size: 0.75rem; font-weight: 500; color: var(--text-muted);
  margin-right: 2px;
}
.prod-actions { display: flex; gap: 6px; }

/* ─── Footer ─── */
.site-footer {
  background: var(--surface); border-top: 1px solid var(--border);
  margin-top: 60px; padding: 48px 0 28px;
}
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px; margin-bottom: 36px;
}
.footer-brand .logo { margin-bottom: 12px; }
.footer-brand p {
  font-size: 0.88rem; color: var(--text-muted); line-height: 1.7; margin: 0;
  max-width: 280px;
}
.footer-col h4 {
  font-size: 0.9rem; font-weight: 700; margin: 0 0 14px; color: var(--text);
}
.footer-col a, .footer-col span {
  display: block; font-size: 0.85rem; color: var(--text-muted);
  text-decoration: none; margin-bottom: 8px; transition: color 0.15s;
}
.footer-col a:hover { color: var(--primary); }
.footer-bottom {
  border-top: 1px solid var(--border); padding-top: 20px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.82rem; color: var(--text-soft);
}
@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .hero-content { padding: 36px 24px; }
  .nav-links { display: none; }
}

/* ─── Cards / Panels ─── */
.card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow-sm);
}
.stat-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 22px 24px;
  box-shadow: var(--shadow-sm);
}
.stat-card .label { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 6px; }
.stat-card .value { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.5px; }
.stat-card .value.green { color: var(--success); }

/* ─── Forms ─── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 0.85rem; font-weight: 600;
  margin-bottom: 6px; color: var(--text);
}
.form-control {
  width: 100%; padding: 11px 14px; border-radius: 12px;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text); font-family: inherit; font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
textarea.form-control { resize: vertical; min-height: 90px; }
.form-hint { font-size: 0.78rem; color: var(--text-soft); margin-top: 4px; }

/* ─── Tables ─── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1.5px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th {
  background: var(--surface-2); text-align: right; padding: 12px 16px;
  font-weight: 600; color: var(--text-muted); border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}
td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }

/* ─── Badges / Status ─── */
.badge {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: 99px; font-size: 0.75rem; font-weight: 600;
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: #fffbeb; color: var(--warning); }
.badge-danger { background: #fef2f2; color: var(--danger); }
.badge-info { background: var(--primary-soft); color: var(--primary); }
.badge-muted { background: var(--surface-2); color: var(--text-muted); }

/* ─── Sidebar (Admin / User) ─── */
.dash-layout {
  display: grid; grid-template-columns: 240px 1fr;
  gap: 24px; min-height: calc(100vh - var(--header-h) - 80px);
  padding: 28px 0;
}
.sidebar {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 12px; height: fit-content;
  position: sticky; top: calc(var(--header-h) + 20px);
  box-shadow: var(--shadow-sm);
}
.sidebar-title {
  font-size: 0.78rem; font-weight: 700; color: var(--text-soft);
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 10px 12px 8px; margin: 0;
}
.sidebar a, .sidebar button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 12px; border-radius: 10px;
  font-size: 0.9rem; font-weight: 500; color: var(--text-muted);
  text-decoration: none; border: none; background: none;
  cursor: pointer; font-family: inherit; transition: all 0.15s;
  text-align: right;
}
.sidebar a:hover, .sidebar button:hover {
  background: var(--primary-soft); color: var(--primary);
}
.sidebar a.active {
  background: var(--primary); color: #fff; font-weight: 600;
  box-shadow: var(--shadow-primary);
}
.dash-content { min-width: 0; }

@media (max-width: 900px) {
  .dash-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; }
  .sidebar-title { display: none; }
  .sidebar a, .sidebar button { width: auto; }
}

/* ─── Toast ─── */
#toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast-item {
  pointer-events: auto;
  background: var(--surface); color: var(--text);
  border: 1.5px solid var(--border); border-radius: 14px;
  padding: 12px 20px; font-size: 0.9rem; font-weight: 500;
  box-shadow: var(--shadow-lg); animation: toastIn 0.3s ease;
  display: flex; align-items: center; gap: 10px; min-width: 260px;
}
.toast-item.error { border-color: var(--danger); background: #fef2f2; color: var(--danger); }
.toast-item.success { border-color: var(--success); background: var(--success-soft); color: var(--success); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Auth pages ─── */
.auth-wrap {
  min-height: calc(100vh - var(--header-h) - 100px);
  display: flex; align-items: center; justify-content: center; padding: 40px 20px;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}
.auth-card h1 { font-size: 1.4rem; font-weight: 800; margin: 0 0 6px; }
.auth-card .subtitle { color: var(--text-muted); font-size: 0.9rem; margin: 0 0 28px; }

/* ─── Empty state ─── */
.empty-state {
  text-align: center; padding: 48px 20px; color: var(--text-muted);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.5; }

/* ─── Modal ─── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,0.5);
  backdrop-filter: blur(4px); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 28px; width: 100%; max-width: 520px;
  box-shadow: var(--shadow-lg); max-height: 90vh; overflow-y: auto;
}
.modal h2 { margin: 0 0 20px; font-size: 1.15rem; font-weight: 700; }

/* ─── Misc ─── */
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.text-muted { color: var(--text-muted); }
.text-soft { color: var(--text-soft); }
.fw-bold { font-weight: 700; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .prod-grid { grid-template-columns: 1fr; }
}
