/* ========================================
   LuciProd — Telegram Mini App
   Design System: "Calm Modern"
   ======================================== */

:root {
  --bg: #1a1a2e;
  --bg-card: #16213e;
  --bg-card-hover: #1a2744;
  --bg-input: #0f1829;
  --primary: #4cc9f0;
  --primary-dim: rgba(76, 201, 240, 0.15);
  --secondary: #4361ee;
  --secondary-dim: rgba(67, 97, 238, 0.15);
  --success: #06d6a0;
  --success-dim: rgba(6, 214, 160, 0.15);
  --warning: #ffd166;
  --warning-dim: rgba(255, 209, 102, 0.15);
  --danger: #ef476f;
  --danger-dim: rgba(239, 71, 111, 0.15);
  --text: #e8e8e8;
  --text-secondary: #8892a4;
  --text-muted: #5a6478;
  --border: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.1);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --transition: all 0.2s ease;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-height: 68px;
}

/* Light theme */
[data-theme="light"] {
  --bg: #f0f2f5;
  --bg-card: #ffffff;
  --bg-card-hover: #f5f7fa;
  --bg-input: #e8ecf1;
  --primary: #2a9fd6;
  --primary-dim: rgba(42, 159, 214, 0.12);
  --secondary: #3a56d4;
  --secondary-dim: rgba(58, 86, 212, 0.1);
  --success: #05b88a;
  --success-dim: rgba(5, 184, 138, 0.1);
  --warning: #e5a800;
  --warning-dim: rgba(229, 168, 0, 0.1);
  --danger: #d93a5c;
  --danger-dim: rgba(217, 58, 92, 0.1);
  --text: #1a1a2e;
  --text-secondary: #5a6478;
  --text-muted: #8892a4;
  --border: rgba(0, 0, 0, 0.06);
  --border-light: rgba(0, 0, 0, 0.1);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.1);
  --nav-height: 68px;
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ========================================
   Loading
   ======================================== */

.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease;
}

.loading-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: pulse-logo 1.5s ease-in-out infinite;
}

.logo-icon {
  font-size: 56px;
  filter: drop-shadow(0 0 20px rgba(76, 201, 240, 0.5));
}

.logo-text {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.5px;
}

@keyframes pulse-logo {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.8; }
}

/* ========================================
   Page Container
   ======================================== */

.page-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 8px);
  position: relative;
}

.page {
  padding: 16px;
  min-height: 100%;
  animation: page-enter 0.3s ease;
}

.page.slide-left {
  animation: slide-left 0.3s ease;
}

.page.slide-right {
  animation: slide-right 0.3s ease;
}

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

@keyframes slide-left {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slide-right {
  from { opacity: 0; transform: translateX(-40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ========================================
   Bottom Navigation
   ======================================== */

.bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 8px 4px calc(8px + var(--safe-bottom));
  height: calc(var(--nav-height) + var(--safe-bottom));
  flex-shrink: 0;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px 20px 0 0;
  margin: 0 -1px -1px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 10px;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  min-width: 64px;
}

.nav-item .nav-icon {
  width: 22px;
  height: 22px;
  transition: var(--transition);
}

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

.nav-item:active {
  transform: scale(0.92);
}

/* ========================================
   Cards
   ======================================== */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

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

.card + .card {
  margin-top: 12px;
}

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

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

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

/* ========================================
   Section Headers
   ======================================== */

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

.section-icon {
  font-size: 22px;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

/* ========================================
   Status Card (Home)
   ======================================== */

.greeting {
  margin-bottom: 20px;
}

.greeting-text {
  font-size: 24px;
  font-weight: 700;
}

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

.sub-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-left: 8px;
  vertical-align: middle;
}

.sub-badge.free { background: var(--secondary-dim); color: var(--secondary); }
.sub-badge.basic { background: var(--primary-dim); color: var(--primary); }
.sub-badge.premium { background: var(--warning-dim); color: var(--warning); }
.sub-badge.annual { background: var(--success-dim); color: var(--success); }
.sub-badge.none { background: var(--danger-dim); color: var(--danger); }

.status-card {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card-hover) 100%);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 24px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.status-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(76, 201, 240, 0.08), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.status-plan {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-plan-icon {
  font-size: 24px;
}

.status-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

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

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

.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 12px;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}

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

/* ========================================
   Quick Actions (Home)
   ======================================== */

.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.quick-action {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  transition: var(--transition);
  min-height: 88px;
}

.quick-action:active {
  transform: scale(0.97);
  background: var(--bg-card-hover);
}

.quick-action-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.quick-action-icon.blue { background: var(--primary-dim); }
.quick-action-icon.purple { background: var(--secondary-dim); }
.quick-action-icon.green { background: var(--success-dim); }
.quick-action-icon.yellow { background: var(--warning-dim); }

.quick-action-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

/* ========================================
   Buttons
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 14px 24px;
  transition: var(--transition);
  width: 100%;
  min-height: 48px;
  position: relative;
  overflow: hidden;
}

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

.btn-primary {
  background: var(--primary);
  color: #0a0a1a;
}

.btn-primary:active {
  background: #3bb8df;
}

.btn-secondary {
  background: var(--secondary-dim);
  color: var(--secondary);
  border: 1px solid rgba(67, 97, 238, 0.2);
}

.btn-success {
  background: var(--success);
  color: #0a0a1a;
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-light);
}

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
}

.btn-sm {
  padding: 10px 16px;
  font-size: 13px;
  min-height: 40px;
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ========================================
   Plans
   ======================================== */

.plan-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  margin-bottom: 12px;
  position: relative;
  transition: var(--transition);
  overflow: hidden;
}

.plan-card.current {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), var(--shadow);
}

