/* ==========================================================================
   ShokoVPN Telegram Mini App Design System & Stylesheet
   Theme: Luxury Chocolate & Honey Gold Glassmorphism
   ========================================================================== */

:root {
  /* Core Color Palette */
  --bg-main: #100804;
  --bg-gradient: radial-gradient(circle at 50% 0%, #291207 0%, #100804 70%);
  --surface-card: rgba(35, 18, 12, 0.75);
  --surface-card-hover: rgba(50, 26, 17, 0.85);
  --surface-bubble: rgba(25, 12, 8, 0.6);
  --border-glass: rgba(245, 158, 11, 0.18);
  --border-glass-hover: rgba(245, 158, 11, 0.4);

  /* Gold & Amber Accents */
  --gold-300: #fde68a;
  --gold-400: #fbbf24;
  --gold-500: #f59e0b;
  --gold-600: #d97706;
  --gold-glow: rgba(245, 158, 11, 0.28);

  /* Text & Typography */
  --text-main: #fef3c7;
  --text-muted: #d4bda8;
  --text-dim: #9c8272;

  /* Status Colors */
  --status-online: #10b981;
  --status-online-glow: rgba(16, 185, 129, 0.35);
  --status-offline: #71717a;
  --status-danger: #ef4444;
  --status-danger-glow: rgba(239, 68, 68, 0.3);

  /* Typography */
  --font-fa: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-en: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Dimensions & Spacing */
  --nav-height: 68px;
  --header-height: 64px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --radius-full: 9999px;
  --transition-fast: 0.18s ease;
  --transition-smooth: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-fa);
  background: var(--bg-main);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  overflow-x: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

[dir="ltr"] body {
  font-family: var(--font-en);
}

/* App Container */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 16px));
}

/* ==========================================================================
   Header Component
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: rgba(16, 8, 4, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-glass);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo-container {
  width: 38px;
  height: 38px;
  filter: drop-shadow(0 2px 8px var(--gold-glow));
}

.brand-logo-svg {
  width: 100%;
  height: 100%;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-en);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.5px;
  color: var(--gold-400);
  line-height: 1.1;
}

.brand-subtitle {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: 400;
}

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

.action-pill-btn {
  background: var(--surface-card);
  border: 1px solid var(--border-glass);
  color: var(--gold-400);
  font-family: var(--font-en);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition-fast);
}

.action-pill-btn:active {
  transform: scale(0.95);
  background: var(--gold-500);
  color: #100804;
}

.user-avatar-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-bubble);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.user-dot {
  width: 8px;
  height: 8px;
  background: var(--status-online);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--status-online-glow);
}

.user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   Main & Tab Navigation
   ========================================================================== */
.app-main {
  flex: 1;
  padding: 16px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.24s var(--transition-smooth);
}

.tab-pane.active {
  display: block;
}

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

/* Loading View */
.view-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
  color: var(--text-muted);
  gap: 16px;
}

.spinner-choco {
  position: relative;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 3px solid rgba(245, 158, 11, 0.15);
  border-top-color: var(--gold-500);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.spinner-logo {
  font-size: 1.6rem;
  animation: pulse 1.6s ease-in-out infinite alternate;
}

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

@keyframes pulse {
  from { transform: scale(0.9); }
  to { transform: scale(1.1); }
}

/* ==========================================================================
   Hero Balance Card
   ========================================================================== */
.hero-card {
  position: relative;
  background: var(--surface-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 22px 20px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  margin-bottom: 20px;
}

.hero-bg-glow {
  position: absolute;
  top: -40px;
  right: -40px;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, var(--gold-glow) 0%, transparent 70%);
  pointer-events: none;
}

.hero-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.hero-label {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-weight: 500;
}

.status-indicator-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.12);
  color: var(--status-online);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.status-indicator-badge.empty {
  background: rgba(239, 68, 68, 0.12);
  color: var(--status-danger);
  border-color: rgba(239, 68, 68, 0.25);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
  animation: pulseDot 1.8s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.hero-balance-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 18px;
}

.hero-balance-amount {
  font-family: var(--font-en);
  font-size: 2.5rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  line-height: 1;
}

.hero-balance-unit {
  font-size: 1rem;
  color: var(--gold-400);
  font-weight: 600;
}

.hero-stats-grid {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  gap: 8px;
  margin-bottom: 18px;
  scrollbar-width: none;
}

.hero-stats-grid::-webkit-scrollbar {
  display: none;
}

