/* ===== Friday VPN Mini App — Design System ===== */

:root {
  --bg-primary: #060c12;
  --bg-card: rgba(255,255,255,.04);
  --bg-card-hover: rgba(255,255,255,.07);
  --bg-card-solid: #0e1418;
  --border: rgba(255,255,255,.08);
  --border-focus: rgba(0,113,227,.45);
  --text-primary: #f5f9fc;
  --text-secondary: rgba(245,249,252,.55);
  --text-muted: rgba(245,249,252,.35);
  --accent: #0071e3;
  --accent-soft: rgba(0,113,227,.18);
  --accent-hover: #0077ed;
  --success: #34c759;
  --success-soft: rgba(52,199,89,.15);
  --warning: #f5a623;
  --warning-soft: rgba(245,166,35,.15);
  --danger: #ff3b30;
  --danger-soft: rgba(255,59,48,.15);
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --nav-height: 72px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  min-height: 100%;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'SF Pro Display', 'Helvetica Neue', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100dvh;
  background: linear-gradient(180deg, #060c12 0%, #081a28 50%, #0d3551 100%);
  background-attachment: fixed;
}

/* ===== Loading Screen ===== */
.loading-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255,255,255,.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

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

/* ===== App Shell ===== */
#app {
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 12px);
}

.page {
  min-height: 100dvh;
  padding: 20px 16px calc(20px + var(--safe-bottom));
  animation: pageIn .3s cubic-bezier(.22,1,.36,1) both;
}

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

.page-inner {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

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

.card-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

/* ===== Typography ===== */
.section-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text-primary);
  line-height: 1.1;
}

.section-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

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

.value-large {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 999px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-secondary {
  background: var(--accent-soft);
  border: 1px solid rgba(0,113,227,.3);
  color: #fff;
}
.btn-secondary:hover:not(:disabled) { background: rgba(0,113,227,.25); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-card); }

.btn-danger {
  background: var(--danger-soft);
  border: 1px solid rgba(255,59,48,.25);
  color: #ff6b6b;
}

.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 8px 16px; font-size: 14px; }

/* ===== Status Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-active { background: var(--success-soft); color: var(--success); }
.badge-expired { background: var(--danger-soft); color: #ff6b6b; }
.badge-trial { background: var(--warning-soft); color: var(--warning); }
.badge-none { background: rgba(255,255,255,.06); color: var(--text-secondary); }

/* ===== Bottom Navigation ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  pointer-events: none;
  height: 0;
}

.nav-container {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(12px + var(--safe-bottom));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-width: 400px;
  width: calc(100% - 32px);
  background: rgba(10,64,83,.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 999px;
  padding: 6px;
  border: 1px solid rgba(114,183,206,.2);
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
  pointer-events: auto;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 999px;
  min-height: 52px;
  transition: all .2s ease;
  -webkit-tap-highlight-color: transparent;
}

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

.nav-item.active {
  background: linear-gradient(135deg, rgba(29,201,247,.9), rgba(24,179,225,.9));
  color: #fff;
  border: 1px solid rgba(153,232,255,.2);
  box-shadow: 0 2px 12px rgba(29,201,247,.3);
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

/* ===== Profile Hero ===== */
.profile-hero {
  background: linear-gradient(135deg, rgba(0,113,227,.15), rgba(29,201,247,.08));
  border: 1px solid rgba(0,113,227,.2);
  border-radius: var(--radius-xl);
  padding: 24px 20px;
  text-align: center;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #1dc9f7);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-size: 28px;
  font-weight: 700;
  color: #fff;
}

.profile-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.profile-id {
  font-size: 12px;
  color: var(--text-muted);
  font-family: monospace;
}

/* ===== Metrics Grid ===== */
.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-card .label { margin-bottom: 2px; }

/* ===== Subscription URL ===== */
.url-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,.3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  overflow: hidden;
}

