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

:root {
  --bg-color: #0d0d12;
  --bg-secondary: #16161e;
  --accent-color: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.5);
  --text-color: #ffffff;
  --text-secondary: #94a3b8;
  --card-bg: rgba(22, 22, 30, 0.7);
  --card-border: rgba(255, 255, 255, 0.08);
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.1);
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  
  /* Telegram Theme Overrides */
  --tg-bg: var(--tg-theme-bg-color, #0d0d12);
  --tg-text: var(--tg-theme-text-color, #ffffff);
  --tg-hint: var(--tg-theme-hint-color, #94a3b8);
  --tg-link: var(--tg-theme-link-color, #3b82f6);
  --tg-btn: var(--tg-theme-button-color, #3b82f6);
  --tg-btn-text: var(--tg-theme-button-text-color, #ffffff);
}

body.light-theme {
  --bg-color: #f4f4f9;
  --bg-secondary: #ffffff;
  --accent-color: #3b82f6;
  --text-color: #1f2937;
  --text-secondary: #6b7280;
  --card-bg: rgba(255, 255, 255, 0.9);
  --card-border: rgba(0, 0, 0, 0.05);
  --glass-bg: rgba(0, 0, 0, 0.03);
  --glass-border: rgba(0, 0, 0, 0.08);
  --accent-glow: rgba(59, 130, 246, 0.2);
  background-image: 
    radial-gradient(circle at 0% 0%, rgba(59, 130, 246, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(59, 130, 246, 0.05) 0%, transparent 50%);
}

body.light-theme .page-title {
  background: linear-gradient(to bottom, #1f2937, #4b5563);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

body {
  background-color: var(--bg-color);
  background-image: 
    radial-gradient(circle at 0% 0%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
  color: var(--text-color);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom, 20px);
  overflow-x: hidden;
}

h1, h2, h3, .page-title {
  font-family: 'Outfit', sans-serif;
}

/* ── Custom Scrollbar ── */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--card-border);
  border-radius: 10px;
}

/* ── Loading ── */
#loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  background: var(--bg-color);
  z-index: 1000;
  color: var(--text-secondary);
}

.spin {
  width: 40px;
  height: 40px;
  border: 3px solid var(--glass-border);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

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

/* ── Screens ── */
.screen {
  display: none;
  padding: 16px;
  animation: fadeIn 0.4s ease-out;
}

.screen.active {
  display: block;
}

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

/* ── Header ── */
.page-header {
  padding: 24px 16px 16px;
  text-align: center;
}

.page-icon {
  font-size: 56px;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 15px var(--accent-glow));
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(to bottom, #fff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.page-sub {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

/* ── Section ── */
.section {
  margin-bottom: 24px;
}

.section-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 1px;
  padding-left: 8px;
  margin-bottom: 10px;
}

.card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.row {
  display: flex;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--card-border);
  transition: background 0.2s;
}

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

.row-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  width: 100%;
  text-align: left;
  color: inherit;
  display: flex;
  align-items: center;
  padding: 16px;
}

.row-btn:active {
  background: rgba(255, 255, 255, 0.05);
}

.row-icon {
  font-size: 24px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  margin-right: 16px;
  flex-shrink: 0;
}

.row-body {
  flex: 1;
  min-width: 0;
}

.row-title {
  font-weight: 600;
  font-size: 16px;
}

.row-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.row-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.row-arrow {
  color: var(--text-secondary);
  font-size: 18px;
  opacity: 0.5;
}

/* ── Badge ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge-trial { background: rgba(245, 158, 11, 0.15); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-paid  { background: rgba(16, 185, 129, 0.15); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-expired { background: rgba(239, 68, 68, 0.15); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.badge-run   { background: rgba(16, 185, 129, 0.15); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-stop  { background: rgba(148, 163, 184, 0.1); color: var(--text-secondary); border: 1px solid rgba(148, 163, 184, 0.2); }

/* ── Buttons ── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 16px;
  border-radius: 16px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  margin-top: 12px;
}

.btn:active {
  transform: scale(0.98);
  opacity: 0.9;
}

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

.btn-primary {
  background: var(--accent-color);
  color: #fff;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

/* ── Alerts ── */
.alert {
  border-radius: 16px;
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 16px;
  display: none;
  border: 1px solid transparent;
}

.alert.show {
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-e { background: rgba(239, 68, 68, 0.1); color: var(--danger); border-color: rgba(239, 68, 68, 0.2); }
.alert-s { background: rgba(16, 185, 129, 0.1); color: var(--success); border-color: rgba(16, 185, 129, 0.2); }
.alert-i { background: rgba(59, 130, 246, 0.1); color: var(--accent-color); border-color: rgba(59, 130, 246, 0.2); }

/* ── Forms ── */
.field {
  margin-bottom: 20px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  padding-left: 4px;
}

input, textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--card-border);
  background: var(--glass-bg);
  color: var(--text-color);
  font-family: inherit;
  font-size: 16px;
  outline: none;
  transition: all 0.2s;
}

input:focus, textarea:focus {
  border-color: var(--accent-color);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.input-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
  padding-left: 4px;
}

/* ── Toggle ── */
.toggle-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  margin-bottom: 20px;
}

.toggle {
  position: relative;
  width: 51px;
  height: 31px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  background: #334155;
  border-radius: 34px;
  cursor: pointer;
  transition: 0.3s;
}

.slider:before {
  content: '';
  position: absolute;
  height: 27px;
  width: 27px;
  left: 2px;
  bottom: 2px;
  background: #fff;
  border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .slider {
  background: var(--accent-color);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* ── Tabs ── */
.tabs {
  display: flex;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 4px;
  border-radius: 14px;
  margin-bottom: 24px;
}

.tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary);
  transition: 0.2s;
}

.tab.active {
  background: var(--accent-color);
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-glow);
}
/* ── Bottom Navigation ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(13, 13, 18, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom, 0);
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  transition: 0.2s;
  background: none;
  border: none;
  cursor: pointer;
}

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

.nav-item .nav-icon {
  font-size: 24px;
}

.nav-item.active .nav-icon {
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

/* ── Top Bar / Header ── */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 90;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(13, 13, 18, 0.6);
  backdrop-filter: blur(10px);
}

