/* ═══════════════════════════════════════════════════
   BitDay Global Design System
   https://btcday.in
   ═══════════════════════════════════════════════════ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── CSS Custom Properties ── */
:root {
  /* Backgrounds */
  --bg-primary: #050508;
  --bg-secondary: #0d0d14;
  --bg-card: #12121c;
  --bg-card-hover: #1a1a28;
  --bg-elevated: #16162a;
  --bg-overlay: rgba(5, 5, 8, 0.85);
  --bg-ticker: #08080f;

  /* Borders */
  --border: #1e1e30;
  --border-light: #2a2a40;
  --border-glow: rgba(247, 147, 26, 0.3);

  /* Brand Colors */
  --orange: #f7931a;
  --orange-light: #ffab40;
  --orange-dark: #e07c00;
  --orange-dim: rgba(247, 147, 26, 0.1);
  --orange-glow: 0 0 20px rgba(247, 147, 26, 0.3);
  --orange-glow-lg: 0 0 40px rgba(247, 147, 26, 0.2), 0 0 80px rgba(247, 147, 26, 0.1);

  /* Accent Colors */
  --blue: #3b82f6;
  --blue-dim: rgba(59, 130, 246, 0.1);
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.1);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.1);
  --purple: #a855f7;
  --purple-dim: rgba(168, 85, 247, 0.1);
  --cyan: #06b6d4;
  --yellow: #eab308;

  /* Text */
  --text: #f1f1f1;
  --text-secondary: #c4c4cc;
  --text-muted: #6b7280;
  --text-dim: #374151;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 96px;

  /* Border Radius */
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 16px 60px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 30px rgba(247, 147, 26, 0.15);

  /* Transitions */
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Z-index scale */
  --z-ticker: 100;
  --z-navbar: 200;
  --z-dropdown: 300;
  --z-modal: 400;
  --z-overlay: 500;
  --z-toast: 600;
  --z-tooltip: 700;

  /* Layout */
  --navbar-h: 64px;
  --ticker-h: 40px;
  --container-max: 1280px;
  --sidebar-w: 280px;
}

/* ── Light Mode ── */
[data-theme="light"] {
  --bg-primary: #f8f9fc;
  --bg-secondary: #eef0f5;
  --bg-card: #ffffff;
  --bg-card-hover: #f3f4f8;
  --bg-elevated: #ffffff;
  --bg-overlay: rgba(248, 249, 252, 0.9);
  --bg-ticker: #ffffff;
  --border: #e2e4ea;
  --border-light: #d1d5db;
  --text: #111827;
  --text-secondary: #374151;
  --text-muted: #6b7280;
  --text-dim: #9ca3af;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
}

/* ── Reset & Base ── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Skip to main */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--orange);
  color: #fff;
  padding: 8px 24px;
  border-radius: var(--radius);
  z-index: 9999;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
}
.skip-link:focus {
  top: 8px;
}

/* ── Custom Scrollbar ── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) var(--bg-secondary);
}

/* ── Selection ── */
::selection {
  background: var(--orange);
  color: #fff;
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.5rem); }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.75rem); }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

p {
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 80ch;
}

a {
  color: var(--orange);
  text-decoration: none;
  transition: var(--transition);
}
a:hover {
  color: var(--orange-light);
}

strong { font-weight: 700; }
code, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}
code {
  background: var(--orange-dim);
  color: var(--orange);
  padding: 2px 6px;
  border-radius: 4px;
}

img, video {
  max-width: 100%;
  display: block;
}

button {
  cursor: pointer;
  font-family: var(--font-sans);
}

ul, ol {
  list-style: none;
}

/* ── Container ── */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container-wide {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* ── Grid System ── */
.grid {
  display: grid;
  gap: var(--space-lg);
}

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-lg); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-lg); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-lg); }
.grid-6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--space-lg); }

/* ── Flexbox Utilities ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

/* ── Spacing Utilities ── */
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }
.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }

/* ── Text Utilities ── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-muted { color: var(--text-muted); }
.text-orange { color: var(--orange); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-blue { color: var(--blue); }
.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.uppercase { text-transform: uppercase; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Glassmorphism ── */
.glass {
  background: rgba(18, 18, 28, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
}

[data-theme="light"] .glass {
  background: rgba(255, 255, 255, 0.7);
}

.glass-strong {
  background: rgba(18, 18, 28, 0.85);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid var(--border);
}

/* ── Section ── */
.section {
  padding: var(--space-4xl) 0;
}
.section-sm {
  padding: var(--space-2xl) 0;
}

.section-title {
  text-align: center;
  margin-bottom: var(--space-2xl);
}
.section-title h2 {
  margin-bottom: var(--space-sm);
}
.section-title p {
  margin: 0 auto;
  color: var(--text-muted);
}

/* ── Visibility ── */
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Focus Styles ── */
:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

/* ── Responsive ── */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-6 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  :root {
    --navbar-h: 56px;
  }

  .container { padding: 0 var(--space-md); }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
  .grid-6 { grid-template-columns: repeat(2, 1fr); }

  .section { padding: var(--space-2xl) 0; }

  .hide-mobile { display: none !important; }
}

