@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@300;400;500&family=Playfair+Display:ital,wght@0,600;1,500&display=swap');

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  /* Palette */
  --deep:          #06101f;
  --surface:       #0c1a2e;
  --surface-2:     #112240;
  --surface-3:     #172d4d;
  --border:        rgba(255,255,255,0.07);
  --border-strong: rgba(255,255,255,0.12);

  /* Amber brand */
  --amber:         #d4900f;
  --amber-light:   #f0c040;
  --amber-glow:    rgba(212,144,15,0.18);
  --amber-subtle:  rgba(212,144,15,0.08);

  /* Accent blue */
  --accent:        #5ba4e8;
  --accent-dim:    rgba(91,164,232,0.15);

  /* Semantic */
  --green:         #34d98b;
  --red:           #f05c5c;

  /* Code */
  --code-bg:       #070f1c;
  --code-border:   rgba(91,164,232,0.15);

  /* Text */
  --text-primary:  #e2edf8;
  --text-secondary:#8aabcc;
  --text-muted:    #4a6580;

  /* Spacing */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  20px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:  0 8px 40px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 30px rgba(212,144,15,0.12);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--deep);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ============================================================
   HEADER
   ============================================================ */
header {
  background: linear-gradient(160deg, #0b1d38 0%, #0c1a2e 60%, #07101e 100%);
  border-bottom: 1px solid var(--border-strong);
  padding: 2.5rem 3rem;
  position: relative;
  overflow: hidden;
}

/* Radial glow top-right */
header::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 420px; height: 420px;
  background: radial-gradient(circle, rgba(212,144,15,0.10) 0%, transparent 68%);
  pointer-events: none;
}

/* Subtle grid texture */
header::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.header-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

.glass-icon {
  font-size: 3.2rem;
  display: inline-block;
  filter: drop-shadow(0 0 12px rgba(212,144,15,0.5));
  animation: float 5s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%       { transform: translateY(-10px) rotate(2deg); }
}

header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2.3rem;
  font-weight: 600;
  color: var(--amber-light);
  letter-spacing: -0.3px;
  text-shadow: 0 2px 20px rgba(212,144,15,0.25);
  line-height: 1.15;
}

header p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin-top: 0.35rem;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.8rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(212,144,15,0.12);
  border: 1px solid rgba(212,144,15,0.35);
  color: var(--amber-light);
  padding: 0.25rem 0.75rem;
  border-radius: 30px;
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: background 0.2s, border-color 0.2s;
}

.badge:hover {
  background: rgba(212,144,15,0.22);
  border-color: rgba(212,144,15,0.55);
}

/* ============================================================
   LAYOUT
   ============================================================ */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2.5rem 2.5rem;
}

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--border-strong);
  padding-bottom: 0;
  flex-wrap: wrap;
  position: relative;
}

.tab {
  padding: 0.65rem 1.3rem;
  cursor: pointer;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid transparent;
  border-bottom: none;
  transition: color 0.2s, background 0.2s;
  background: transparent;
  position: relative;
  bottom: -1px;
  user-select: none;
  letter-spacing: 0.01em;
}

.tab:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.04);
}

.tab.active {
  color: var(--amber-light);
  background: var(--surface);
  border-color: var(--border-strong);
  border-bottom-color: var(--surface);
}

.tab-content { display: none; }
.tab-content.active {
  display: block;
  animation: fadeUp 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

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

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

/* Accent bar */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: linear-gradient(to bottom, var(--amber), transparent);
  border-radius: 0;
}

/* Top-right ambient glow */
.card::after {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 150px; height: 150px;
  background: radial-gradient(circle, var(--amber-subtle) 0%, transparent 70%);
  pointer-events: none;
}

.card h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--amber-light);
  margin-bottom: 0.9rem;
  line-height: 1.3;
}

.card h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #90b8d8;
  margin: 1.2rem 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card p, .card li {
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--text-secondary);
}

.card ul { padding-left: 1.3rem; }
.card li { margin-bottom: 0.35rem; }

/* ============================================================
   CODE BLOCKS
   ============================================================ */
.code-block {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin: 1.1rem 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.81rem;
  line-height: 1.85;
  overflow-x: auto;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.code-block::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 60%);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  opacity: 0.6;
}

.code-block .copy-btn {
  position: absolute;
  top: 0.6rem; right: 0.6rem;
  background: rgba(91,164,232,0.1);
  border: 1px solid rgba(91,164,232,0.25);
  color: var(--accent);
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.72rem;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
  letter-spacing: 0.01em;
}

.code-block .copy-btn:hover {
  background: rgba(91,164,232,0.22);
  border-color: rgba(91,164,232,0.45);
  transform: translateY(-1px);
}

.code-block .copy-btn:active { transform: translateY(0); }

