/* ============================================
   TRAVIFY CUSTOMER PORTAL · Light Theme · Fuchsia
   Mobile-first, customer-facing
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  --brand: #FF3C9A;
  --brand-hover: #E62E8A;
  --brand-light: #fce4f0;
  --brand-glow: rgba(236, 38, 143, 0.15);

  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fc;
  --bg-tertiary: #f1f3f9;
  --bg-card: #ffffff;
  --bg-hover: #f5f6fa;

  --border: #e5e7ef;
  --border-light: #eef0f6;

  --text-primary: #0f1729;
  --text-secondary: #4f5b7d;
  --text-muted: #8c95ad;

  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --info: #3b82f6;
  --info-bg: #eff6ff;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 41, 0.04);
  --shadow: 0 2px 8px rgba(15, 23, 41, 0.06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 41, 0.12);
}

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

html, body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-secondary);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input {
  font-family: inherit;
  font-size: inherit;
}

/* ============ TOP BAR ============ */

.topbar {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-logo img {
  height: 28px;
  width: auto;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-selector {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 100px;
  background: var(--bg-secondary);
  font-size: 12px;
  color: var(--text-secondary);
}

.user-pill svg {
  width: 14px;
  height: 14px;
}

/* ============ LAYOUT ============ */

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 20px;
}

.container-narrow {
  max-width: 440px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* ============ HEADINGS ============ */

h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  margin-bottom: 6px;
}

h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 28px;
}

/* ============ CARDS ============ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.card-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 12px;
}

/* ============ ESIM CARDS (Dashboard) ============ */

.esim-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 12px;
  display: block;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}

.esim-card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.esim-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.esim-card-country {
  display: flex;
  align-items: center;
  gap: 12px;
}

.esim-card-flag {
  font-size: 32px;
  line-height: 1;
}

.esim-card-name {
  font-weight: 600;
  font-size: 16px;
  color: var(--text-primary);
}

.esim-card-plan {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============ PROGRESS BAR ============ */

.progress-wrap {
  margin: 16px 0;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.progress-labels strong {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
}

.progress-bar {
  background: var(--bg-tertiary);
  border-radius: 100px;
  height: 8px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 100px;
  background: var(--brand);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-fill.warning { background: var(--warning); }
.progress-fill.danger { background: var(--danger); }

/* ============ BADGES ============ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: var(--bg-tertiary); color: var(--text-muted); }

/* ============ BUTTONS ============ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
  transition: all 0.15s;
  white-space: nowrap;
  width: auto;
}

.btn-primary {
  background: var(--brand);
  color: white;
}

.btn-primary:hover {
  background: var(--brand-hover);
  box-shadow: 0 4px 12px var(--brand-glow);
}

.btn-secondary {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: 14px 24px;
  font-size: 15px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============ FORMS ============ */

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 15px;
  transition: all 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-glow);
}

.form-control::placeholder { color: var(--text-muted); }

.form-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ============ KPIs ============ */

.stats-row {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.stat-mini {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  text-align: center;
}

.stat-mini-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

.stat-mini-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 4px;
}

/* ============ EMPTY STATE ============ */

.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-icon {
  font-size: 56px;
  margin-bottom: 16px;
}

.empty-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.empty-text {
  color: var(--text-muted);
  font-size: 14px;
}

/* ============ TOAST ============ */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--text-primary);
  color: white;
  border-radius: var(--radius);
  padding: 14px 20px;
  font-size: 13px;
  font-weight: 500;
  z-index: 200;
  transition: transform 0.3s ease;
  box-shadow: var(--shadow-lg);
  max-width: 90%;
}

.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* ============ SPINNER ============ */

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

.spinner-lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

/* ============ LOGIN ============ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 80% 0%, var(--brand-glow) 0%, transparent 60%),
    radial-gradient(circle at 0% 100%, var(--brand-glow) 0%, transparent 60%),
    var(--bg-secondary);
  padding: 20px;
}

.login-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 32px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo img {
  height: 36px;
}

.login-subtitle-small {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 500;
}

/* ============ QR DISPLAY ============ */

.qr-container {
  text-align: center;
  padding: 24px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.qr-image {
  max-width: 200px;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: white;
  margin: 0 auto;
  display: block;
}

.manual-codes {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 11px;
}

.manual-code-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  gap: 12px;
}

.manual-code-row:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.manual-code-label {
  color: var(--text-muted);
}

.manual-code-value {
  color: var(--text-primary);
  font-weight: 600;
  word-break: break-all;
  text-align: right;
  max-width: 60%;
}

/* ============ INFO ROW ============ */

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}

.info-row:last-child {
  border-bottom: none;
}

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

.info-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ============ CTA TOPUP ============ */

.cta-topup {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-hover) 100%);
  border-radius: var(--radius-lg);
  padding: 24px;
  color: white;
  text-align: center;
  margin: 16px 0;
}

.cta-topup h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  margin-bottom: 8px;
}

.cta-topup p {
  font-size: 13px;
  opacity: 0.9;
  margin-bottom: 16px;
  line-height: 1.5;
}

.cta-topup .btn {
  background: white;
  color: var(--brand);
}

.cta-topup .btn:hover {
  background: var(--bg-secondary);
}

/* ============ UTILITIES ============ */

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.font-mono { font-family: 'SF Mono', Monaco, monospace; }

.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }

.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

/* ============ RESPONSIVE ============ */

@media (max-width: 600px) {
  .topbar { padding: 12px 16px; }
  .container { padding: 24px 16px; }
  .stats-row { flex-direction: column; }
  h1 { font-size: 24px; }
  .card { padding: 20px; }
  .esim-card { padding: 18px; }
}
