/* EXIN BCS AI Foundation - Exam Traps Cheat Sheet */
/* Print-optimized, 4-page A4 reference card */

/* ============================================
   CSS CUSTOM PROPERTIES (extending shared.css)
   ============================================ */
:root {
  /* Topic colors from shared.css badge system */
  --topic1-bg: #E3F2FD;
  --topic1-fg: #1565C0;
  --topic1-border: #90CAF9;
  --topic2-bg: #FCE4EC;
  --topic2-fg: #C62828;
  --topic2-border: #F48FB1;
  --topic3-bg: #E8F5E9;
  --topic3-fg: #2E7D32;
  --topic3-border: #A5D6A7;
  --topic4-bg: #FFF3E0;
  --topic4-fg: #E65100;
  --topic4-border: #FFCC80;
  --topic5-bg: #F3E5F5;
  --topic5-fg: #6A1B9A;
  --topic5-border: #CE93D8;
  --topic6-bg: #E0F2F1;
  --topic6-fg: #00695C;
  --topic6-border: #80CBC4;

  /* Cheat sheet specific */
  --cs-body-size: 11px;
  --cs-header-height: 44px;
  --cs-col-gap: 16px;
  --cs-section-gap: 10px;
}

[data-theme="dark"] {
  --topic1-bg: #0D1B2E;
  --topic1-fg: #58A6FF;
  --topic1-border: #1E3A5F;
  --topic2-bg: #2D1214;
  --topic2-fg: #F85149;
  --topic2-border: #5C2022;
  --topic3-bg: #0D2818;
  --topic3-fg: #56D364;
  --topic3-border: #1A4028;
  --topic4-bg: #2D1A00;
  --topic4-fg: #F0AB00;
  --topic4-border: #5C3400;
  --topic5-bg: #1E0D2B;
  --topic5-fg: #BC8CF2;
  --topic5-border: #3D1A5C;
  --topic6-bg: #0D2420;
  --topic6-fg: #56D364;
  --topic6-border: #1A4038;
}

/* ============================================
   SCREEN LAYOUT
   ============================================ */
body {
  font-size: var(--cs-body-size);
  line-height: 1.45;
  max-width: 210mm;
  margin: 0 auto;
  padding: 12px;
}

/* Page container */
.print-page {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px 14px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
  position: relative;
}

/* Two-column layout */
.two-col {
  columns: 2;
  column-gap: var(--cs-col-gap);
  column-rule: 1px solid var(--border-color);
}

.two-col > * {
  break-inside: avoid;
}

/* ============================================
   HEADER / FOOTER
   ============================================ */
.cs-header {
  background: var(--navy);
  color: var(--white);
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}

.cs-header h1 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin: 0;
  color: var(--white);
}

