/* ═══════════════════════════════════════════
   FenyaBot Mini App — Design System
   Theme: Blue-Black Glassmorphism
   ═══════════════════════════════════════════ */

:root {
  --bg-primary: #060a14;
  --bg-secondary: #0c1222;
  --bg-card: rgba(12, 22, 45, 0.75);
  --bg-card-hover: rgba(18, 32, 60, 0.85);
  --bg-nav: rgba(8, 14, 30, 0.92);

  --blue-500: #3b82f6;
  --blue-400: #60a5fa;
  --blue-300: #93c5fd;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-900: #1e3a8a;

  --green-400: #4ade80;
  --green-500: #22c55e;
  --red-400: #f87171;
  --red-500: #ef4444;
  --yellow-400: #facc15;
  --orange-400: #fb923c;

  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --gradient-primary: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  --gradient-accent: linear-gradient(135deg, #2563eb 0%, #60a5fa 100%);
  --gradient-card: linear-gradient(145deg, rgba(15,25,50,0.8) 0%, rgba(8,16,35,0.9) 100%);
  --gradient-casino: linear-gradient(135deg, #7c3aed 0%, #3b82f6 100%);

  --border-color: rgba(59, 130, 246, 0.15);
  --border-glow: rgba(59, 130, 246, 0.3);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4), 0 0 1px rgba(59, 130, 246, 0.1);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);
  --shadow-btn: 0 4px 16px rgba(59, 130, 246, 0.3);

  --nav-height: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 20%, rgba(30, 58, 138, 0.15) 0%, transparent 50%),
              radial-gradient(circle at 70% 80%, rgba(59, 130, 246, 0.08) 0%, transparent 40%);
  z-index: -1;
  pointer-events: none;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
}

#page-container {
  padding: 16px 16px calc(var(--nav-height) + var(--safe-bottom) + 16px);
  min-height: 100vh;
  animation: fadeIn 0.3s ease;
}

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

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

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

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

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

/* ── Bottom Nav ── */

#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: var(--nav-height);
  padding-bottom: var(--safe-bottom);
  background: var(--bg-nav);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  z-index: 100;
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 0;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  flex: 1;
}

.nav-btn.active {
  color: var(--blue-400);
}

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

.nav-icon {
  font-size: 22px;
  line-height: 1;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ── Cards ── */

.card {
  background: var(--gradient-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: slideUp 0.4s ease backwards;
}

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

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

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

.card-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ── Profile Card ── */

.profile-card {
  background: var(--gradient-primary);
  border: none;
  padding: 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.profile-card::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
  pointer-events: none;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 12px;
  border: 2px solid rgba(255,255,255,0.2);
}

.profile-name {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 4px;
}

.profile-balance {
  font-size: 32px;
  font-weight: 800;
  margin: 12px 0 4px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.profile-balance-label {
  font-size: 13px;
  opacity: 0.7;
  font-weight: 500;
}

/* ── Stat Grid ── */

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.stat-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--blue-400);
}

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

/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  width: 100%;
}

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

.btn-primary {
  background: var(--gradient-accent);
  color: white;
  box-shadow: var(--shadow-btn);
}

.btn-primary:hover {
  box-shadow: 0 6px 24px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
  background: rgba(59, 130, 246, 0.12);
  color: var(--blue-400);
  border: 1px solid var(--border-color);
}

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

.btn-sm {
  padding: 8px 16px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 16px 32px;
  font-size: 16px;
  border-radius: var(--radius-lg);
}

/* ── Quick Actions ── */

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

.quick-action {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
}

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

.quick-action-icon {
  font-size: 28px;
  margin-bottom: 6px;
}

.quick-action-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ── Match Card ── */

.match-card {
  padding: 14px;
}

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

.match-team {
  flex: 1;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
}

.match-vs {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  padding: 0 8px;
}

.match-time {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.match-odds {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.odds-btn {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
}

.odds-btn:hover, .odds-btn.selected {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--blue-500);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.2);
}

.odds-label {
  font-size: 10px;
  color: var(--text-muted);
  display: block;
}

.odds-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--blue-400);
  display: block;
  margin-top: 2px;
}

/* ── Casino / Slots ── */

.slots-display {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 24px 0;
}

.slot-reel {
  width: 72px;
  height: 72px;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  transition: all 0.3s ease;
}