/* Syntax tokens */
.kw  { color: #c792ea; font-weight: 500; }  /* keywords */
.ty  { color: #82aaff; }                      /* types */
.st  { color: #c3e88d; }                      /* strings */
.cm  { color: #3d5a72; font-style: italic; }  /* comments */
.fn  { color: #82cffd; }                      /* functions */
.nb  { color: #f78c6c; }                      /* numbers */
.op  { color: #89ddff; }                      /* operators */
.id  { color: #eeffff; }                      /* identifiers */
.sq  { color: #ffcb6b; font-weight: 500; }    /* SQL keywords */
.col { color: #89ddff; }                      /* SQL columns */

.lang-label {
  display: inline-block;
  font-size: 0.67rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  background: rgba(255,255,255,0.04);
  border-radius: 4px;
}

/* ============================================================
   SCHEMA DIAGRAM
   ============================================================ */
.schema-diagram {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.schema-table {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(91,164,232,0.2);
  border-radius: var(--radius-sm);
  min-width: 185px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.schema-table:hover {
  border-color: rgba(91,164,232,0.45);
  box-shadow: 0 0 0 3px rgba(91,164,232,0.06);
}

.schema-table .table-header {
  background: linear-gradient(135deg, rgba(212,144,15,0.2), rgba(212,144,15,0.1));
  padding: 0.55rem 0.9rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--amber-light);
  font-weight: 500;
  border-bottom: 1px solid rgba(91,164,232,0.15);
  letter-spacing: 0.02em;
}

.schema-table .col-row {
  padding: 0.32rem 0.9rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.73rem;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255,255,255,0.03);
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.schema-table .col-row:last-child { border-bottom: none; }
.pk  { color: var(--amber); font-weight: 600; }
.fk  { color: var(--accent); }
.col-type { color: var(--text-muted); font-size: 0.68rem; margin-left: auto; }

/* ============================================================
   QUIZ
   ============================================================ */
.quiz-q {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.3rem 1.5rem;
  margin-bottom: 1.1rem;
  transition: border-color 0.2s;
}

.quiz-q:hover { border-color: var(--border-strong); }

.quiz-q p {
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 0.9rem;
  font-size: 0.9rem;
  line-height: 1.55;
}

.quiz-opts { display: flex; flex-direction: column; gap: 0.45rem; }

.quiz-opt {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: all 0.18s;
  text-align: left;
  font-family: 'Inter', sans-serif;
}

.quiz-opt:hover {
  border-color: rgba(91,164,232,0.4);
  color: var(--text-primary);
  background: rgba(91,164,232,0.05);
  transform: translateX(3px);
}

.quiz-opt.correct {
  background: rgba(52,217,139,0.08);
  border-color: var(--green);
  color: var(--green);
}

.quiz-opt.wrong {
  background: rgba(240,92,92,0.08);
  border-color: var(--red);
  color: var(--red);
}

.quiz-expl {
  display: none;
  margin-top: 0.9rem;
  padding: 0.9rem 1rem;
  background: rgba(91,164,232,0.06);
  border: 1px solid rgba(91,164,232,0.18);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.quiz-expl.show { display: block; animation: fadeUp 0.25s ease; }

/* Score panel */
.score-panel {
  background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

/* ============================================================
   ARCHITECTURE DIAGRAM
   ============================================================ */
.arch-diagram {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 1rem 0;
}

.arch-layer {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.2s;
  cursor: pointer;
}

.arch-layer:hover {
  border-color: rgba(212,144,15,0.35);
  background: rgba(212,144,15,0.04);
  transform: translateX(4px);
}

.arch-layer.ui  { border-left: 3px solid #c792ea; }
.arch-layer.bll { border-left: 3px solid var(--amber); }
.arch-layer.dal { border-left: 3px solid var(--accent); }
.arch-layer.db  { border-left: 3px solid var(--green); }

.layer-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--text-primary);
  min-width: 185px;
  font-weight: 500;
}

.layer-desc { font-size: 0.81rem; color: var(--text-secondary); flex: 1; }
.layer-tech {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: auto;
  white-space: nowrap;
}

.arch-arrow {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.1rem 0;
}

/* ============================================================
   TIPS
   ============================================================ */
.tip {
  background: rgba(212,144,15,0.07);
  border: 1px solid rgba(212,144,15,0.22);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.1rem;
  margin: 0.9rem 0;
  font-size: 0.85rem;
  color: #c8a050;
  line-height: 1.65;
}

.tip::before { content: '💡 '; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-bar {
  background: rgba(255,255,255,0.05);
  border-radius: 20px;
  height: 5px;
  margin: 0.6rem 0;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 20px;
  background: linear-gradient(90deg, var(--amber), var(--amber-light));
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 8px rgba(212,144,15,0.4);
}

/* ============================================================
   GRID
   ============================================================ */
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
}

@media (max-width: 768px) {
  .grid2 { grid-template-columns: 1fr; }
  .container { padding: 1.5rem 1.25rem; }
  header { padding: 1.75rem 1.5rem; }
  header h1 { font-size: 1.7rem; }
  .tabs { gap: 0.2rem; }
  .tab { padding: 0.55rem 0.9rem; font-size: 0.8rem; }
}

/* ============================================================
   CHIPS / CHEATSHEET TAGS
   ============================================================ */
.chip {
  display: inline-block;
  background: rgba(91,164,232,0.1);
  border: 1px solid rgba(91,164,232,0.22);
  border-radius: var(--radius-sm);
  padding: 0.12rem 0.55rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--accent);
  margin: 0.18rem;
  transition: background 0.2s;
}

.chip:hover {
  background: rgba(91,164,232,0.2);
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--code-bg); }
::-webkit-scrollbar-thumb {
  background: rgba(212,144,15,0.3);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(212,144,15,0.5); }

/* ============================================================
   SELECTION
   ============================================================ */
::selection {
  background: rgba(212,144,15,0.25);
  color: var(--text-primary);
}
