:root {
  --navy: #0f2c59;
  --navy-light: #1a3a6e;
  --gold: #c9a227;
  --gold-light: #e8c547;
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --success: #059669;
  --danger: #dc2626;
  --shadow: 0 10px 40px -10px rgba(15, 44, 89, 0.12);
  --radius: 16px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Vazirmatn', system-ui, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.7; min-height: 100vh;
}
header {
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  color: white; padding: 0.8rem 0; position: sticky; top: 0; z-index: 100;
  box-shadow: 0 4px 20px rgba(15,44,89,0.25);
}
.header-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.logo { display: flex; align-items: center; gap: 0.85rem; }
.logo-icon {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.3rem; color: var(--navy);
}
.logo-text h1 { font-size: 1.15rem; font-weight: 600; }
.logo-text p { font-size: 0.75rem; opacity: 0.8; }
.header-meta { display: flex; gap: 1.5rem; font-size: 0.85rem; opacity: 0.9; }

.hero {
  background: linear-gradient(160deg, #0f2c59 0%, #1e4a8c 100%);
  color: white; padding: 3rem 1.5rem 4rem; position: relative; overflow: hidden;
}
.hero-inner {
  max-width: 1200px; margin: 0 auto;
  display: grid; grid-template-columns: 1.25fr 0.75fr; gap: 2.5rem; align-items: center;
}
.hero h2 { font-size: 2rem; font-weight: 700; margin-bottom: 0.9rem; }
.hero p { opacity: 0.9; margin-bottom: 1.5rem; max-width: 520px; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 0.7rem; }
.badge {
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.18);
  padding: 0.4rem 0.85rem; border-radius: 999px; font-size: 0.8rem;
}
.hero-card {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius); padding: 1.5rem; backdrop-filter: blur(12px);
}
.status-list { display: flex; flex-direction: column; gap: 0.65rem; }
.status-item {
  display: flex; justify-content: space-between; background: rgba(0,0,0,0.18);
  border-radius: 10px; padding: 0.6rem 0.9rem; font-size: 0.85rem;
}
.status-item .value { font-weight: 600; color: var(--gold-light); }
.status-item.active .value { color: #6ee7b7; }
.status-item.expired .value { color: #fca5a5; }

main { max-width: 1200px; margin: -2rem auto 0; padding: 0 1.5rem 4rem; position: relative; z-index: 2; }
.section {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.6rem; margin-bottom: 1.3rem;
}
.section-title { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 1.2rem; }
.section-title .icon {
  width: 40px; height: 40px; background: linear-gradient(135deg, var(--navy), var(--navy-light));
  color: white; border-radius: 10px; display: flex; align-items: center; justify-content: center;
}
.section-title h3 { font-size: 1.1rem; font-weight: 600; }
.section-title span { font-size: 0.8rem; color: var(--muted); display: block; }

.user-simple { display: block; max-width: 480px; }
.login-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.login-tabs .btn { flex: 0 0 auto; }
.login-panel { display: flex; flex-direction: column; gap: 0.85rem; }
.login-row { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: flex-end; }
.login-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.form-group { flex: 1; min-width: 200px; }
.form-group label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.3rem; }
.form-group input {
  width: 100%; padding: 0.75rem 1rem; border: 1.5px solid var(--border);
  border-radius: 11px; font-family: inherit; font-size: 0.95rem;
}
.form-group input:focus { outline: none; border-color: var(--navy); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.75rem 1.3rem; border: none; border-radius: 11px;
  font-family: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: 0.2s;
}
.btn-primary { background: linear-gradient(135deg, var(--navy), var(--navy-light)); color: white; }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold-light)); color: var(--navy); }
.btn-outline { background: white; border: 1.5px solid var(--border); color: var(--muted); font-size: 0.82rem; padding: 0.5rem 0.9rem; }
.btn-outline:hover { border-color: var(--danger); color: var(--danger); }