.stat-bubble {
  flex: 1 1 0;
  min-width: 96px;
  background: var(--surface-bubble);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 10px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.stat-icon {
  font-size: 1.1rem;
}

.stat-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-title {
  font-size: 0.65rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-value {
  font-family: var(--font-en);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-actions-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 10px;
}

/* ==========================================================================
   Buttons & Inputs
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 11px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold-500) 0%, var(--gold-600) 100%);
  color: #1a0802;
  font-weight: 700;
  border: 1px solid rgba(251, 191, 36, 0.4);
}

.btn-glow {
  box-shadow: 0 4px 18px var(--gold-glow);
}

.btn-secondary {
  background: var(--surface-bubble);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--surface-card-hover);
  border-color: var(--border-glass-hover);
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
}

.btn-telegram {
  background: #229ed9;
  color: #fff;
  font-weight: 700;
}

.btn-sm {
  font-size: 0.78rem;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
}

.btn-lg {
  font-size: 1rem;
  padding: 14px 20px;
  border-radius: var(--radius-lg);
}

.btn-block {
  width: 100%;
}

.link-btn {
  background: none;
  border: none;
  color: var(--gold-400);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.form-input {
  width: 100%;
  background: rgba(18, 9, 5, 0.8);
  border: 1px solid var(--border-glass);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  outline: none;
  transition: var(--transition-fast);
}

.form-input:focus {
  border-color: var(--gold-400);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.input-label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 6px;
}

.input-hint {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 6px;
}

/* ==========================================================================
   Quick Navigation Grid
   ========================================================================== */
.quick-nav-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.quick-nav-card {
  background: var(--surface-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.quick-nav-card:active {
  transform: scale(0.97);
  background: var(--surface-card-hover);
  border-color: var(--border-glass-hover);
}

.q-icon {
  font-size: 1.4rem;
  background: var(--surface-bubble);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.q-info {
  flex: 1;
  min-width: 0;
}

.q-info h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.q-info p {
  font-size: 0.68rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.q-arrow {
  color: var(--gold-400);
  font-weight: bold;
}

[dir="ltr"] .q-arrow {
  transform: rotate(180deg);
}

/* ==========================================================================
   Section Containers & Headers
   ========================================================================== */
.section-container {
  margin-bottom: 24px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold-300);
}

.section-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
}

.pane-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--gold-300);
  margin-bottom: 4px;
}

.pane-subtitle {
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* ==========================================================================
   Device Card Component
   ========================================================================== */
.devices-card-grid, .devices-full-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.device-card {
  background: var(--surface-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: var(--transition-smooth);
}

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

.device-title-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.device-icon-badge {
  font-size: 1.2rem;
  width: 36px;
  height: 36px;
  background: var(--surface-bubble);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.device-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}

.device-ip {
  font-family: var(--font-en);
  font-size: 0.72rem;
  color: var(--text-dim);
}

.device-status-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.device-status-pill.online {
  background: rgba(16, 185, 129, 0.15);
  color: var(--status-online);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.device-status-pill.offline {
  background: rgba(113, 113, 122, 0.15);
  color: var(--status-offline);
  border: 1px solid rgba(113, 113, 122, 0.3);
}

.device-status-pill.disabled {
  background: rgba(239, 68, 68, 0.15);
  color: var(--status-danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.device-data-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-bubble);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}

.data-metric {
  display: flex;
  flex-direction: column;
}

.data-metric-label {
  font-size: 0.68rem;
  color: var(--text-dim);
}

.data-metric-val {
  font-family: var(--font-en);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--gold-400);
}

.device-card-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.btn-action-icon {
  background: var(--surface-bubble);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: inherit;
}

.btn-action-icon span.act-emoji {
  font-size: 1rem;
}

.btn-action-icon:active {
  background: var(--surface-card-hover);
  color: var(--gold-400);
  border-color: var(--border-glass);
}

/* Empty placeholder */
.empty-placeholder-box {
  background: var(--surface-card);
  border: 1px dashed var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 36px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

/* ==========================================================================
   Chart & Usage Analytics
   ========================================================================== */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
}

.chart-card {
  padding-bottom: 24px;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 20px;
}

.chart-label {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.chart-total {
  font-family: var(--font-en);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--gold-400);
}

.usage-bars-wrapper {
  display: flex;
  align-items: flex-end;
  height: 140px;
  padding-top: 10px;
  padding-bottom: 6px;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-600) transparent;
}

.usage-bars-wrapper::-webkit-scrollbar {
  height: 4px;
}

.usage-bars-wrapper::-webkit-scrollbar-thumb {
  background: var(--gold-600);
  border-radius: 4px;
}

.usage-bar-col {
  flex: 0 0 32px;
  min-width: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  gap: 6px;
}

.usage-bar-pillar {
  width: 100%;
  max-width: 20px;
  background: linear-gradient(180deg, var(--gold-400) 0%, rgba(217, 119, 6, 0.4) 100%);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px var(--gold-glow);
}

.usage-bar-label {
  font-family: var(--font-en);
  font-size: 0.62rem;
  color: var(--text-dim);
}

.usage-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.usage-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: var(--surface-bubble);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}

.usage-row-date {
  font-family: var(--font-en);
  color: var(--text-muted);
}

.usage-row-vol {
  font-family: var(--font-en);
  font-weight: 700;
  color: var(--gold-400);
}

/* ==========================================================================
   Bank & Top-up Card
   ========================================================================== */
.bank-card {
  position: relative;
  background: linear-gradient(135deg, #381a0e 0%, #1c0a03 100%);
  border: 1px solid rgba(251, 191, 36, 0.35);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 22px 20px;
}

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

.bank-badge {
  font-family: var(--font-en);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--gold-400);
}

.card-instructions {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.25);
  padding: 14px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  white-space: pre-wrap;
}

.step-list {
  padding-right: 20px;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.7;
}

[dir="ltr"] .step-list {
  padding-right: 0;
  padding-left: 20px;
}

/* ==========================================================================
   Invite & Referrals
   ========================================================================== */
.invite-hero-card {
  text-align: center;
  padding: 26px 18px;
}

.gift-icon-glow {
  font-size: 3rem;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 12px var(--gold-glow));
}

