:root {
  --bg-color: #0f172a;
  --bg-color-secondary: rgba(15, 23, 42, 0.6);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #3b82f6;
  --primary-glow: rgba(59, 130, 246, 0.5);
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-panel-bg: rgba(15, 23, 42, 0.85);
  --input-bg: rgba(0, 0, 0, 0.2);
  --toast-bg: rgba(15, 23, 42, 0.95);
  --modal-overlay: rgba(0, 0, 0, 0.7);
  --modal-details-bg: rgba(0, 0, 0, 0.2);
  --hover-glass: rgba(255, 255, 255, 0.05);
  --hover-glass-strong: rgba(255, 255, 255, 0.08);
  --card-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
  --color-blue: #3b82f6;
  --color-purple: #a855f7;
  --color-yellow: #eab308;
  --color-pink: #ec4899;
  --color-green: #22c55e;
  --color-teal: #14b8a6;
  --gradient-bg-1: rgba(59, 130, 246, 0.15);
  --gradient-bg-2: rgba(168, 85, 247, 0.15);
  --logo-gradient-start: #fff;
  --logo-gradient-end: #94a3b8;
}

[data-theme="light"] {
  --bg-color: #f0f2f5;
  --bg-color-secondary: rgba(255, 255, 255, 0.7);
  --text-main: #1e293b;
  --text-muted: #64748b;
  --primary: #2563eb;
  --primary-glow: rgba(37, 99, 235, 0.35);
  --glass-bg: rgba(255, 255, 255, 0.6);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-panel-bg: rgba(255, 255, 255, 0.9);
  --input-bg: rgba(0, 0, 0, 0.04);
  --toast-bg: rgba(255, 255, 255, 0.95);
  --modal-overlay: rgba(0, 0, 0, 0.4);
  --modal-details-bg: rgba(0, 0, 0, 0.04);
  --hover-glass: rgba(0, 0, 0, 0.03);
  --hover-glass-strong: rgba(0, 0, 0, 0.06);
  --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  --color-blue: #2563eb;
  --color-purple: #9333ea;
  --color-yellow: #ca8a04;
  --color-pink: #db2777;
  --color-green: #16a34a;
  --color-teal: #0d9488;
  --gradient-bg-1: rgba(59, 130, 246, 0.08);
  --gradient-bg-2: rgba(168, 85, 247, 0.08);
  --logo-gradient-start: #1e293b;
  --logo-gradient-end: #475569;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Outfit", sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  background-image:
    radial-gradient(
      circle at 15% 50%,
      var(--gradient-bg-1),
      transparent 25%
    ),
    radial-gradient(
      circle at 85% 30%,
      var(--gradient-bg-2),
      transparent 25%
    );
  background-attachment: fixed;
}

.app-container {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  position: relative;
  background: var(--bg-color-secondary);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--card-shadow);
  border-left: 1px solid var(--glass-border);
  border-right: 1px solid var(--glass-border);
}

.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.glass-panel {
  background: var(--glass-panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--glass-border);
}

/* Login Page */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: 100%;
  padding: 40px 24px;
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.logo-container {
  text-align: center;
  margin-bottom: 40px;
}

.logo-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 16px;
  box-shadow: 0 12px 24px var(--primary-glow);
  transform: rotate(-10deg);
}

.logo-container h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--logo-gradient-start), var(--logo-gradient-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-container p {
  color: var(--text-muted);
  font-size: 15px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group i {
  position: absolute;
  left: 20px;
  color: var(--text-muted);
  font-size: 18px;
  transition: color 0.3s;
}

.input-group input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 16px 20px 16px 52px;
  color: var(--text-main);
  font-size: 15px;
  outline: none;
  transition: all 0.3s;
}

.input-group input:focus {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.05);
}

.input-group input:focus + i {
  color: var(--primary);
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: white;
  border: none;
  border-radius: 16px;
  padding: 18px;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  margin-top: 10px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(59, 130, 246, 0.4);
}

.login-footer {
  margin-top: 32px;
  text-align: center;
  font-size: 14px;
}

.login-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.login-footer .forgot-link {
  display: block;
  margin-bottom: 24px;
  color: var(--text-muted);
}

/* Dashboard */
.dashboard-wrapper {
  padding-bottom: 90px;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--glass-border);
}

