/* =============================================
   PREMIUM.CSS — Design Upgrade Layer
   Skills: Emil Kowalski + Taste + Impeccable Design
   Strategy: CSS-only overlay — ZERO JS changes
   ============================================= */

/* === SKILL 3: IMPECCABLE DESIGN — Foundation === */

/* Never pure black. Tinted dark navy base */
:root {
  --bg-base: #080c18;
  --bg-card: #0d1221;
  --bg-card-hover: #111729;
  --bg-elevated: #151b2e;
  --bg-input: #0f1525;
  --text-primary: rgba(236, 240, 252, 0.92);
  --text-secondary: rgba(180, 195, 220, 0.72);
  --text-muted: rgba(140, 160, 190, 0.5);
  --border-subtle: rgba(100, 120, 180, 0.08);
  --border-hover: rgba(100, 120, 180, 0.15);
  --glow-accent: rgba(124, 106, 239, 0.06);
  /* 8px grid system */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  /* Modular type scale (1.25 ratio) */
  --text-xs: 0.72rem;
  --text-sm: 0.82rem;
  --text-base: 0.94rem;
  --text-lg: 1.1rem;
  --text-xl: 1.32rem;
  --text-2xl: 1.6rem;
  /* Emil Kowalski custom easing */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* === Body & Global === */
body {
  background: var(--bg-base) !important;
  color: var(--text-primary) !important;
  line-height: 1.72 !important; /* Dark mode +0.05 */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* === SKILL 2: TASTE — Content Width & Breathing Room === */
#study-content, #exam-content, #tricky-content, 
#compare-content, #howto-content, #resources-content,
#codelab-content, #revision-content {
  max-width: 820px;
  margin: 0 auto;
  padding: var(--space-5) var(--space-4);
}

/* === HEADER — Cleaner hierarchy === */
header {
  background: linear-gradient(180deg, rgba(13, 18, 33, 0.98) 0%, var(--bg-base) 100%) !important;
  border-bottom: 1px solid var(--border-subtle) !important;
  padding: var(--space-4) var(--space-5) !important;
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

header h1 {
  font-size: var(--text-xl) !important;
  font-weight: 600 !important;
  letter-spacing: -0.02em !important;
}

header p {
  font-size: var(--text-xs) !important;
  color: var(--text-muted) !important;
  letter-spacing: 0.02em;
}

/* === NAV — Emil Kowalski snappy tabs === */
nav {
  border-bottom: 1px solid var(--border-subtle) !important;
  gap: var(--space-1) !important;
  padding: var(--space-2) var(--space-5) !important;
  background: var(--bg-base) !important;
  position: sticky;
  top: 56px;
  z-index: 99;
}

nav button {
  font-size: var(--text-sm) !important;
  padding: var(--space-2) var(--space-4) !important;
  border-radius: 8px !important;
  border: none !important;
  background: transparent !important;
  color: var(--text-secondary) !important;
  font-weight: 500 !important;
  position: relative;
  transition: color 180ms var(--ease-out-expo),
              background 180ms var(--ease-out-expo),
              transform 120ms var(--ease-out-expo) !important;
  will-change: transform;
}

nav button:hover {
  color: var(--text-primary) !important;
  background: var(--bg-elevated) !important;
}

/* Emil Kowalski: active press feedback */
nav button:active {
  transform: scale(0.97) !important;
}

nav button.active {
  background: var(--accent) !important;
  color: #fff !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 12px rgba(124, 106, 239, 0.25) !important;
}

/* === CARDS — Elevation over borders === */
.card, .tricky-card, .code-lab-card {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: 14px !important;
  padding: var(--space-5) !important;
  margin-bottom: var(--space-4) !important;
  transition: border-color 200ms var(--ease-out-expo),
              box-shadow 200ms var(--ease-out-expo),
              transform 200ms var(--ease-out-expo) !important;
  will-change: transform;
  /* Emil Kowalski: enter from scale(0.98) */
  animation: cardEnter 350ms var(--ease-out-quint) both;
}

.card:hover, .tricky-card:hover, .code-lab-card:hover {
  border-color: var(--border-hover) !important;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15),
              0 0 0 1px var(--border-hover) !important;
  transform: translateY(-1px);
}

/* Card entrance animation - Emil Kowalski style */
@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.985);
    filter: blur(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* Staggered card entrance */
.card:nth-child(1) { animation-delay: 0ms; }
.card:nth-child(2) { animation-delay: 40ms; }
.card:nth-child(3) { animation-delay: 80ms; }
.card:nth-child(4) { animation-delay: 120ms; }
.card:nth-child(5) { animation-delay: 160ms; }
.card:nth-child(6) { animation-delay: 200ms; }
.card:nth-child(7) { animation-delay: 240ms; }
.card:nth-child(8) { animation-delay: 280ms; }

/* === TYPOGRAPHY — Modular scale === */
.card h2 {
  font-size: var(--text-lg) !important;
  font-weight: 650 !important;
  letter-spacing: -0.015em !important;
  line-height: 1.35 !important;
  margin-bottom: var(--space-4) !important;
}

.card ul {
  padding-left: var(--space-5) !important;
}

.card li {
  font-size: var(--text-sm) !important;
  line-height: 1.75 !important;
  color: var(--text-primary) !important;
  margin-bottom: var(--space-2) !important;
}

/* === TOPIC BUTTONS — Taste: clean pills === */
.topic-btn {
  font-size: var(--text-xs) !important;
  padding: 6px 14px !important;
  border-radius: 20px !important;
  border: 1px solid var(--border-subtle) !important;
  background: var(--bg-card) !important;
  color: var(--text-secondary) !important;
  transition: all 180ms var(--ease-out-expo) !important;
  font-weight: 500 !important;
}

.topic-btn:hover {
  border-color: var(--border-hover) !important;
  background: var(--bg-elevated) !important;
  color: var(--text-primary) !important;
}

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

.topic-btn.active {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: white !important;
  box-shadow: 0 2px 8px rgba(124, 106, 239, 0.2) !important;
}

/* === EXAM OPTIONS — Premium radio buttons === */
.opt-btn {
  background: var(--bg-input) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: 10px !important;
  padding: var(--space-3) var(--space-4) !important;
  font-size: var(--text-sm) !important;
  color: var(--text-primary) !important;
  transition: border-color 150ms var(--ease-out-expo),
              background 150ms var(--ease-out-expo),
              transform 120ms var(--ease-out-expo) !important;
  cursor: pointer;
}

.opt-btn:hover {
  border-color: rgba(124, 106, 239, 0.3) !important;
  background: var(--bg-elevated) !important;
}

.opt-btn:active {
  transform: scale(0.985);
}

/* Correct/Wrong answers — refined colors */
.opt-btn.correct {
  background: rgba(16, 185, 129, 0.1) !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
}

.opt-btn.wrong {
  background: rgba(244, 63, 94, 0.08) !important;
  border-color: rgba(244, 63, 94, 0.3) !important;
}

/* === CODE BLOCKS — Impeccable dark code === */
.code-block {
  background: #060a14 !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: 12px !important;
  padding: var(--space-5) !important;
  font-size: var(--text-xs) !important;
  line-height: 1.85 !important;
  transition: border-color 200ms var(--ease-out-expo) !important;
}

.code-block:hover {
  border-color: rgba(124, 106, 239, 0.2) !important;
}

/* === REAL-LIFE BOXES — Subtle, not loud === */
.real-life, .real-life-box > div:first-child {
  background: rgba(14, 165, 233, 0.04) !important;
  border-left: 2px solid rgba(14, 165, 233, 0.4) !important;
  border-radius: 0 10px 10px 0 !important;
  padding: var(--space-3) var(--space-4) !important;
  font-size: var(--text-sm) !important;
  line-height: 1.75 !important;
}

/* === COMPARISON TABLES — Elevated === */
.cmp-table {
  border-radius: 10px !important;
  overflow: hidden !important;
  border: 1px solid var(--border-subtle) !important;
}

.cmp-table th {
  background: var(--bg-elevated) !important;
  font-size: var(--text-xs) !important;
  font-weight: 600 !important;
  letter-spacing: 0.04em !important;
  padding: var(--space-3) var(--space-4) !important;
  border-bottom: 1px solid var(--border-subtle) !important;
}

.cmp-table td {
  font-size: var(--text-sm) !important;
  padding: var(--space-3) var(--space-4) !important;
  border-bottom: 1px solid rgba(100, 120, 180, 0.04) !important;
  color: var(--text-primary) !important;
}

.cmp-table tr:hover td {
  background: rgba(124, 106, 239, 0.03) !important;
}

/* === BOOKMARK STAR — Smooth toggle === */
.bookmark-star {
  transition: transform 200ms var(--ease-spring),
              color 200ms var(--ease-out-expo) !important;
}

.bookmark-star:hover {
  transform: scale(1.15);
}

.bookmark-star:active {
  transform: scale(0.9);
}

/* === TRICKY CARDS — Refined trap/correct colors === */
.trap {
  background: rgba(244, 63, 94, 0.05) !important;
  border: 1px solid rgba(244, 63, 94, 0.15) !important;
  border-radius: 10px !important;
  padding: var(--space-3) var(--space-4) !important;
  font-size: var(--text-sm) !important;
}

.correct-way {
  background: rgba(16, 185, 129, 0.05) !important;
  border: 1px solid rgba(16, 185, 129, 0.15) !important;
  border-radius: 10px !important;
  padding: var(--space-3) var(--space-4) !important;
  font-size: var(--text-sm) !important;
  line-height: 1.75 !important;
}

/* === SCROLL BAR — Premium thin === */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(124, 106, 239, 0.15);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(124, 106, 239, 0.3);
}