@media (max-width: 480px) {
  .grid-6 { grid-template-columns: 1fr; }
}

@media (min-width: 769px) {
  .hide-desktop { display: none !important; }
}

/* ── Page wrapper (accounts for ticker + navbar) ── */
.page-wrapper {
  padding-top: calc(var(--ticker-h) + var(--navbar-h));
  min-height: 100vh;
}

/* ═══════════════════════════════════════════════════
   COMPREHENSIVE RESPONSIVE DESIGN
   Mobile-first, all-device compatible
   ═══════════════════════════════════════════════════ */

/* ── Tablet Landscape (1024px) ── */
@media (max-width: 1024px) {
  /* Dashboard stats grid → 2 cols */
  .stats-grid,
  .dashboard-stats { grid-template-columns: repeat(2, 1fr); }

  /* Portfolio grid → single col */
  .portfolio-grid { grid-template-columns: 1fr; }

  /* Add coin form → 2 cols */
  .add-form { grid-template-columns: 1fr 1fr; }

  /* Portfolio summary → 2 cols */
  .portfolio-summary { grid-template-columns: repeat(2, 1fr); }

  /* News grid → 2 cols */
  .news-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ── Tablet Portrait (768px) ── */
@media (max-width: 768px) {
  :root {
    --space-2xl: 32px;
    --space-3xl: 48px;
    --space-4xl: 64px;
  }

  h1 { font-size: clamp(1.6rem, 5vw, 2.5rem); }
  h2 { font-size: clamp(1.3rem, 4vw, 2rem); }

  /* Dashboard → 1 col */
  .stats-grid,
  .dashboard-stats,
  .portfolio-summary { grid-template-columns: 1fr; }

  /* News grid → 1 col */
  .news-grid { grid-template-columns: 1fr !important; }

  /* News hero */
  .news-hero-card { height: 250px !important; }
  .news-hero-card .hero-content h2 { font-size: 1.2rem !important; }

  /* Portfolio */
  .add-form { grid-template-columns: 1fr; }
  .portfolio-table { font-size: 0.8rem; }
  .portfolio-table th,
  .portfolio-table td { padding: 8px 10px; }

  /* Earn */
  .quiz-options { grid-template-columns: 1fr !important; }
  .predict-buttons { grid-template-columns: 1fr !important; }
  .predict-price { font-size: 2rem !important; }
  .dashboard-earnings { grid-template-columns: 1fr !important; }
  .earn-hero .live-counter { font-size: 1.5rem !important; }

  /* Learn */
  .module-header h2 { font-size: 1rem !important; }
  .module-progress-bar { width: 80px !important; }

  /* Chat sidebars */
  .chat-layout { grid-template-columns: 1fr !important; }
  .chat-sidebar,
  .chat-sidebar-right { display: none !important; }

  /* Countdown */
  .countdown-value {
    width: 52px !important;
    height: 52px !important;
    font-size: 1.4rem !important;
  }
  .countdown-lg .countdown-value {
    width: 60px !important;
    height: 60px !important;
    font-size: 1.6rem !important;
  }

  /* Btcday steps */
  .step-item { flex-direction: column; gap: 12px; align-items: flex-start; }

  /* Modals */
  .modal { max-width: 95vw; max-height: 90vh; }
  .modal-header { padding: var(--space-md); }
  .modal-body { padding: var(--space-md); }

  /* Buttons */
  .btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
  }

  /* Hero buttons → stack */
  .hero-buttons {
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
  }
  .hero-buttons .btn { width: 100%; max-width: 320px; }

  /* Spin wheel → smaller */
  .wheel-container {
    width: 260px !important;
    height: 260px !important;
  }
}