.url-bar-text {
  flex: 1;
  font-size: 13px;
  font-family: monospace;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.url-bar-copy {
  flex-shrink: 0;
  background: var(--accent-soft);
  border: 1px solid rgba(0,113,227,.3);
  color: var(--accent);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* ===== Install Page ===== */
.platform-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.platform-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  transition: all .2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.platform-card:hover { background: var(--bg-card-hover); border-color: rgba(255,255,255,.15); }
.platform-card.selected { border-color: var(--accent); background: var(--accent-soft); }

.platform-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* ===== Steps ===== */
.steps { display: flex; flex-direction: column; gap: 12px; }

.step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid rgba(0,113,227,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.step-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.step-text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.step-note {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(245,166,35,.08);
  border: 1px solid rgba(245,166,35,.15);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--warning);
  line-height: 1.45;
}

/* ===== Support / FAQ ===== */
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.faq-item + .faq-item { margin-top: 8px; }

.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: none;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.faq-arrow {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  transition: transform .2s ease;
  flex-shrink: 0;
}

.faq-item.open .faq-arrow { transform: rotate(180deg); }

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease;
}

.faq-item.open .faq-answer { max-height: 1000px; }

.faq-answer-inner {
  padding: 0 16px 16px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.faq-answer-inner ol {
  padding-left: 20px;
  margin: 8px 0;
}

.faq-answer-inner li { margin-bottom: 6px; }

/* ===== Device List ===== */
.device-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.device-item + .device-item { margin-top: 8px; }

.device-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

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

.device-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

/* ===== Purchase / Tariff Cards ===== */
.tariff-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  transition: all .2s ease;
}

.tariff-card:hover { border-color: rgba(255,255,255,.15); }
.tariff-card.selected { border-color: var(--accent); background: var(--accent-soft); }

.tariff-price {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}

.tariff-period {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ===== Inputs ===== */
.input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  background: rgba(0,0,0,.3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s;
}

.input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(0,113,227,.12); }
.input::placeholder { color: var(--text-muted); }

/* ===== Alerts / Toasts ===== */
.toast {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(-120%);
  z-index: 9999;
  max-width: 90%;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: transform .3s cubic-bezier(.22,1,.36,1);
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
}

.toast.show { transform: translateX(-50%) translateY(0); }
.toast-success { background: rgba(52,199,89,.9); color: #fff; }
.toast-error { background: rgba(255,59,48,.9); color: #fff; }
.toast-info { background: rgba(0,113,227,.9); color: #fff; }

/* ===== Helpers ===== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: #ff6b6b; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 999px; }

/* ===== Skeleton Loading ===== */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,.04) 25%, rgba(255,255,255,.08) 50%, rgba(255,255,255,.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.skeleton-text { height: 14px; width: 60%; margin-bottom: 8px; }
.skeleton-title { height: 20px; width: 40%; margin-bottom: 12px; }
.skeleton-card { height: 100px; width: 100%; }

/* ===== Responsive ===== */
@media (max-width: 380px) {
  .nav-label { font-size: 9px; }
  .nav-item { padding: 6px 8px; min-height: 46px; }
  .page { padding: 16px 12px calc(16px + var(--safe-bottom)); }
}

/* ===== Auth Page ===== */
.auth-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  background:
    radial-gradient(circle at top, rgba(0,113,227,.16), transparent 28%),
    linear-gradient(180deg, #060c12 0%, #0b0b0f 100%);
}

.auth-shell {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 0;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(11,11,15,.92));
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 24px 70px rgba(0,0,0,.46);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  overflow: hidden;
}

.auth-header {
  text-align: center;
  padding: 28px 22px 18px;
}

.auth-logo {
  font-size: 48px;
  margin-bottom: 10px;
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 4px;
}

.auth-subtitle {
  font-size: 14px;
  color: rgba(255,255,255,.55);
  margin: 0;
}

/* Tabs */
.auth-tabs {
  display: flex;
  gap: 0;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.auth-tab {
  flex: 1;
  padding: 12px 0;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: rgba(255,255,255,.45);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: color .2s, border-color .2s;
}

.auth-tab.active {
  color: #fff;
  border-bottom-color: #0071e3;
}

.auth-tab:hover:not(.active) {
  color: rgba(255,255,255,.7);
}

/* Forms */
.auth-forms {
  padding: 20px 22px 24px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Labels */
.auth-label {
  display: flex;
  flex-direction: column;
  margin-bottom: 14px;
}

.auth-label span {
  margin-bottom: 7px;
  font-size: 13px;
  color: rgba(255,255,255,.72);
}

.auth-input {
  width: 100%;
  min-height: 50px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 18px;
  background: rgba(255,255,255,.05);
  padding: 14px 16px;
  color: #fff;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s, background .2s, box-shadow .2s;
}

.auth-input::placeholder {
  color: rgba(255,255,255,.38);
}

.auth-input:focus {
  border-color: rgba(0,113,227,.34);
  background: rgba(255,255,255,.07);
  box-shadow: 0 0 0 1px rgba(0,113,227,.10), 0 0 22px rgba(0,113,227,.14);
}

/* Generate buttons */
.auth-label-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 8px;
}

.auth-generate-btn {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}

.auth-generate-btn:hover {
  background: rgba(255,255,255,.10);
}

.auth-generate-btn:active {
  transform: scale(.97);
}

/* Optional note */
.auth-optional-note {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.4;
  color: rgba(255,255,255,.46);
}

/* Submit button */
.auth-submit {
  width: 100%;
  min-height: 52px;
  border-radius: 999px;
  padding: 0 18px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  background: #0071e3;
  border: 1px solid rgba(255,255,255,.08);
  color: #fff;
  box-shadow: 0 10px 28px rgba(0,113,227,.22);
  cursor: pointer;
  transition: transform .15s, opacity .15s;
}

.auth-submit:hover:not(:disabled) {
  opacity: .92;
}

.auth-submit:active:not(:disabled) {
  transform: scale(.985);
}

.auth-submit:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* Error */
.auth-error {
  margin: 0 0 10px;
  color: #ff9b9b;
  font-size: 13px;
}

/* Captcha Modal */
.auth-captcha-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 9998;
}

.auth-captcha-dialog {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  width: min(90%, 360px);
  background: #141820;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 24px;
  padding: 24px 20px;
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
}

.auth-captcha-dialog h3 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 8px;
}

.auth-captcha-desc {
  font-size: 14px;
  color: rgba(255,255,255,.6);
  margin: 0 0 16px;
}

.auth-captcha-challenge {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  padding: 16px;
  background: rgba(255,255,255,.04);
  border-radius: 16px;
  margin-bottom: 14px;
  font-family: monospace;
  letter-spacing: 2px;
}

.auth-captcha-input {
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 10px;
}

.auth-captcha-error {
  text-align: center;
}

.auth-captcha-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.auth-captcha-cancel {
  flex: 1;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: transparent;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.auth-captcha-submit {
  flex: 1;
  min-height: 44px;
  border-radius: 999px;
  border: none;
  background: #0071e3;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