/* === OUTPUT BLOCKS === */
.output {
  background: rgba(16, 185, 129, 0.04) !important;
  border: 1px solid rgba(16, 185, 129, 0.1) !important;
  border-radius: 10px !important;
  padding: var(--space-3) var(--space-4) !important;
  margin-top: var(--space-3) !important;
}

/* === KEY BADGES — Refined === */
.key {
  font-size: var(--text-xs) !important;
  padding: 2px 8px !important;
  border-radius: 6px !important;
  font-weight: 600 !important;
}

/* === ACCESSIBILITY — Emil Kowalski === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* === RESPONSIVE — Mobile adjustments === */
@media (max-width: 768px) {
  nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: var(--space-2) var(--space-3) !important;
    flex-wrap: nowrap !important;
  }
  
  nav button {
    white-space: nowrap;
    font-size: var(--text-xs) !important;
    padding: 6px 10px !important;
  }

  #study-content, #exam-content, #tricky-content,
  #compare-content, #howto-content, #resources-content,
  #codelab-content, #revision-content {
    padding: var(--space-3) var(--space-3);
  }

  .card, .tricky-card, .code-lab-card {
    padding: var(--space-4) !important;
    border-radius: 12px !important;
  }
  
  header h1 {
    font-size: var(--text-lg) !important;
  }
}

/* === Focus states for keyboard navigation === */
button:focus-visible, .opt-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* === Smooth page-level transitions === */
.mode { 
  animation: modeEnter 280ms var(--ease-out-quint) both;
}

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