/* ── Mobile (480px) ── */
@media (max-width: 480px) {
  :root {
    --ticker-h: 32px;
    --space-lg: 16px;
    --space-xl: 24px;
    --space-2xl: 24px;
  }

  body { font-size: 15px; }

  .container { padding: 0 var(--space-sm); }

  /* Ticker smaller */
  .ticker-item { padding: 0 14px; font-size: 11px; }

  /* Hero */
  .hero-sub { font-size: 0.9rem !important; }

  /* Earn */
  .earn-hero .live-counter { font-size: 1.3rem !important; }
  .activity-header { flex-direction: column; align-items: flex-start; }
  .activity-header h2 { font-size: 1.1rem !important; }
  .predict-btn { padding: 16px !important; font-size: 1.1rem !important; }

  /* Spin wheel → even smaller */
  .wheel-container {
    width: 220px !important;
    height: 220px !important;
  }
  .wheel-center {
    width: 46px !important;
    height: 46px !important;
    font-size: 1.2rem !important;
  }

  /* Watch player */
  .watch-screen { height: 200px !important; }

  /* Check-in calendar → smaller */
  .checkin-calendar { max-width: 100% !important; }
  .cal-day { font-size: 0.65rem !important; }

  /* Referral link */
  .referral-link { flex-direction: column; }
  .referral-link input { width: 100%; }

  /* Portfolio */
  .portfolio-table-wrap { margin: 0 calc(-1 * var(--space-sm)); }
  .pie-chart-container {
    width: 220px !important;
    height: 220px !important;
  }

  /* News */
  .news-hero-card { height: 200px !important; }
  .news-hero-card .hero-content { padding: var(--space-md) !important; }
  .news-hero-card .hero-content h2 { font-size: 1rem !important; }

  /* Stats */
  .stat-card .stat-value { font-size: 1.2rem; }
  .stat-card { padding: var(--space-md); }

  /* Countdown */
  .countdown { gap: 8px; }
  .countdown-value {
    width: 44px !important;
    height: 44px !important;
    font-size: 1.2rem !important;
  }
  .countdown-lg .countdown-value {
    width: 50px !important;
    height: 50px !important;
    font-size: 1.3rem !important;
  }
  .countdown-label { font-size: 0.6rem !important; }

  /* Btcday steps */
  .step-number {
    width: 36px !important;
    height: 36px !important;
    font-size: 0.85rem !important;
  }

  /* Section spacing */
  .activity-section { padding: var(--space-xl) 0 !important; }

  /* Toast */
  .toast-container { right: 8px; left: 8px; }
  .toast { min-width: auto; max-width: 100%; font-size: 0.85rem; }

  /* Cookie banner */
  .cookie-banner {
    flex-direction: column;
    text-align: center;
    padding: 12px;
  }

  /* Back to top */
  .back-to-top {
    bottom: 16px;
    right: 16px;
    width: 38px;
    height: 38px;
  }

  /* Learn lesson modal */
  .lesson-content { padding: var(--space-md) !important; }
  .lesson-content p { font-size: 0.9rem; }
  .lquiz-option { padding: 10px 12px; font-size: 0.85rem; }
  .key-takeaways { padding: var(--space-sm); }
}

/* ── Small Mobile (360px) ── */
@media (max-width: 360px) {
  .container { padding: 0 8px; }
  .navbar-inner { padding: 0 8px; }
  .navbar-logo { font-size: 1.2rem; }
  .navbar-logo .logo-icon { width: 30px; height: 30px; font-size: 0.95rem; }
  h1 { font-size: 1.4rem; }
  .btn { padding: 10px 20px; font-size: 0.88rem; }
  .btn-lg { padding: 12px 24px; font-size: 0.95rem; }
  .countdown-value {
    width: 38px !important;
    height: 38px !important;
    font-size: 1rem !important;
  }
}

/* ── Touch-friendly Tap Targets ── */
@media (hover: none) and (pointer: coarse) {
  /* Ensure minimum 44px touch targets per WCAG */
  .btn, .pill, .tab, .quiz-option, .predict-btn,
  .lquiz-option, .poll-btn, .nav-link, .accordion-header {
    min-height: 44px;
  }

  /* Disable hover transforms on touch */
  .coin-card:hover,
  .news-card:hover {
    transform: none;
  }

  /* Increase spacing for fat-finger-friendliness */
  .leaderboard-item { padding: 12px 16px; }
  .lesson-item { padding: 14px 16px; }
  .chat-message { padding: 12px 16px; }
}

/* ── iOS safe area padding ── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .footer-bottom {
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }
  .cookie-banner {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
  .ad-container-sticky {
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }
  .chat-input-area {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
}

/* ── Landscape phone ── */
@media (max-height: 500px) and (orientation: landscape) {
  .page-wrapper {
    padding-top: calc(var(--ticker-h) + var(--navbar-h) - 8px);
  }
  .earn-hero { padding: var(--space-lg) 0 !important; }
  .learn-hero { padding: var(--space-lg) 0 var(--space-md) !important; }
}

/* ── Print ── */
@media print {
  .ticker-bar, .navbar, .mobile-menu, .hamburger,
  .ad-container, .ad-container-side, .ad-container-sticky,
  .back-to-top, .cookie-banner, .toast-container,
  .theme-toggle { display: none !important; }

  .page-wrapper { padding-top: 0; }
  body { background: #fff; color: #000; }
  .card, .stat-card { border: 1px solid #ccc; }
  a { color: #000; text-decoration: underline; }
}

