/* ---------------------------------------------------------
   QCAB Generator — single consolidated stylesheet
   Base reset + visual refresh for PYQ and custom modes.
   --------------------------------------------------------- */

/* Base Reset */
html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: #f8f9fa;
  color: #1e293b;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

* { box-sizing: inherit; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

:root {
  --pyq-border: #cbd5e1;
  --pyq-border-soft: #e2e8f0;
  --pyq-surface: #ffffff;
  --pyq-surface-soft: #f8fafc;
  --pyq-text: #1e293b;
  --pyq-muted: #64748b;
  --pyq-accent: #2563eb;
  --pyq-accent-hover: #1d4ed8;
  --pyq-accent-soft: #eff6ff;
  --pyq-selected: #eff6ff;
  --pyq-selected-accent: #2563eb;
}

.main-content {
  flex: 1 0 auto;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
}

/* Top Navigation Header */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 2px 14px;
}

.nav-link {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--pyq-accent);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 6px;
  transition: background-color .15s ease, color .15s ease;
}

.nav-link:hover {
  background-color: var(--pyq-accent-soft);
  color: var(--pyq-accent-hover);
}

/* Page Title */
h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--pyq-text);
  letter-spacing: -0.02em;
  margin: 0 auto 20px;
  text-align: center;
}

/* Mode selector */
.filter-mode {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 6px auto 18px;
}

.filter-mode label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--pyq-border);
  border-radius: 8px;
  background: var(--pyq-surface);
  color: var(--pyq-text);
  font-size: 14px;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.filter-mode label:hover {
  border-color: #94a3b8;
  background: var(--pyq-surface-soft);
}

.filter-mode label:has(input:checked) {
  background: var(--pyq-accent-soft);
  border-color: var(--pyq-accent);
  color: var(--pyq-accent-hover);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.12);
}

.filter-mode input {
  accent-color: var(--pyq-accent);
  margin: 0;
}

/* PYQ filter area */
#filters {
  max-width: 900px;
  margin: 0 auto 16px;
  padding: 14px 16px 4px;
  border: 1px solid var(--pyq-border);
  border-radius: 9px;
  background: var(--pyq-surface);
  text-align: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .02);
}

#filters select {
  min-width: 180px;
  margin: 0 7px 10px;
  padding: 8px 28px 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background-color: #fff;
  color: var(--pyq-text);
  font-size: 14px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

#filters select:focus {
  border-color: var(--pyq-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* Selection summary */
#selectedSummary {
  max-width: 900px;
  margin: 0 auto 14px !important;
  padding: 10px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: var(--pyq-accent-soft);
  color: #1e3a8a;
  font-size: 13.5px;
  text-align: center;
}

#selectedSummary span {
  font-weight: 700;
  color: #1d4ed8;
}

/* Question table */
#questionsTable {
  border: 1px solid var(--pyq-border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
}

#questionsTable thead th {
  padding: 11px 10px;
  background: #f1f5f9;
  color: #475569;
  border-bottom: 2px solid #cbd5e1;
  border-right: 1px solid var(--pyq-border-soft);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
  white-space: nowrap;
}

#questionsTable thead th:last-child {
  border-right: none;
}

/* Table Column Widths & Alignments */
#questionsTable .col-checkbox {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  text-align: center;
  padding: 10px 4px;
  vertical-align: middle;
}

#questionsTable .col-year {
  width: 72px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  vertical-align: middle;
}

#questionsTable .col-paper {
  width: 88px;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
}

#questionsTable .col-question {
  text-align: left;
  font-size: 14px;
  line-height: 1.55;
  color: var(--pyq-text);
  padding: 11px 12px;
  vertical-align: top;
}

#questionsTable .col-marks {
  width: 76px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  vertical-align: middle;
}

#questionsTable .col-limit {
  width: 96px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  vertical-align: middle;
}

#questionsTable td {
  border-bottom: 1px solid var(--pyq-border-soft);
  border-right: 1px solid var(--pyq-border-soft);
  padding: 10px 8px;
  color: var(--pyq-text);
  font-size: 13.5px;
}

#questionsTable td:last-child {
  border-right: none;
}

/* Row interaction & selection */
#questionsTable tbody tr {
  cursor: pointer;
  transition: background-color .12s ease;
}

#questionsTable tbody tr:hover {
  background: #f8fafc;
}

#questionsTable tbody tr.selected {
  background: var(--pyq-selected);
  box-shadow: inset 3px 0 0 var(--pyq-selected-accent);
}

#questionsTable tbody tr.selected:hover {
  background: #e2eeff;
}

#questionsTable input[type="checkbox"] {
  accent-color: var(--pyq-accent);
  cursor: pointer;
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

/* GS Paper Badge */
.gs-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #334155;
  font-weight: 600;
  font-size: 12px;
  border: 1px solid #e2e8f0;
}

/* Empty Table State */
.table-empty-row td {
  text-align: center !important;
  padding: 36px 16px !important;
  color: var(--pyq-muted) !important;
  font-size: 14px !important;
  background: #fafbfc;
  cursor: default !important;
}

/* Action area */
.buttons {
  margin-top: 18px;
  text-align: center;
}

.buttons button {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 7px;
  background: #fff;
  color: var(--pyq-text);
  border: 1px solid #cbd5e1;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
  cursor: pointer;
}

.buttons button:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

#generateQCAB {
  background: var(--pyq-accent);
  border-color: var(--pyq-accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

#generateQCAB:hover {
  background: var(--pyq-accent-hover);
  border-color: var(--pyq-accent-hover);
}

/* Announcement Banner — clean modern aesthetic */
.announcement-banner {
  max-width: 900px;
  margin: 0 auto 18px;
  padding: 12px 38px 12px 16px;
  border: 1px solid #d0ddeb;
  border-radius: 8px;
  background: #f0f5fa;
  color: #334155;
  font-size: 13.5px;
  line-height: 1.6;
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .03);
}

.announcement-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.announcement-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.banner-tag {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 4px;
  line-height: 1.2;
}

.banner-tag.tag-new {
  background: #dbeafe;
  color: #1d4ed8;
}

.banner-tag.tag-updated {
  background: #dcfce7;
  color: #15803d;
}

.announcement-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
  transition: background-color .15s ease, color .15s ease;
}

.announcement-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Keep footer understated */
footer {
  flex-shrink: 0;
  margin-top: 24px;
  background: white;
  font-size: 12px;
  text-align: center;
  color: var(--pyq-muted);
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

footer hr {
  border: 0;
  border-top: 1px solid var(--pyq-border-soft);
  margin-bottom: 14px;
}

footer a {
  color: var(--pyq-accent);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* Mobile */
@media (max-width: 768px) {
  .main-content {
    padding: 14px;
  }

  h1 {
    font-size: 1.45rem;
  }

  .filter-mode {
    gap: 6px;
  }

  .filter-mode label {
    width: 100%;
    justify-content: center;
  }

  #filters {
    padding: 12px 10px 2px;
  }

  #filters select {
    width: 100%;
    min-width: 0;
    margin: 4px 0 9px;
  }

  #selectedSummary {
    line-height: 1.7;
  }

  #questionsTable {
    display: block;
    overflow-x: auto;
    white-space: normal;
  }

  #questionsTable th,
  #questionsTable td {
    min-width: 75px;
  }

  #questionsTable .col-checkbox {
    min-width: 44px !important;
    width: 44px !important;
  }

  #questionsTable .col-question {
    min-width: 260px;
  }
}
