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

:root {
  --bg-primary: #121C1B;
  --bg-card: #1B2928;
  --bg-card-hover: #223433;
  --bg-pill: #1E2D2C;
  --accent-emerald: #04BF9D;
  --accent-emerald-dark: #027368;
  --accent-emerald-glow: rgba(4, 191, 157, 0.28);
  --accent-gold: #D4AF37;
  --accent-gold-bg: rgba(212, 175, 55, 0.15);
  --text-main: #FFFFFF;
  --text-muted: #8B9EA2;
  --text-dim: #546A6F;
  --border-card: #263837;
  --radius-card: 20px;
  --radius-pill: 30px;
  --font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  font-family: var(--font-family);
  background-color: #0B1211;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
}

/* Mobile Frame */
.app-container {
  width: 100%;
  max-width: 420px;
  height: 100vh;
  max-height: 900px;
  background-color: var(--bg-primary);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.6);
  border-radius: 36px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

@media (max-width: 450px) {
  .app-container {
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }
}

/* Header */
.app-header {
  height: calc(56px + var(--safe-top));
  padding-top: var(--safe-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 22px;
  padding-right: 22px;
  z-index: 30;
}

.header-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: none;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-main);
  border: 1px solid var(--border-card);
  transition: all 0.2s;
}

.header-btn:active {
  transform: scale(0.95);
  background: var(--bg-card-hover);
}

.header-btn-crown {
  color: var(--accent-gold);
  border-color: rgba(212, 175, 55, 0.3);
  background: var(--accent-gold-bg);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-icon-shield {
  width: 26px;
  height: 26px;
  color: var(--accent-emerald);
}

.app-brand h1 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text-main);
}

.app-brand span {
  font-size: 10px;
  font-weight: 700;
  background: var(--accent-emerald);
  color: #0B1211;
  padding: 2px 6px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

/* Screens Viewport */
.screens-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
}

.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none !important;
  flex-direction: column;
  overflow-y: auto;
  padding-bottom: 76px;
}