.plan-card.recommended {
  border-color: var(--warning);
}

.plan-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.plan-badge.current-badge {
  background: var(--primary-dim);
  color: var(--primary);
}

.plan-badge.best-value {
  background: var(--warning-dim);
  color: var(--warning);
}

.plan-name {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.plan-price {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 16px;
}

.plan-price-amount {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
}

.plan-price-currency {
  font-size: 16px;
  color: var(--text-secondary);
}

.plan-price-period {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: 4px;
}

.plan-features {
  list-style: none;
  margin-bottom: 20px;
}

.plan-features li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.plan-features li .feature-icon {
  color: var(--success);
  font-size: 16px;
  flex-shrink: 0;
}

.plan-per-month {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
}

/* ========================================
   Devices
   ======================================== */

.device-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.device-card.deleting {
  animation: slide-out-right 0.3s ease forwards;
}

@keyframes slide-out-right {
  to {
    transform: translateX(100%);
    opacity: 0;
    height: 0;
    padding: 0;
    margin: 0;
    border: 0;
  }
}

.device-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.device-icon.android { background: var(--success-dim); }
.device-icon.ios { background: rgba(136, 146, 164, 0.15); }
.device-icon.macos { background: rgba(136, 146, 164, 0.15); }
.device-icon.windows { background: var(--primary-dim); }
.device-icon.linux { background: var(--warning-dim); }

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

.device-name {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.device-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.device-delete-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--danger-dim);
  border: none;
  color: var(--danger);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}

.device-delete-btn:active {
  transform: scale(0.9);
  background: var(--danger);
  color: white;
}

.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 20px);
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: #0a0a1a;
  border: none;
  font-size: 28px;
  font-weight: 300;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(76, 201, 240, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  z-index: 50;
}

.fab:active {
  transform: scale(0.9);
}

.device-counter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

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

.device-counter-num {
  font-weight: 700;
  color: var(--primary);
}

/* ========================================
   VLESS Link Display
   ======================================== */

.vless-container {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0;
  position: relative;
}

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

.vless-link {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 12px;
  color: var(--primary);
  word-break: break-all;
  line-height: 1.6;
  user-select: all;
  -webkit-user-select: all;
}

.vless-copy-btn {
  margin-top: 12px;
  width: 100%;
}

/* ========================================
   Empty States
   ======================================== */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  min-height: 300px;
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.empty-text {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 260px;
  line-height: 1.6;
}

/* ========================================
   Profile
   ======================================== */

.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 0;
  margin-bottom: 8px;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: white;
  margin-bottom: 12px;
  box-shadow: 0 4px 20px rgba(76, 201, 240, 0.3);
}

.profile-name {
  font-size: 22px;
  font-weight: 700;
}

.profile-username {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.profile-section {
  margin-bottom: 20px;
}

.profile-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
  padding: 0 4px;
}

.profile-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: var(--transition);
  cursor: pointer;
}