.gear-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
}

/* ── Language Buttons ── */
.lang-selector {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.lang-btn {
  flex: 1;
  padding: 12px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  color: var(--text-color);
  font-weight: 600;
  cursor: pointer;
}

.lang-btn.active {
  border-color: var(--accent-color);
  background: rgba(59, 130, 246, 0.1);
}

/* ── Dynamic Lists ── */
.dynamic-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dynamic-item {
  display: flex;
  gap: 8px;
  align-items: center;
}

.dynamic-input {
  flex: 1;
}

.circle-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
  border: none;
  transition: 0.2s;
}

.btn-add {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.btn-remove {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

/* ── Timer ── */
.timer-display {
  font-family: 'Outfit', sans-serif;
  font-size: 56px;
  font-weight: 700;
  text-align: center;
  margin: 10px 0;
  background: linear-gradient(to bottom, #fff, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ── Progress Bar ── */
.progress-wrap {
  width: 100%;
  height: 6px;
  background: var(--glass-bg);
  border-radius: 10px;
  margin: 20px 0;
  overflow: hidden;
  border: 1px solid var(--glass-border);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-color), #8b5cf6);
  width: 0%;
  transition: width 0.5s ease;
  box-shadow: 0 0 10px var(--accent-glow);
}

/* ── Subscription Cards ── */
.sub-plan-card {
  padding: 24px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
  border: 1px solid var(--accent-color);
  border-radius: 24px;
  text-align: center;
  margin-bottom: 24px;
}

.sub-price {
  font-size: 40px;
  font-weight: 700;
  margin: 12px 0;
}

.sub-features {
  text-align: left;
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.feature-check {
  color: var(--success);
}

/* ── Hide default paddings for tabbed view ── */
.tab-content {
  padding-bottom: 80px;
}

/* ── Live Status ── */
.live-card {
  padding: 20px;
}

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

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

.live-val {
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
}

.live-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  margin-right: 8px;
  box-shadow: 0 0 10px var(--success);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.1); opacity: 0.8; box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
  100% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ── Success ── */
.success-wrap {
  text-align: center;
  padding: 60px 24px;
}

.big-icon {
  font-size: 80px;
  margin-bottom: 24px;
}

.success-wrap h2 {
  font-size: 28px;
  margin-bottom: 12px;
}

.success-wrap p {
  color: var(--text-secondary);
  font-size: 16px;
}

/* ── Comparison Table ── */
.comp-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 13px;
}

.comp-table th, .comp-table td {
  padding: 12px 8px;
  text-align: left;
  border-bottom: 1px solid var(--card-border);
}

.comp-table th {
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
}

.comp-val-trial { color: var(--text-secondary); text-align: center; }
.comp-val-paid  { color: var(--success); font-weight: 600; text-align: center; }

/* ── Toast ── */
#toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--accent-color);
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  z-index: 1000;
  box-shadow: 0 4px 15px var(--accent-glow);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

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

/* ══════════════════════════════════════════
   ANIMATIONS & MICRO-INTERACTIONS
══════════════════════════════════════════ */

/* ── Button Loading Spinner ── */
.btn { position: relative; overflow: hidden; }

.btn.loading {
  pointer-events: none;
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
}
.btn.loading::after {
  content: '';
  position: absolute;
  width: 22px; height: 22px;
  border: 2.5px solid rgba(255,255,255,.22);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  top: 50%; left: 50%;
  margin: -11px 0 0 -11px;
}
.btn-ghost.loading::after  { border-top-color: var(--text-secondary); }
.btn-danger.loading::after { border-top-color: var(--danger); }

/* ── Ripple ── */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.22);
  transform: scale(0);
  animation: rippleAnim 0.55s ease-out forwards;
  pointer-events: none;
}
@keyframes rippleAnim {
  to { transform: scale(4); opacity: 0; }
}

