:root {
  --primary: #0088cc;
  --primary-dark: #006fa8;
  --primary-light: #e8f4fd;
  --accent: #00c49a;
  --pink: #e91e8c;
  --bg: #f0f6ff;
  --card: #ffffff;
  --text: #1a2332;
  --text-muted: #6b7c93;
  --border: #dce8f5;
  --green: #28c76f;
  --shadow: 0 4px 24px rgba(0,136,204,0.10);
  --shadow-lg: 0 8px 40px rgba(0,136,204,0.18);
}

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

body {
  font-family: 'Vazirmatn', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  direction: rtl;
}

/* ===== HEADER ===== */
header {
  background: var(--card);
  box-shadow: 0 2px 12px rgba(0,136,204,0.08);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 22px;
  color: var(--primary);
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  font-weight: 900;
}

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

.balance-chip {
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hamburger-btn {
  width: 42px;
  height: 42px;
  background: var(--primary);
  border-radius: 10px;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background 0.2s;
}
.hamburger-btn:hover { background: var(--primary-dark); }
.hamburger-btn span {
  width: 20px;
  height: 2px;
  background: white;
  border-radius: 2px;
  display: block;
}

/* ===== DRAWER ===== */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
}
.drawer-overlay.open { display: block; }

.drawer {
  position: fixed;
  top: 0;
  right: -300px;
  width: 280px;
  height: 100vh;
  background: var(--card);
  z-index: 300;
  transition: right 0.3s cubic-bezier(.4,0,.2,1);
  box-shadow: -4px 0 30px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.drawer.open { right: 0; }

.drawer-header {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  padding: 30px 20px 24px;
  color: white;
}

.drawer-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.drawer-avatar {
  width: 52px;
  height: 52px;
  background: rgba(255,255,255,0.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.drawer-user-info h3 { font-size: 16px; font-weight: 700; }
.drawer-user-info p { font-size: 12px; opacity: 0.85; margin-top: 2px; }

.drawer-balance {
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.drawer-balance span:last-child { font-weight: 700; font-size: 15px; }

.drawer-nav { padding: 12px 0; flex: 1; }

.drawer-nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  border: none;
  background: none;
  width: 100%;
  text-align: right;
  font-family: 'Vazirmatn', sans-serif;
}
.drawer-nav-item:hover { background: var(--primary-light); color: var(--primary); }
.drawer-nav-item .nav-icon {
  width: 36px;
  height: 36px;
  background: var(--primary-light);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}
.drawer-nav-item.order-btn { color: var(--primary); }
.drawer-nav-item.charge-btn { color: var(--green); }
.drawer-nav-item.charge-btn .nav-icon { background: #e8f9f0; }
.drawer-divider { height: 1px; background: var(--border); margin: 8px 20px; }

/* ===== PAGES ===== */
.page { display: none; min-height: calc(100vh - 64px); }
.page.active { display: block; }

/* ===== HOME ===== */
.hero-banner {
  background: linear-gradient(135deg, var(--primary) 0%, #005f8e 100%);
  color: white;
  padding: 24px 20px 20px;
  position: relative;
  overflow: hidden;
}
.hero-banner::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 160px; height: 160px;
  background: rgba(255,255,255,0.07);
  border-radius: 50%;
}
.hero-title { font-size: 20px; font-weight: 900; margin-bottom: 4px; }
.hero-sub { font-size: 13px; opacity: 0.85; }

.stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px;
}

.stat-card {
  background: var(--card);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-icon.blue { background: #e8f4fd; }
.stat-icon.green { background: #e8f9f0; }
.stat-icon.orange { background: #fff3e8; }
.stat-icon.pink { background: #fce8f3; }

.stat-info label { font-size: 11px; color: var(--text-muted); display: block; margin-bottom: 2px; }
.stat-info span { font-size: 16px; font-weight: 700; color: var(--text); }

.section-title {
  padding: 4px 16px 12px;
  font-size: 16px;
  font-weight: 700;
}

.quick-actions {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.action-card {
  background: var(--card);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s;
  border: none;
  width: 100%;
  text-align: right;
  font-family: 'Vazirmatn', sans-serif;
}
.action-card:hover { transform: translateX(-3px); }
.action-card-right { display: flex; align-items: center; gap: 12px; }
.action-card-icon {
  width: 42px; height: 42px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.action-card-text h4 { font-size: 14px; font-weight: 600; }
.action-card-text p { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.action-card-arrow { color: var(--text-muted); font-size: 18px; }

/* ===== SERVICES ===== */
.page-header {
  background: linear-gradient(135deg, var(--primary), #005f8e);
  padding: 20px 20px 16px;
  color: white;
  text-align: center;
}
.page-header h2 { font-size: 20px; font-weight: 800; }

.service-selector-box {
  margin: 16px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.custom-select-wrapper { position: relative; margin-bottom: 12px; }

.custom-select {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: 'Vazirmatn', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: #f8fbff;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: border-color 0.2s;
  direction: rtl;
}
.custom-select:focus { outline: none; border-color: var(--primary); }

.btn-get-service {
  width: 100%;
  background: linear-gradient(135deg, var(--green), #1aa85a);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 13px;
  font-family: 'Vazirmatn', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-get-service:hover { opacity: 0.9; }

.service-detail-card {
  margin: 0 16px 16px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: none;
}
.service-detail-card.visible { display: block; }

.service-detail-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  padding: 16px 18px;
  color: white;
  font-size: 16px;
  font-weight: 700;
}

.service-detail-body { padding: 16px 18px; }

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text-muted); font-weight: 500; flex-shrink: 0; margin-left: 12px; }
.detail-value { font-weight: 600; text-align: left; }
.detail-value.active { color: var(--green); }
.detail-value.id { color: var(--primary); font-size: 15px; }

.desc-btn {
  background: var(--pink);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 6px 16px;
  font-family: 'Vazirmatn', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.service-info-box {
  margin: 0 16px 16px;
  background: var(--primary-light);
  border-radius: 14px;
  padding: 14px 16px;
  display: none;
}
.service-info-box.visible { display: block; }

.info-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.7;
}
.info-item:last-child { margin-bottom: 0; }
.info-emoji { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

.btn-purchase {
  margin: 0 16px 16px;
  width: calc(100% - 32px);
  background: var(--pink);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-family: 'Vazirmatn', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.btn-purchase.visible { display: flex; }
.btn-purchase:hover { opacity: 0.9; }

/* ===== MODAL ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 400;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal-sheet {
  background: var(--card);
  width: 100%;
  max-width: 480px;
  border-radius: 20px 20px 0 0;
  padding: 24px 20px 30px;
  animation: slideUp 0.3s ease;
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-handle {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 20px;
}

.modal-title {
  font-size: 17px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 20px;
}

.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: 'Vazirmatn', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: #f8fbff;
  transition: border-color 0.2s;
  direction: ltr;
  text-align: right;
}
.form-input:focus { outline: none; border-color: var(--primary); }

.price-summary {
  background: var(--primary-light);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.price-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 8px;
  color: var(--text-muted);
}
.price-row:last-child {
  margin-bottom: 0;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* ===== PAYMENT ===== */
.payment-card {
  background: var(--card);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 28px 24px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}
.payment-icon { font-size: 52px; margin-bottom: 12px; }
.payment-card h2 { font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.payment-card p { font-size: 13px; color: var(--text-muted); line-height: 1.6; margin-bottom: 20px; }

.payment-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.payment-detail-row:last-of-type { border-bottom: none; }
.payment-detail-row span:first-child { color: var(--text-muted); }
.payment-detail-row span:last-child { font-weight: 600; }

.payment-total {
  background: var(--primary-light);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  margin: 16px 0 20px;
  font-weight: 700;
  font-size: 15px;
  color: var(--primary);
}

.payment-methods { margin-bottom: 20px; }
.payment-methods label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: border-color 0.2s;
}

/* ===== SUCCESS ===== */
.success-card {
  background: var(--card);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 36px 24px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.success-icon { font-size: 64px; margin-bottom: 12px; animation: bounce 0.6s; }
@keyframes bounce {
  0% { transform: scale(0); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
.success-card h2 { font-size: 20px; font-weight: 900; color: var(--green); margin-bottom: 8px; }
.success-card p { font-size: 13px; color: var(--text-muted); line-height: 1.7; margin-bottom: 24px; }

/* ===== CHARGE ===== */
.current-balance-display {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border-radius: 14px;
  padding: 18px;
  text-align: center;
  margin-bottom: 14px;
}
.current-balance-display label { font-size: 12px; opacity: 0.85; display: block; margin-bottom: 4px; }
.current-balance-display span { font-size: 24px; font-weight: 900; }

.charge-card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 14px;
}
.charge-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 16px; }

.amount-chips {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.amount-chip {
  background: var(--primary-light);
  color: var(--primary);
  border: 1.5px solid transparent;
  border-radius: 10px;
  padding: 10px 6px;
  text-align: center;
  font-family: 'Vazirmatn', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.amount-chip:hover, .amount-chip.selected {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

/* ===== BUTTONS ===== */
.btn-pay {
  width: 100%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-family: 'Vazirmatn', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-pay:hover { opacity: 0.9; }

.btn-confirm-pay {
  width: 100%;
  background: linear-gradient(135deg, var(--green), #1aa85a);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-family: 'Vazirmatn', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 10px;
}
.btn-back {
  width: 100%;
  background: #f0f0f0;
  color: var(--text-muted);
  border: none;
  border-radius: 12px;
  padding: 12px;
  font-family: 'Vazirmatn', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 50;
  padding: 8px 0 12px;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  padding: 4px 0;
  color: var(--text-muted);
  border: none;
  background: none;
  font-family: 'Vazirmatn', sans-serif;
  transition: color 0.15s;
}
.nav-item.active { color: var(--primary); }
.nav-item .nav-emoji { font-size: 20px; }
.nav-item span { font-size: 11px; font-weight: 500; }

.page-content { padding-bottom: 80px; }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: white;
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 600;
  z-index: 500;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