.screen.active {
  display: flex !important;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== SCREEN 1: HOME ==================== */
.home-screen {
  padding: 4px 20px 76px 20px;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

.connecting-time-wrap {
  text-align: center;
  margin-top: 2px;
  margin-bottom: 2px;
}

.time-caption {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 1px;
}

.time-value {
  font-size: 38px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.user-ip-sub {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 2px;
}

/* The Huge Central Power Button with Concentric Glow Waves */
.central-power-section {
  position: relative;
  width: 210px;
  height: 210px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 0;
}

.glow-halo-outer {
  position: absolute;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(4, 191, 157, 0.12) 0%, rgba(4, 191, 157, 0.02) 65%, transparent 75%);
  border: 1px dashed rgba(4, 191, 157, 0.2);
  transition: all 0.5s ease;
}

.glow-halo-mid {
  position: absolute;
  width: 168px;
  height: 168px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1.5px solid var(--border-card);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.4s ease;
}

.umra-power-btn {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(145deg, #182827, #13201F);
  border: 2px solid rgba(4, 191, 157, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--accent-emerald);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), inset 0 2px 6px rgba(4, 191, 157, 0.15);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.umra-power-btn:active {
  transform: scale(0.94);
}

.umra-power-icon {
  width: 46px;
  height: 46px;
  stroke: currentColor;
  stroke-width: 3.2;
  stroke-linecap: round;
  fill: none;
  transition: all 0.3s;
}

/* Connecting State */
.central-power-section.connecting .glow-halo-outer {
  animation: pulse-wave 1.8s infinite;
  border-color: var(--accent-emerald);
}

.central-power-section.connecting .umra-power-btn {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 35px var(--accent-emerald-glow);
}

.central-power-section.connecting .umra-power-icon {
  animation: rotateSlow 2s linear infinite;
}

/* Connected State */
.central-power-section.connected .glow-halo-outer {
  background: radial-gradient(circle, rgba(4, 191, 157, 0.22) 0%, rgba(4, 191, 157, 0.05) 70%, transparent 80%);
  border-color: rgba(4, 191, 157, 0.4);
}

.central-power-section.connected .glow-halo-mid {
  border-color: rgba(4, 191, 157, 0.5);
  box-shadow: 0 0 40px rgba(4, 191, 157, 0.25);
}

.central-power-section.connected .umra-power-btn {
  background: linear-gradient(145deg, var(--accent-emerald), var(--accent-emerald-dark));
  color: #071715;
  border-color: #04BF9D;
  box-shadow: 0 0 40px rgba(4, 191, 157, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.4);
}

@keyframes pulse-wave {
  0% {
    transform: scale(0.95);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.06);
    opacity: 1;
  }
  100% {
    transform: scale(0.95);
    opacity: 0.6;
  }
}

@keyframes rotateSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Status Text below button */
.connection-status-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.connection-status-label.connected {
  color: var(--accent-emerald);
}

/* VoIP Pilgrim Banner */
.voip-unblock-badge {
  background: rgba(4, 191, 157, 0.12);
  border: 1px solid rgba(4, 191, 157, 0.3);
  color: var(--accent-emerald);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  display: none;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

/* Download / Upload Rates Row */
.rates-summary-row {
  width: 100%;
  display: flex;
  justify-content: space-around;
  background: var(--bg-card);
  border-radius: 16px;
  padding: 8px 14px;
  border: 1px solid var(--border-card);
  margin-bottom: 10px;
}

.rate-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rate-icon-pill {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(4, 191, 157, 0.12);
  color: var(--accent-emerald);
  display: flex;
  align-items: center;
  justify-content: center;
}

.rate-texts p {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.rate-texts h6 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

/* Bottom Server Pill Card */
.server-bottom-card {
  width: 100%;
  background: var(--bg-card);
  border-radius: var(--radius-card);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border-card);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: all 0.2s;
}

.server-bottom-card:active {
  transform: scale(0.98);
}

.server-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.server-flag-wrap {
  width: 40px;
  height: 30px;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.server-text-col h5 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.server-text-col p {
  font-size: 12px;
  color: var(--text-muted);
}

.btn-details-white {
  background: #FFFFFF;
  color: #121C1B;
  border: none;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 16px;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ==================== SCREEN 2: SERVER LIST ==================== */
.servers-screen {
  padding: 16px 22px;
}

/* Free / VIP Segment Toggle */
.server-tier-segment {
  display: flex;
  background: var(--bg-card);
  border-radius: 16px;
  padding: 4px;
  border: 1px solid var(--border-card);
  margin-bottom: 20px;
}

.segment-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.segment-btn.active {
  background: var(--accent-emerald);
  color: #0B1211;
  font-weight: 700;
}

.servers-group-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.servers-list-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 22px;
}

.server-row-item {
  background: var(--bg-card);
  border-radius: 18px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border-card);
  cursor: pointer;
  transition: all 0.2s;
}

.server-row-item:active {
  background: var(--bg-card-hover);
}

.server-row-item.active {
  border-color: var(--accent-emerald);
}

.server-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.server-row-title h6 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.server-row-title p {
  font-size: 12px;
  color: var(--text-muted);
}

.btn-server-connect {
  background: transparent;
  color: var(--accent-emerald);
  border: 1.5px solid var(--accent-emerald);
  padding: 6px 14px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.server-row-item.active .btn-server-connect {
  background: var(--accent-emerald);
  color: #0B1211;
}

/* ==================== SCREEN 3: SPEED TEST ==================== */
.speed-screen {
  padding: 16px 22px;
  flex-direction: column;
  align-items: center;
}

.speed-info-banner {
  width: 100%;
  background: var(--bg-card);
  border-radius: var(--radius-card);
  padding: 14px 18px;
  border: 1px solid var(--border-card);
  display: flex;
  justify-content: space-between;
  margin-bottom: 24px;
}

.speed-info-cell p {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.speed-info-cell h5 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 2px;
}

/* Umra Gauge with Ticks */
.umra-gauge-wrap {
  width: 250px;
  height: 200px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 24px;
}

.gauge-svg {
  width: 250px;
  height: 160px;
}

.gauge-readout-center {
  position: absolute;
  bottom: 0px;
  text-align: center;
}

.gauge-val-big {
  font-size: 48px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}

.gauge-unit {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-emerald);
  letter-spacing: 0.5px;
}

.speed-metrics-trio {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.speed-metric-item {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 12px 6px;
  text-align: center;
  border: 1px solid var(--border-card);
}

.speed-metric-item p {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.speed-metric-item h5 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 2px;
}

.btn-primary-emerald {
  width: 100%;
  height: 52px;
  background: var(--accent-emerald);
  color: #0B1211;
  border: none;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 8px 24px var(--accent-emerald-glow);
  transition: all 0.2s;
}

.btn-primary-emerald:active {
  transform: scale(0.98);
}

/* ==================== SCREEN 4: PILGRIM PASS / VIP ==================== */
.pass-screen {
  padding: 16px 22px;
}

.pass-hero-card {
  text-align: center;
  background: linear-gradient(145deg, #1D2B29, #131E1D);
  border-radius: 24px;
  padding: 24px 18px;
  border: 1px solid rgba(212, 175, 55, 0.3);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  margin-bottom: 20px;
}

.crown-badge-large {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: var(--accent-gold-bg);
  color: var(--accent-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px auto;
  border: 1px solid rgba(212, 175, 55, 0.4);
}

.pass-hero-card h3 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}

.pass-hero-card p {
  font-size: 12px;
  color: var(--text-muted);
}

.pass-pricing-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 22px;
}

.pass-tier-card {
  background: var(--bg-card);
  border-radius: 18px;
  padding: 16px;
  border: 1.5px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.pass-tier-card.selected {
  border-color: var(--accent-gold);
  background: rgba(212, 175, 55, 0.08);
  box-shadow: 0 4px 20px rgba(212, 175, 55, 0.2);
}

.pass-badge-pill {
  position: absolute;
  top: -10px;
  right: 18px;
  background: linear-gradient(135deg, #D4AF37, #F2C94C);
  color: #121C1B;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 8px;
  letter-spacing: 0.5px;
}

.pass-tier-left h5 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.pass-tier-left p {
  font-size: 12px;
  color: var(--text-muted);
}

.pass-tier-price {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent-gold);
}

/* ==================== SCREEN 5: LANGUAGE / SETTINGS ==================== */
.lang-screen {
  padding: 16px 22px;
}

.lang-screen-hero {
  margin-bottom: 18px;
}

.lang-screen-hero h4 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.lang-screen-hero p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.lang-list-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.lang-item-row {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1.5px solid var(--border-card);
  cursor: pointer;
  transition: all 0.2s;
}

.lang-item-row.selected {
  border-color: var(--accent-emerald);
  background: rgba(4, 191, 157, 0.08);
}

.lang-item-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lang-item-row.selected .lang-checkbox {
  background: var(--accent-emerald);
  border-color: var(--accent-emerald);
  color: #0B1211;
}

/* ==================== BOTTOM TAB BAR ==================== */
.bottom-tab-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: calc(64px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(18, 28, 27, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 50;
}

.tab-btn {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 2.2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab-btn span {
  font-size: 11px;
  font-weight: 600;
}

.tab-btn.active {
  color: var(--accent-emerald);
}

.tab-btn.active svg {
  transform: translateY(-1px);
}

/* RTL Support */
[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] .pass-badge-pill {
  right: auto;
  left: 18px;
}