.profile-row:first-of-type {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.profile-row:last-of-type {
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.profile-row:only-of-type {
  border-radius: var(--radius-lg);
}

.profile-row + .profile-row {
  border-top: none;
}

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

.profile-row-icon {
  font-size: 20px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

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

.profile-row-title {
  font-size: 15px;
  font-weight: 500;
}

.profile-row-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.profile-row-value {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.profile-row-arrow {
  color: var(--text-muted);
  font-size: 18px;
}

/* ========================================
   Referral Card
   ======================================== */

.referral-link-box {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  cursor: pointer;
  transition: var(--transition);
}

.referral-link-box:active {
  background: var(--bg-card-hover);
}

.referral-link-text {
  flex: 1;
  font-size: 13px;
  color: var(--primary);
  word-break: break-all;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.referral-copy-icon {
  color: var(--text-secondary);
  font-size: 18px;
  flex-shrink: 0;
}

.referral-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.referral-stat {
  background: var(--bg-input);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}

.referral-stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
}

.referral-stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ========================================
   Download Grid
   ======================================== */

.download-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.download-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: var(--text);
}

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

.download-item-icon {
  font-size: 28px;
}

.download-item-name {
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

/* ========================================
   Modal
   ======================================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal.show .modal-content {
  animation: modal-slide-up 0.3s ease;
}

.modal.hiding .modal-content {
  animation: modal-slide-down 0.2s ease forwards;
}

.modal.hiding .modal-backdrop {
  animation: fade-out 0.2s ease forwards;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  animation: fade-in 0.2s ease;
}

.modal-content {
  position: relative;
  background: var(--bg);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  padding-bottom: calc(24px + var(--safe-bottom));
  box-shadow: var(--shadow-lg);
}

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

.modal-header h3 {
  font-size: 20px;
  font-weight: 700;
}

.modal-close {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg-card);
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:active {
  background: var(--bg-card-hover);
}

@keyframes modal-slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes modal-slide-down {
  from { transform: translateY(0); }
  to { transform: translateY(100%); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* Success modal center */
.success-modal-content {
  border-radius: var(--radius-xl);
  margin: auto;
  max-width: 320px;
  text-align: center;
  padding-bottom: 24px;
}

.success-animation {
  margin-bottom: 20px;
}

.success-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--success-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  animation: success-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.success-check {
  width: 40px;
  height: 40px;
}

@keyframes success-pop {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

.success-modal-content h3 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}

.success-modal-content p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* ========================================
   Device Type Picker
   ======================================== */

.device-type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.device-type-item {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.device-type-item:active {
  transform: scale(0.95);
}

.device-type-item.selected {
  border-color: var(--primary);
  background: var(--primary-dim);
}

.device-type-icon {
  font-size: 32px;
}

.device-type-label {
  font-size: 13px;
  font-weight: 600;
}

/* ========================================
   Input
   ======================================== */

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

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

.input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  outline: none;
  transition: var(--transition);
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

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

/* ========================================
   Toast
   ======================================== */

.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  z-index: 500;
  pointer-events: none;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: calc(100% - 32px);
  text-align: center;
}

.toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(-20px);
}

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

.toast.success {
  background: rgba(6, 214, 160, 0.9);
  color: #0a0a1a;
}

.toast.error {
  background: rgba(239, 71, 111, 0.9);
  color: white;
}

.toast.info {
  background: rgba(76, 201, 240, 0.9);
  color: #0a0a1a;
}

/* ========================================
   Skeletons
   ======================================== */

.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

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

.skeleton-card {
  height: 120px;
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
}

.skeleton-row {
  height: 64px;
  border-radius: var(--radius-lg);
  margin-bottom: 10px;
}

.skeleton-text {
  height: 14px;
  width: 60%;
  margin-bottom: 8px;
}

.skeleton-text.short { width: 40%; }
.skeleton-text.long { width: 85%; }

/* ========================================
   Pull to Refresh
   ======================================== */

.pull-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  color: var(--text-secondary);
  font-size: 13px;
  transition: var(--transition);
  overflow: hidden;
  height: 0;
}

.pull-indicator.visible {
  height: 44px;
}

.pull-indicator.refreshing .pull-spinner {
  animation: spin 0.8s linear infinite;
}

.pull-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin-right: 8px;
}

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

/* ========================================
   No-subscription CTA
   ======================================== */

.cta-card {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card-hover) 50%, var(--bg-card) 100%);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  text-align: center;
  margin-bottom: 20px;
}

.cta-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.cta-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.cta-text {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.6;
}

/* ========================================
   Confirm Dialog inline
   ======================================== */

.confirm-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 5;
  animation: fade-in 0.15s ease;
}

.confirm-text {
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  padding: 0 16px;
  color: #ffffff;
}