.slot-reel.spinning {
  animation: spin 0.3s linear infinite;
}

.slot-reel.won {
  border-color: var(--green-400);
  box-shadow: 0 0 16px rgba(74, 222, 128, 0.3);
}

.casino-bet-input {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
}

.casino-bet-input input {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}

.casino-bet-input input:focus {
  border-color: var(--blue-500);
}

/* ── Schedule ── */

.schedule-day-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 12px;
  scrollbar-width: none;
}

.schedule-day-tabs::-webkit-scrollbar { display: none; }

.day-tab {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}

.day-tab.active {
  background: var(--gradient-accent);
  color: white;
  border-color: transparent;
}

.lesson-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(59, 130, 246, 0.06);
}

.lesson-item:last-child {
  border-bottom: none;
}

.lesson-number {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(59, 130, 246, 0.1);
  color: var(--blue-400);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.lesson-info {
  flex: 1;
}

.lesson-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}

.lesson-time {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Chat ── */

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 72px;
  min-height: 50vh;
}

.chat-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.4;
  animation: slideUp 0.2s ease;
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--gradient-accent);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-bubble.bot {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.chat-input-bar {
  position: fixed;
  bottom: var(--nav-height);
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-nav);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
}

.chat-input-bar input {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 10px 16px;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  outline: none;
}

.chat-input-bar input:focus {
  border-color: var(--blue-500);
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--gradient-accent);
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}

.chat-send-btn:active {
  transform: scale(0.9);
}

/* ── League List ── */

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

.league-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
  color: var(--text-primary);
}

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

.league-icon {
  font-size: 24px;
}

.league-name {
  font-size: 14px;
  font-weight: 600;
}

.league-arrow {
  margin-left: auto;
  color: var(--text-muted);
}

/* ── Bet Slip ── */

.bet-slip {
  position: fixed;
  bottom: var(--nav-height);
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: 480px;
  background: var(--bg-nav);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-glow);
  padding: 16px;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 50;
}

.bet-slip.visible {
  transform: translateX(-50%) translateY(0);
}

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

.bet-input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  outline: none;
  margin-bottom: 10px;
}

.bet-input:focus {
  border-color: var(--blue-500);
}

/* ── Loading skeleton ── */

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

.skeleton-line {
  height: 14px;
  margin-bottom: 8px;
  border-radius: 4px;
}

.skeleton-circle {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  margin: 0 auto 12px;
}

/* ── Section header ── */

.section-header {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  padding-left: 4px;
}

/* ── Badge ── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}

.badge-green {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green-400);
}

.badge-red {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red-400);
}

.badge-blue {
  background: rgba(59, 130, 246, 0.15);
  color: var(--blue-400);
}

/* ── Result popup ── */

.result-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.2s ease;
}

.result-popup {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-xl);
  padding: 32px 24px;
  text-align: center;
  max-width: 320px;
  width: 90%;
  animation: slideUp 0.3s ease;
}

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

.result-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 8px;
}

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

/* ── Empty state ── */

.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
}

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

.empty-state-text {
  font-size: 14px;
  line-height: 1.5;
}

/* ── FurTok Feed ── */

.furtok-wrapper {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: calc(100vh - var(--nav-height));
  overflow: hidden;
  z-index: 10;
}

.furtok-feed {
  height: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}

.furtok-feed::-webkit-scrollbar { display: none; }

.furtok-card {
  height: 100%;
  scroll-snap-align: start;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}

.furtok-card video,
.furtok-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.furtok-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  pointer-events: none;
}

.furtok-stats {
  display: flex;
  gap: 16px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
}

.furtok-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(rgba(0,0,0,0.5), transparent);
  z-index: 5;
}

.furtok-title {
  font-size: 18px;
  font-weight: 800;
  color: white;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.furtok-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.8);
}

.furtok-toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 40px;
  height: 22px;
  background: rgba(255,255,255,0.2);
  border-radius: 11px;
  position: relative;
  cursor: pointer;
  transition: background 0.3s;
}

.furtok-toggle input[type="checkbox"]::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s;
}

.furtok-toggle input[type="checkbox"]:checked {
  background: var(--green-500);
}

.furtok-toggle input[type="checkbox"]:checked::after {
  transform: translateX(18px);
}

.furtok-loader {
  height: 100%;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 14px;
}