/* ── Screen entrance ── */
.screen.active {
  animation: screenIn 0.28s cubic-bezier(.34,1.4,.64,1);
}
@keyframes screenIn {
  from { opacity:0; transform:translateY(14px) scale(.985); }
  to   { opacity:1; transform:none; }
}

/* ── Dynamic item entrance ── */
.dynamic-item {
  animation: itemIn 0.22s cubic-bezier(.34,1.4,.64,1);
}
@keyframes itemIn {
  from { opacity:0; transform:translateX(-10px) scale(.95); }
  to   { opacity:1; transform:none; }
}

/* ── Alert slide-in ── */
.alert.show { animation: alertIn 0.2s ease; }
@keyframes alertIn {
  from { opacity:0; transform:translateY(-5px); }
  to   { opacity:1; transform:none; }
}

/* ── Progressive field reveal ── */
.field-reveal {
  overflow: hidden;
  animation: slideDown 0.3s ease forwards;
}
@keyframes slideDown {
  from { opacity:0; max-height:0; transform:translateY(-8px); }
  to   { opacity:1; max-height:200px; transform:none; }
}

/* ── Auth mode toggle ── */
.auth-mode-row { display:flex; gap:8px; margin-bottom:20px; }
.auth-mode-row .lang-btn { flex:1; padding:10px; font-size:13px; }

/* ── Live counter bump ── */
@keyframes counterBump {
  0%   { transform: scale(1);    }
  40%  { transform: scale(1.18); color: var(--success); }
  100% { transform: scale(1);    }
}
.live-val.bump { animation: counterBump 0.32s ease; }

/* ── Progress bar glow pulse ── */
.progress-fill { animation: glowPulse 2s ease-in-out infinite; }
@keyframes glowPulse {
  0%,100% { box-shadow: 0 0 8px  var(--accent-glow); }
  50%     { box-shadow: 0 0 22px var(--accent-glow), 0 0 40px rgba(139,92,246,.28); }
}

/* ── Page icon float ── */
.page-icon { animation: iconFloat 3.5s ease-in-out infinite; display:inline-block; }
@keyframes iconFloat {
  0%,100% { transform:translateY(0);   filter:drop-shadow(0 0 14px var(--accent-glow)); }
  50%     { transform:translateY(-5px);filter:drop-shadow(0 0 26px var(--accent-glow)); }
}

/* ── Success pop ── */
.big-icon { animation: popIn .5s cubic-bezier(.34,1.56,.64,1); display:inline-block; }
@keyframes popIn {
  from { transform:scale(0) rotate(-20deg); opacity:0; }
  to   { transform:none; opacity:1; }
}

/* ── Gear rotate on click ── */
.gear-btn { transition: transform .28s cubic-bezier(.34,1.56,.64,1), background .2s; }
.gear-btn:active { transform: rotate(90deg) scale(.9); }

/* ── Nav item press ── */
.nav-item { transition: color .2s, transform .15s; }
.nav-item:active { transform: scale(.84); }

/* ── Row press ── */
.row-btn { transition: background .15s, transform .1s; }
.row-btn:active { transform: scale(.985); }

/* ── Button press ── */
.btn:active:not(.loading) { transform: scale(.97); opacity:.88; }
.btn { transition: all .18s cubic-bezier(.4,0,.2,1); }

/* ── Skeleton shimmer ── */
.skeleton {
  background: linear-gradient(90deg, var(--glass-bg) 25%, rgba(255,255,255,.05) 50%, var(--glass-bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 8px; color: transparent;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Card appear ── */
.card { transition: box-shadow .2s; }

/* ── Sub plan card glow ── */
.sub-plan-card {
  animation: borderGlow 3s ease-in-out infinite;
}
@keyframes borderGlow {
  0%,100% { box-shadow: 0 0 0  rgba(59,130,246,.2); }
  50%     { box-shadow: 0 0 24px rgba(59,130,246,.35), 0 0 48px rgba(139,92,246,.15); }
}

/* ── Toast improved ── */
#toast { transition: transform .32s cubic-bezier(.34,1.56,.64,1), opacity .2s; }

/* ── Last Session Card ── */
.last-session-card {
  padding: 20px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  margin-top: 20px;
}

.last-session-title {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 1px;
  margin-bottom: 16px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