.confirm-buttons {
  display: flex;
  gap: 10px;
}

/* ========================================
   Utilities
   ======================================== */

.hidden { display: none !important; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: 13px; }
.fw-600 { font-weight: 600; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }

/* Stagger animation for lists */
.stagger-item {
  animation: stagger-in 0.3s ease backwards;
}

.stagger-item:nth-child(1) { animation-delay: 0s; }
.stagger-item:nth-child(2) { animation-delay: 0.05s; }
.stagger-item:nth-child(3) { animation-delay: 0.1s; }
.stagger-item:nth-child(4) { animation-delay: 0.15s; }
.stagger-item:nth-child(5) { animation-delay: 0.2s; }
.stagger-item:nth-child(6) { animation-delay: 0.25s; }
.stagger-item:nth-child(7) { animation-delay: 0.3s; }
.stagger-item:nth-child(8) { animation-delay: 0.35s; }

@keyframes stagger-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   Desktop
   ======================================== */

@media (min-width: 480px) {
  .page-container {
    max-width: 480px;
    margin: 0 auto;
  }

  .bottom-nav {
    max-width: 480px;
    margin: 0 auto;
    left: 0;
    right: 0;
  }

  body {
    background: var(--bg);
  }

  #app {
    max-width: 480px;
    margin: 0 auto;
    background: var(--bg);
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }

  .modal-content {
    border-radius: var(--radius-xl);
    margin-bottom: 20px;
  }

  .fab {
    right: calc(50% - 240px + 20px);
  }
}

/* ========================================
   Downloads Page — Cards
   ======================================== */

.download-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: var(--transition);
}

.download-card-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.download-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--primary-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

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

.download-card-name {
  font-size: 15px;
  font-weight: 600;
}

.download-card-detail {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.download-card-size {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.download-card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.download-card-actions .btn {
  width: auto;
  min-width: 100px;
  padding: 8px 12px;
  font-size: 12px;
  min-height: 34px;
  text-decoration: none;
  text-align: center;
}

.download-btn {
  text-decoration: none !important;
}

.send-file-btn {
  font-size: 11px !important;
}

.download-grid-compact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

.download-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.download-note-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.download-note-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ========================================
   Connection Method Tabs (Modal)
   ======================================== */

.conn-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 16px;
}

.conn-tab {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.conn-tab.active {
  background: var(--primary-dim);
  color: var(--primary);
}

.conn-tab:active {
  transform: scale(0.97);
}

/* VK Call Instructions */

.vkcall-instructions {
  padding: 20px 0;
  text-align: center;
}

.vkcall-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.vkcall-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.vkcall-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
}

.vkcall-steps {
  text-align: left;
}

.vkcall-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}

.vkcall-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-dim);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ========================================
   Settings Page
   ======================================== */

.settings-section {
  margin-bottom: 20px;
}

.settings-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
  padding: 0 4px;
}

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
}

.settings-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.settings-row-icon {
  font-size: 20px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  background: var(--primary-dim);
}

.settings-row-title {
  font-size: 15px;
  font-weight: 500;
}

.settings-row-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.settings-divider {
  height: 1px;
  background: var(--border);
  margin: 0 16px;
}

.settings-select {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  cursor: pointer;
  min-width: 120px;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238892a4' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.settings-select:focus {
  border-color: var(--primary);
}

/* Theme Picker */

.theme-picker {
  display: flex;
  gap: 8px;
  padding: 14px 16px;
}

.theme-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
  color: var(--text-secondary);
}

.theme-option.active {
  border-color: var(--primary);
  background: var(--primary-dim);
  color: var(--primary);
}

.theme-option:active {
  transform: scale(0.95);
}

.theme-option-icon {
  font-size: 24px;
}

.theme-option-label {
  font-size: 12px;
  font-weight: 600;
}

/* Toggle Switch */

.toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  transition: var(--transition);
  border-radius: 28px;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 22px;
  width: 22px;
  left: 2px;
  bottom: 2px;
  background: var(--text-secondary);
  transition: var(--transition);
  border-radius: 50%;
}

.toggle input:checked + .toggle-slider {
  background: var(--primary);
  border-color: var(--primary);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: #0a0a1a;
}

/* 6-item nav adjustment */
.bottom-nav .nav-item {
  min-width: 52px;
  padding: 4px 6px;
  font-size: 9px;
}

.bottom-nav .nav-item .nav-icon {
  width: 20px;
  height: 20px;
}