.greeting {
  font-size: 13px;
  color: var(--text-muted);
}

.user-info h2 {
  font-size: 18px;
  font-weight: 600;
}

.btn-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background 0.2s;
}

.balance-section {
  padding: 0 24px;
  margin-top: 10px;
}

.premium-gradient {
  background: linear-gradient(135deg, #1e3a8a, #3b82f6, #8b5cf6);
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 16px 32px rgba(59, 130, 246, 0.25);
  position: relative;
  overflow: hidden;
}

.premium-gradient::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  filter: blur(40px);
}

.balance-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  opacity: 0.9;
  margin-bottom: 12px;
}

.balance-amount {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 24px;
  letter-spacing: -1px;
}

.balance-actions {
  display: flex;
  gap: 12px;
}

.btn-glass {
  flex: 1;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 12px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 0.2s;
}

.btn-glass:hover {
  background: rgba(255, 255, 255, 0.25);
}

.services-section {
  padding: 32px 24px;
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.service-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px 10px;
  border: 1px solid var(--glass-border);
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  transition:
    transform 0.2s,
    background 0.2s;
  border-radius: 20px;
}

.service-card:hover {
  transform: translateY(-4px);
  background: var(--glass-bg);
}

.service-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 4px;
}

.color-blue {
  background: rgba(59, 130, 246, 0.15);
  color: var(--color-blue);
}
.color-purple {
  background: rgba(168, 85, 247, 0.15);
  color: var(--color-purple);
}
.color-yellow {
  background: rgba(234, 179, 8, 0.15);
  color: var(--color-yellow);
}
.color-pink {
  background: rgba(236, 72, 153, 0.15);
  color: var(--color-pink);
}
.color-green {
  background: rgba(34, 197, 94, 0.15);
  color: var(--color-green);
}
.color-teal {
  background: rgba(20, 184, 166, 0.15);
  color: var(--color-teal);
}

.service-card span {
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  line-height: 1.2;
}

/* Bottom Nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  width: 100%;
  max-width: 480px;
  display: flex;
  justify-content: space-around;
  padding: 16px 8px 24px;
  border-top: 1px solid var(--glass-border);
  border-bottom: none;
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  transition: color 0.3s;
}

.nav-item i {
  font-size: 20px;
  margin-bottom: 2px;
}

.nav-item.active {
  color: var(--primary);
}

/* Toasts */
.toast-container {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 90%;
  max-width: 400px;
}

.toast {
  background: var(--toast-bg);
  border: 1px solid var(--glass-border);
  padding: 16px 20px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 500;
  animation: slideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.toast-success i {
  color: var(--color-green);
}
.toast-error i {
  color: #ef4444;
}

/* Animations */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes slideOut {
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

/* ===== Page Layout (shared for inner pages) ===== */
.page-wrapper {
  padding-bottom: 90px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.page-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.btn-back {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 18px;
  transition:
    background 0.2s,
    transform 0.2s;
}

.btn-back:hover {
  background: var(--hover-glass-strong);
  transform: scale(1.05);
}

/* ===== Top Up Balance Card ===== */
.topup-balance-section {
  padding: 0 24px;
  margin-top: 10px;
}

.topup-balance-card {
  background: linear-gradient(135deg, #065f46, #10b981, #34d399);
  border-radius: 20px;
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 12px 28px rgba(16, 185, 129, 0.25);
  position: relative;
  overflow: hidden;
}

.topup-balance-card::before {
  content: "";
  position: absolute;
  top: -40%;
  right: -15%;
  width: 160px;
  height: 160px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  filter: blur(30px);
}

.topup-label {
  font-size: 13px;
  opacity: 0.85;
  margin-bottom: 6px;
  display: block;
}

.topup-amount {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.topup-balance-icon {
  width: 56px;
  height: 56px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  backdrop-filter: blur(4px);
}

/* ===== Payment Method Section ===== */
.topup-method-section {
  padding: 28px 24px 0;
}

.method-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.method-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}

.method-card:hover {
  background: var(--hover-glass);
  transform: translateX(4px);
}

.method-card.selected {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.08);
  box-shadow:
    0 0 0 1px var(--primary),
    0 4px 16px rgba(59, 130, 246, 0.15);
}

.method-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.method-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.method-name {
  font-size: 15px;
  font-weight: 600;
}

.method-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.method-check {
  font-size: 20px;
  color: var(--primary);
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.25s ease;
}

.method-card.selected .method-check {
  opacity: 1;
  transform: scale(1);
}

/* ===== Nominal Grid ===== */
.topup-nominal-section {
  padding: 28px 24px 0;
}

.nominal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.nominal-card {
  padding: 20px 16px;
  border-radius: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.nominal-card:hover {
  background: var(--hover-glass);
  transform: translateY(-2px);
}

.nominal-card.selected {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.08);
  box-shadow:
    0 0 0 1px var(--primary),
    0 4px 16px rgba(59, 130, 246, 0.15);
}

.nominal-value {
  font-size: 16px;
  font-weight: 600;
  display: block;
}

.nominal-bonus {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 600;
  color: #34d399;
  background: rgba(52, 211, 153, 0.12);
  padding: 4px 10px;
  border-radius: 20px;
}

/* ===== Custom Amount Input ===== */
.topup-custom-section {
  padding: 28px 24px 0;
}

.custom-input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.currency-prefix {
  position: absolute;
  left: 20px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-muted);
}

.custom-input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 18px 20px 18px 52px;
  color: var(--text-main);
  font-size: 16px;
  font-weight: 500;
  outline: none;
  transition: all 0.3s;
  font-family: "Outfit", sans-serif;
}

.custom-input:focus {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.05);
}