.cs-header .subtitle {
  font-size: 10px;
  color: var(--gold);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.cs-header .page-label {
  background: var(--gold);
  color: var(--navy-dark);
  font-size: 9px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.cs-footer {
  text-align: center;
  font-size: 8px;
  color: var(--text-muted);
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
  margin-top: 10px;
}

/* ============================================
   SECTION HEADERS
   ============================================ */
.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  margin: var(--cs-section-gap) 0 6px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-title:first-child {
  margin-top: 0;
}

.section-title.topic1 { background: var(--topic1-bg); color: var(--topic1-fg); border-left: 3px solid var(--topic1-fg); }
.section-title.topic2 { background: var(--topic2-bg); color: var(--topic2-fg); border-left: 3px solid var(--topic2-fg); }
.section-title.topic3 { background: var(--topic3-bg); color: var(--topic3-fg); border-left: 3px solid var(--topic3-fg); }
.section-title.topic4 { background: var(--topic4-bg); color: var(--topic4-fg); border-left: 3px solid var(--topic4-fg); }
.section-title.topic5 { background: var(--topic5-bg); color: var(--topic5-fg); border-left: 3px solid var(--topic5-fg); }
.section-title.topic6 { background: var(--topic6-bg); color: var(--topic6-fg); border-left: 3px solid var(--topic6-fg); }

/* ============================================
   DEFINITION BOXES
   ============================================ */
.def-box {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  margin-bottom: 5px;
  background: var(--bg-secondary);
  break-inside: avoid;
}

.def-box .def-term {
  font-weight: 700;
  font-size: 10px;
  color: var(--accent);
  margin-bottom: 2px;
}

.def-box .def-text {
  font-size: 9.5px;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.35;
}

.def-box .def-source {
  font-size: 8px;
  color: var(--text-muted);
  font-style: normal;
}

/* Color-coded definition boxes */
.def-box.topic1 { border-left: 3px solid var(--topic1-fg); }
.def-box.topic2 { border-left: 3px solid var(--topic2-fg); }
.def-box.topic3 { border-left: 3px solid var(--topic3-fg); }
.def-box.topic4 { border-left: 3px solid var(--topic4-fg); }
.def-box.topic5 { border-left: 3px solid var(--topic5-fg); }
.def-box.topic6 { border-left: 3px solid var(--topic6-fg); }

/* ============================================
   TABLES
   ============================================ */
.cs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9.5px;
  margin-bottom: 8px;
  break-inside: avoid;
}

.cs-table th {
  background: var(--navy);
  color: var(--white);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 6px;
  text-align: left;
}

.cs-table th:first-child {
  border-radius: var(--radius-sm) 0 0 0;
}

.cs-table th:last-child {
  border-radius: 0 var(--radius-sm) 0 0;
}

.cs-table td {
  padding: 3px 6px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
  line-height: 1.35;
}

.cs-table tr:nth-child(even) td {
  background: var(--bg-secondary);
}

.cs-table tr:last-child td {
  border-bottom: none;
}

.cs-table td:first-child {
  font-weight: 600;
  white-space: nowrap;
}

/* Compact table variant */
.cs-table.compact td {
  padding: 2px 5px;
  font-size: 9px;
}

.cs-table.compact th {
  padding: 3px 5px;
  font-size: 8.5px;
}

/* ============================================
   GRID TABLE (for Power/Interest)
   ============================================ */
.quad-grid {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  grid-template-rows: auto auto auto;
  gap: 0;
  font-size: 9px;
  margin-bottom: 8px;
  break-inside: avoid;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.quad-grid .corner {
  background: var(--navy);
  color: var(--white);
  font-weight: 700;
  font-size: 8px;
  padding: 4px;
  text-align: center;
}

.quad-grid .col-header {
  background: var(--navy);
  color: var(--gold);
  font-weight: 600;
  font-size: 8px;
  padding: 4px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.quad-grid .row-header {
  background: var(--navy-light);
  color: var(--white);
  font-weight: 600;
  font-size: 8px;
  padding: 6px 4px;
  text-align: center;
  writing-mode: horizontal-tb;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quad-grid .cell {
  padding: 5px 6px;
  text-align: center;
  font-size: 8.5px;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.3;
}

.quad-grid .cell.highlight {
  background: var(--highlight-bg);
  font-weight: 700;
  color: var(--topic4-fg);
}

.quad-grid .cell.secondary {
  background: var(--bg-secondary);
}

/* ============================================
   LISTS
   ============================================ */
.cs-list {
  list-style: none;
  padding: 0;
  margin: 0 0 8px 0;
}

.cs-list li {
  padding: 1px 0 1px 12px;
  position: relative;
  font-size: 9.5px;
  line-height: 1.4;
}

.cs-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 7px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.cs-list.numbered {
  counter-reset: item;
}

.cs-list.numbered li::before {
  content: counter(item);
  counter-increment: item;
  background: var(--navy);
  color: var(--white);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  font-size: 8px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  top: 2px;
}

.cs-list.numbered li {
  padding-left: 20px;
}

/* Arrow flow list */
.flow-list {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 9px;
}

.flow-list .flow-item {
  background: var(--topic3-bg);
  color: var(--topic3-fg);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 8.5px;
}

.flow-list .flow-arrow {
  color: var(--text-muted);
  font-size: 10px;
  margin: 0 1px;
}

/* ============================================
   TRAP CARDS (Page 4)
   ============================================ */
.trap-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  margin-bottom: 5px;
  background: var(--bg-card);
  break-inside: avoid;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.trap-card .trap-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  background: var(--error-bg);
  color: var(--error);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  margin-top: 1px;
}

.trap-card .trap-content {
  flex: 1;
  min-width: 0;
}

.trap-card .trap-wrong {
  font-size: 9px;
  color: var(--error);
  font-weight: 600;
  text-decoration: line-through;
  line-height: 1.3;
}

.trap-card .trap-right {
  font-size: 9px;
  color: var(--success);
  font-weight: 600;
  line-height: 1.3;
}

.trap-card .trap-note {
  font-size: 8.5px;
  color: var(--text-muted);
  line-height: 1.3;
  margin-top: 1px;
}

/* Trap table alternative */
.trap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9px;
  margin-bottom: 8px;
  break-inside: avoid;
}

.trap-table th {
  background: var(--error-bg);
  color: var(--error);
  font-size: 8.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 6px;
  text-align: left;
  border-bottom: 2px solid var(--error);
}

.trap-table th.right-col {
  background: var(--success-bg);
  color: var(--success);
  border-bottom-color: var(--success);
}

.trap-table th.note-col {
  background: var(--info-bg);
  color: var(--info);
  border-bottom-color: var(--info);
}

.trap-table td {
  padding: 3px 6px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
  line-height: 1.35;
}

.trap-table td.wrong {
  color: var(--error);
  font-weight: 600;
  text-decoration: line-through;
}

.trap-table td.right {
  color: var(--success);
  font-weight: 600;
}

.trap-table tr:nth-child(even) td {
  background: var(--bg-secondary);
}

/* ============================================
   INLINE BADGES
   ============================================ */
.tag {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  vertical-align: middle;
}

.tag-exam {
  background: var(--gold);
  color: var(--navy-dark);
}

.tag-trap {
  background: var(--error-bg);
  color: var(--error);
}

.tag-key {
  background: var(--navy);
  color: var(--white);
}

/* ============================================
   DARK MODE TOGGLE
   ============================================ */
.theme-toggle {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 1000;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: var(--shadow-sm);
}

.theme-toggle:hover {
  background: var(--bg-secondary);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.theme-toggle .toggle-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ============================================
   RESPONSIVE: Single column on mobile
   ============================================ */
@media screen and (max-width: 700px) {
  body {
    padding: 8px;
    font-size: 12px;
  }

  .two-col {
    columns: 1;
    column-rule: none;
  }

  .print-page {
    padding: 12px;
    border-radius: var(--radius-md);
  }

  .cs-header {
    flex-direction: column;
    text-align: center;
    gap: 6px;
  }

  .cs-header h1 {
    font-size: 13px;
  }

  .def-box .def-text {
    font-size: 11px;
  }

  .cs-table,
  .cs-table.compact {
    font-size: 11px;
  }

  .cs-table td,
  .cs-table th {
    padding: 5px 8px;
  }

  .flow-list {
    font-size: 11px;
  }

  .flow-list .flow-item {
    font-size: 10px;
  }

  .trap-card .trap-wrong,
  .trap-card .trap-right,
  .trap-card .trap-note {
    font-size: 11px;
  }

  .quad-grid {
    font-size: 11px;
  }

  .cs-list li {
    font-size: 11px;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  body {
    font-size: 10px;
    line-height: 1.4;
    margin: 0;
    padding: 0;
    max-width: none;
    background: white;
    color: #212529;
  }

  .theme-toggle {
    display: none !important;
  }

  .print-page {
    border: none;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    padding: 10mm 12mm 8mm;
    page-break-after: always;
    page-break-inside: avoid;
    min-height: 270mm;
  }

  .print-page:last-child {
    page-break-after: auto;
  }

  .two-col {
    columns: 2;
    column-gap: 12px;
    column-rule: 1px solid #DEE2E6;
  }

  .cs-header {
    margin-bottom: 8px;
    padding: 6px 14px;
    border-radius: 4px;
  }

  .cs-header h1 {
    font-size: 12px;
  }

  .cs-header .subtitle {
    font-size: 9px;
  }

  .cs-header .page-label {
    font-size: 8px;
    padding: 2px 8px;
  }

  .cs-footer {
    font-size: 7px;
    padding-top: 4px;
    margin-top: 6px;
  }

  .section-title {
    font-size: 10px;
    padding: 3px 6px;
    margin: 6px 0 4px 0;
  }

  .def-box {
    padding: 3px 6px;
    margin-bottom: 3px;
  }

  .def-box .def-term {
    font-size: 9px;
  }

  .def-box .def-text {
    font-size: 8.5px;
  }

  .def-box .def-source {
    font-size: 7px;
  }

  .cs-table {
    font-size: 8.5px;
    margin-bottom: 5px;
  }

  .cs-table th {
    font-size: 8px;
    padding: 3px 4px;
  }

  .cs-table td {
    padding: 2px 4px;
  }

  .cs-table.compact td {
    padding: 1.5px 4px;
    font-size: 8px;
  }

  .cs-list li {
    font-size: 8.5px;
    padding: 0.5px 0 0.5px 10px;
  }

  .flow-list .flow-item {
    font-size: 7.5px;
    padding: 1px 4px;
  }

  .flow-list .flow-arrow {
    font-size: 8px;
  }

  .trap-card {
    padding: 3px 6px;
    margin-bottom: 3px;
  }

  .trap-card .trap-wrong,
  .trap-card .trap-right {
    font-size: 8px;
  }

  .trap-card .trap-note {
    font-size: 7.5px;
  }

  .trap-card .trap-icon {
    width: 14px;
    height: 14px;
    font-size: 8px;
  }

  .quad-grid {
    font-size: 8px;
  }

  .quad-grid .cell {
    font-size: 7.5px;
    padding: 3px 4px;
  }

  .trap-table {
    font-size: 8px;
  }

  .trap-table th {
    font-size: 7.5px;
    padding: 3px 4px;
  }

  .trap-table td {
    padding: 2px 4px;
  }

  @page {
    size: A4;
    margin: 0;
  }

  /* Force dark mode colors off in print */
  :root {
    --bg-primary: #FFFFFF;
    --bg-secondary: #F8F9FA;
    --bg-card: #FFFFFF;
    --text-primary: #212529;
    --text-secondary: #495057;
    --text-muted: #868E96;
    --border-color: #DEE2E6;
    --accent: #1B365D;
    --accent-light: #2A4A7F;
    --highlight: #F0AB00;
    --highlight-bg: #FFF8E1;
    --success: #2E7D32;
    --success-bg: #E8F5E9;
    --error: #C62828;
    --error-bg: #FFEBEE;
    --info: #1565C0;
    --info-bg: #E3F2FD;

    --topic1-bg: #E3F2FD;
    --topic1-fg: #1565C0;
    --topic2-bg: #FCE4EC;
    --topic2-fg: #C62828;
    --topic3-bg: #E8F5E9;
    --topic3-fg: #2E7D32;
    --topic4-bg: #FFF3E0;
    --topic4-fg: #E65100;
    --topic5-bg: #F3E5F5;
    --topic5-fg: #6A1B9A;
    --topic6-bg: #E0F2F1;
    --topic6-fg: #00695C;
  }
}