.user-chip {
  margin-top: 1rem; padding: 0.85rem 1.1rem; background: linear-gradient(135deg, #f0f7ff, #e0f2fe);
  border: 1px solid #bae6fd; border-radius: 12px; display: none; align-items: center; gap: 0.9rem;
}
.user-chip.show { display: flex; }
.user-avatar {
  width: 46px; height: 46px; background: linear-gradient(135deg, #dbeafe, #93c5fd);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--navy);
}

.packs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1.2rem; }
.pack-card {
  border: 1.5px solid var(--border); border-radius: 14px; overflow: hidden;
  background: white; display: flex; flex-direction: column; transition: 0.25s;
}
.pack-card:hover { transform: translateY(-3px); box-shadow: 0 16px 40px -12px rgba(15,44,89,0.15); }
.pack-card.selected { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(15,44,89,0.12); }
.pack-card.disabled { opacity: 0.7; }
.pack-img {
  height: 120px; background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
  display: flex; align-items: center; justify-content: center; font-size: 3rem; position: relative;
}
.pack-img .tag {
  position: absolute; top: 10px; right: 10px; font-size: 0.68rem; font-weight: 600;
  padding: 0.2rem 0.5rem; border-radius: 6px;
}
.tag.fixed { background: #fef3c7; color: #92400e; }
.tag.custom { background: #d1fae5; color: #065f46; }
.tag.expired { background: #fee2e2; color: #991b1b; }
.tag.upcoming { background: #e0e7ff; color: #3730a3; }
.in-cart-badge {
  position: absolute; bottom: 10px; left: 10px; background: var(--navy); color: white;
  font-size: 0.7rem; font-weight: 600; padding: 0.2rem 0.55rem; border-radius: 6px;
}
.pack-body { padding: 1.1rem; flex: 1; display: flex; flex-direction: column; }
.pack-body h4 { font-size: 1rem; font-weight: 600; margin-bottom: 0.3rem; }
.pack-period { font-size: 0.76rem; margin-bottom: 0.7rem; }
.pack-period.active { color: var(--success); }
.pack-period.expired { color: var(--danger); }
.pack-period.upcoming { color: #4f46e5; }
.fixed-items { list-style: none; margin-bottom: 0.8rem; flex: 1; }
.fixed-items li { font-size: 0.82rem; padding: 0.2rem 0; }
.custom-items { display: flex; flex-direction: column; gap: 0.65rem; margin-bottom: 0.8rem; flex: 1; }
.custom-item { background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 0.65rem 0.75rem; }
.custom-item-header { display: flex; justify-content: space-between; margin-bottom: 0.3rem; }
.custom-item-name { font-size: 0.84rem; font-weight: 500; }
.custom-item-price { font-size: 0.75rem; color: var(--muted); }
.item-max { font-size: 0.7rem; color: var(--muted); margin-bottom: 0.35rem; }
.custom-item-controls { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.mini-qty { display: flex; align-items: center; gap: 0.3rem; }
.mini-qty button {
  width: 26px; height: 26px; border: 1px solid var(--border); background: white;
  border-radius: 6px; cursor: pointer; font-size: 0.95rem;
}
.mini-qty button:hover:not(:disabled) { background: var(--navy); color: white; }
.mini-qty button:disabled { opacity: 0.4; }
.mini-qty span { width: 24px; text-align: center; font-weight: 600; font-size: 0.88rem; }
.color-select {
  flex: 1; min-width: 100px; padding: 0.3rem 0.45rem; border: 1px solid var(--border);
  border-radius: 6px; font-family: inherit; font-size: 0.78rem;
}
.pack-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 0.65rem; border-top: 1px solid var(--border);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.25rem 2rem;
  max-width: 1100px;
  margin: 0 auto;
}
.footer-text { flex: 1 1 220px; }
.footer-enamad {
  flex: 0 0 auto;
  line-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.footer-enamad img,
.footer-enamad iframe {
  max-width: 125px;
  height: auto;
  border: 0;
  vertical-align: middle;
}

.pack-price { font-size: 1.05rem; font-weight: 700; color: var(--navy); }
.pack-price small { font-size: 0.7rem; font-weight: 400; color: var(--muted); }
.add-pack-btn { padding: 0.4rem 0.85rem; font-size: 0.8rem; border-radius: 8px; }

.layout { display: grid; grid-template-columns: 1fr 330px; gap: 1.3rem; align-items: start; }
.summary {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.4rem; position: sticky; top: 85px;
}
.summary h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: 0.9rem; }
.cart-list { max-height: 280px; overflow-y: auto; margin-bottom: 0.7rem; }
.cart-empty { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 1rem 0; }
.cart-item { padding: 0.55rem 0; border-bottom: 1px solid var(--border); font-size: 0.82rem; }
.cart-item-name { font-weight: 500; }
.cart-item-detail { color: var(--muted); font-size: 0.74rem; }
.summary-row { display: flex; justify-content: space-between; padding: 0.35rem 0; font-size: 0.88rem; }
.summary-row.total {
  border-top: 2px solid var(--border); margin-top: 0.4rem; padding-top: 0.7rem;
  font-weight: 700; font-size: 1.05rem; color: var(--navy);
}
.cart-actions { margin-bottom: 0.7rem; }
.delivery-title { font-size: 0.85rem; font-weight: 600; margin: 1rem 0 0.55rem; }
.delivery-cards { display: flex; flex-direction: column; gap: 0.5rem; }
.delivery-card {
  border: 1.5px solid var(--border); border-radius: 11px; padding: 0.7rem 0.85rem;
  cursor: pointer; display: flex; gap: 0.6rem; align-items: flex-start;
}
.delivery-card.selected { border-color: var(--navy); background: #f0f5ff; }
.delivery-card input { display: none; }
.delivery-check {
  width: 18px; height: 18px; border: 2px solid #cbd5e1; border-radius: 50%;
  flex-shrink: 0; margin-top: 0.15rem;
}
.delivery-card.selected .delivery-check { border-color: var(--navy); background: var(--navy); }
.delivery-card.selected .delivery-check::after { content: "✓"; color: white; font-size: 0.65rem; display: flex; justify-content: center; }
.delivery-info strong { display: block; font-size: 0.84rem; }
.delivery-info span { font-size: 0.74rem; color: var(--muted); }
.pay-hint { font-size: 0.72rem; color: var(--muted); text-align: center; margin-top: 0.6rem; }

footer {
  background: var(--navy); color: rgba(255,255,255,0.7); text-align: center;
  padding: 1.6rem; font-size: 0.82rem;
}

.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,44,89,0.5); backdrop-filter: blur(5px);
  display: none; align-items: center; justify-content: center; z-index: 200; padding: 1rem;
}
.modal-overlay.show { display: flex; }
.modal {
  background: white; border-radius: 18px; max-width: 420px; width: 100%;
  padding: 1.8rem; text-align: center;
}
.modal .icon-ok {
  width: 64px; height: 64px; background: linear-gradient(135deg, #10b981, #059669);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem; font-size: 1.7rem; color: white;
}
.modal .code {
  background: #f1f5f9; padding: 0.7rem; border-radius: 10px;
  font-family: monospace; font-size: 1.05rem; font-weight: 600; letter-spacing: 1px;
  color: var(--navy); margin: 1rem 0; direction: ltr;
}
.modal-summary {
  background: #f8fafc; border: 1px solid var(--border); border-radius: 10px;
  padding: 0.75rem 1rem; font-size: 0.82rem; text-align: right; margin-bottom: 1.1rem;
}
.modal-summary div { display: flex; justify-content: space-between; padding: 0.15rem 0; }
.modal-actions { display: flex; gap: 0.5rem; }
.modal-actions .btn { flex: 1; }

.toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(120%);
  background: var(--navy); color: white; padding: 0.75rem 1.3rem; border-radius: 11px;
  font-size: 0.88rem; z-index: 300; transition: 0.3s; max-width: calc(100% - 2rem);
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); }

@media (max-width: 960px) {
  .hero-inner { grid-template-columns: 1fr; }
  .layout { grid-template-columns: 1fr; }
  .summary { position: static; }
  .header-meta { display: none; }
}