.custom-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

/* ===== Summary Section ===== */
.topup-summary-section {
  padding: 28px 24px;
}

.summary-card {
  padding: 20px;
  border-radius: 16px;
  margin-bottom: 16px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 14px;
  color: var(--text-muted);
}

.summary-row.total {
  color: var(--text-main);
  font-weight: 600;
  font-size: 16px;
}

.summary-value {
  font-weight: 500;
  color: var(--text-main);
}

.summary-divider {
  height: 1px;
  background: var(--glass-border);
  margin: 8px 0;
}

.btn-topup-confirm {
  width: 100%;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
  border-radius: 16px;
  padding: 18px;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  font-family: "Outfit", sans-serif;
}

.btn-topup-confirm:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(16, 185, 129, 0.4);
}

.btn-topup-confirm:active {
  transform: translateY(0);
}

/* ===== Success Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 24px;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 100%;
  max-width: 360px;
  padding: 36px 28px;
  border-radius: 24px;
  text-align: center;
  transform: scale(0.85) translateY(20px);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.show .modal-content {
  transform: scale(1) translateY(0);
}

.modal-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 32px;
}

.success-icon {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  animation: popIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

.modal-content h3 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-content p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.modal-details {
  background: var(--modal-details-bg);
  border-radius: 12px;
  padding: 12px 16px;
}

.modal-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
  color: var(--text-muted);
}

.modal-detail-row span:last-child {
  color: var(--text-main);
  font-weight: 500;
}

@keyframes popIn {
  from {
    transform: scale(0);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ===== Theme Toggle ===== */
body,
.app-container,
.glass-card,
.glass-panel,
.toast,
.service-card,
.service-icon,
.bottom-nav,
.method-card,
.nominal-card,
.btn-icon,
.input-group input,
.custom-input {
  transition:
    background-color 0.35s ease,
    background 0.35s ease,
    color 0.35s ease,
    border-color 0.35s ease,
    box-shadow 0.35s ease;
}

.theme-toggle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 18px;
  position: relative;
  overflow: hidden;
}

.theme-toggle:hover {
  background: var(--hover-glass-strong);
  transform: rotate(20deg) scale(1.05);
}

.theme-toggle:active {
  transform: scale(0.9);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  position: absolute;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.theme-toggle .icon-sun {
  opacity: 0;
  transform: scale(0.5) rotate(-90deg);
}

.theme-toggle .icon-moon {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

[data-theme="light"] .theme-toggle .icon-sun {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

[data-theme="light"] .theme-toggle .icon-moon {
  opacity: 0;
  transform: scale(0.5) rotate(90deg);
}

/* Light-mode specific overrides for inline styles */
[data-theme="light"] .service-card:hover {
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .premium-gradient {
  box-shadow: 0 12px 28px rgba(59, 130, 246, 0.2);
}

[data-theme="light"] .toast {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}