.invite-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 8px 0 18px;
}

.invite-stats-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.invite-stat-box {
  background: var(--surface-bubble);
  border: 1px solid var(--border-glass);
  padding: 12px;
  border-radius: var(--radius-md);
}

.istat-num {
  font-family: var(--font-en);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--gold-400);
  display: block;
}

.istat-lbl {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.share-box {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.share-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-glass);
  color: var(--text-dim);
  font-family: var(--font-en);
  font-size: 0.78rem;
  padding: 10px;
  border-radius: var(--radius-md);
  outline: none;
}

/* ==========================================================================
   App Downloads
   ========================================================================== */
.app-links-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.app-platform-card {
  background: var(--surface-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  transition: var(--transition-fast);
}

.app-platform-card:active {
  transform: scale(0.97);
  background: var(--surface-card-hover);
  border-color: var(--border-glass-hover);
}

.app-icon-large {
  font-size: 2rem;
}

.app-platform-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
}

.app-dl-badge {
  font-size: 0.7rem;
  color: var(--gold-400);
  font-weight: 600;
}

.guide-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.guide-step {
  display: flex;
  align-items: center;
  gap: 12px;
}

.step-num {
  width: 28px;
  height: 28px;
  background: var(--gold-500);
  color: #1a0802;
  font-weight: 800;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

.step-text {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Bottom Navigation Bar
   ========================================================================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--nav-height);
  background: rgba(18, 9, 5, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-glass);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0 8px env(safe-area-inset-bottom, 8px);
}

.nav-item {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  font-family: inherit;
}

.nav-icon {
  font-size: 1.25rem;
  transition: transform var(--transition-fast);
}

.nav-label {
  font-size: 0.68rem;
  font-weight: 600;
}

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

.nav-item.active .nav-icon {
  transform: translateY(-2px) scale(1.15);
}

/* ==========================================================================
   Modals & Popups
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 480px;
  background: #1e0e07;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 22px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8);
  animation: slideUp 0.26s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gold-300);
}

.modal-close {
  background: var(--surface-bubble);
  border: none;
  color: var(--text-dim);
  font-size: 1.1rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.qr-container {
  background: #fff;
  padding: 14px;
  border-radius: var(--radius-lg);
  display: inline-block;
  margin: 12px auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.qr-container svg {
  display: block;
  width: 180px;
  height: 180px;
}

.qr-hint {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.config-text-wrapper {
  margin-bottom: 14px;
}

.config-textarea {
  width: 100%;
  height: 100px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 10px;
  color: #fff;
  font-family: monospace;
  font-size: 0.75rem;
  resize: none;
  outline: none;
}

.modal-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.device-result-box {
  text-align: center;
}

.success-check-badge {
  width: 52px;
  height: 52px;
  background: var(--status-online);
  color: #fff;
  font-size: 1.8rem;
  font-weight: bold;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  box-shadow: 0 0 20px var(--status-online-glow);
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */
.toast-popup {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-30px);
  background: rgba(245, 158, 11, 0.95);
  color: #1a0802;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: all 0.26s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast-popup.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
