/* ============================================================
   THEME.CSS — Dark Mode, High Contrast, Print
   ============================================================ */

/* ── Dark Mode Overrides ────────────────────────────────── */
[data-theme="dark"] .tpl-modern .sidebar {
  background: var(--resume-accent, #1a5c45);
}

[data-theme="dark"] #preview-viewport {
  background: #1e2233;
}

[data-theme="dark"] #resume-preview {
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
}

[data-theme="dark"] .rich-content {
  background: var(--bg-panel);
  color: var(--text-primary);
}

[data-theme="dark"] .rich-toolbar {
  background: var(--bg-sidebar);
}

[data-theme="dark"] .entry-card {
  background: var(--bg-panel);
}

[data-theme="dark"] .entry-card-header {
  background: var(--bg-panel);
}

[data-theme="dark"] .entry-card-header:hover {
  background: var(--bg-sidebar);
}

[data-theme="dark"] .section-option-btn {
  background: var(--bg-panel);
}

[data-theme="dark"] .template-card {
  border-color: var(--border);
}

[data-theme="dark"] .template-card-info {
  background: var(--bg-panel);
  border-top-color: var(--border);
}

[data-theme="dark"] .form-control {
  background: var(--bg-panel);
  color: var(--text-primary);
  border-color: var(--border);
}

[data-theme="dark"] .form-control:focus {
  border-color: var(--primary);
}

[data-theme="dark"] select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23b0b0b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}

[data-theme="dark"] .modal {
  background: var(--bg-panel);
  border: 1px solid var(--border);
}

[data-theme="dark"] .dropdown-menu {
  background: var(--bg-panel);
  border-color: var(--border);
}

[data-theme="dark"] .tag {
  background: rgba(27,45,231,0.2);
}

[data-theme="dark"] .review-stat {
  background: var(--bg-sidebar);
}

/* ── High Contrast Mode ─────────────────────────────────── */
@media (forced-colors: active) {
  .btn-primary {
    border: 2px solid ButtonText;
  }

  .form-control:focus {
    outline: 3px solid Highlight;
  }

  .score-bar-fill {
    background: Highlight;
  }
}

/* ── Print Styles ───────────────────────────────────────── */
/* PDFExporter injects #__print-resume (per-page divs built by
   PreviewRenderer.buildPrintDocument) and hides everything else.
   These rules are kept as a safety net for direct browser print. */
@media print {
  html, body {
    overflow: visible;
    height: auto;
    background: white;
  }

  #__print-resume {
    display: block !important;
  }

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

/* ── Text Tab Customize Styles ──────────────────────────── */
.customize-section {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.customize-section-title {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.font-select-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 4px;
}

.font-option {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.font-option label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.font-size-grid {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.font-size-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  min-width: 120px;
}

.font-size-value {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary);
  min-width: 40px;
  text-align: right;
}

.font-weight-grid {
  display: grid;
  gap: 8px;
}

.font-weight-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  align-items: center;
  gap: 10px;
}

.font-weight-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.font-weight-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(243,156,18,0.06);
  padding: 8px 10px;
  border-radius: var(--radius-md);
  margin-top: 4px;
  line-height: 1.5;
  display: flex;
  gap: 6px;
  align-items: flex-start;
}

/* ── Layout Tab ─────────────────────────────────────────── */
.layout-format-select {
  margin-bottom: 16px;
}

.layout-alignment-picker {
  display: flex;
  gap: 8px;
}

.alignment-option {
  flex: 1;
  aspect-ratio: 1;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  background: var(--bg-panel);
  max-height: 48px;
}

.alignment-option:hover { border-color: var(--primary); }

.alignment-option.active {
  border-color: var(--primary);
  background: var(--primary-xlight);
}

.alignment-preview {
  width: 28px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.alignment-preview span {
  display: block;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  color: var(--text-muted);
}

.alignment-option.active .alignment-preview span {
  color: var(--primary);
}

.alignment-left .alignment-preview span:nth-child(1) { width: 100%; }
.alignment-left .alignment-preview span:nth-child(2) { width: 70%; }
.alignment-left .alignment-preview span:nth-child(3) { width: 85%; }

.alignment-center .alignment-preview span:nth-child(1) { width: 100%; margin: auto; }
.alignment-center .alignment-preview span:nth-child(2) { width: 70%; margin: auto; }
.alignment-center .alignment-preview span:nth-child(3) { width: 85%; margin: auto; }

.alignment-right .alignment-preview { align-items: flex-end; }
.alignment-right .alignment-preview span:nth-child(1) { width: 100%; }
.alignment-right .alignment-preview span:nth-child(2) { width: 70%; }
.alignment-right .alignment-preview span:nth-child(3) { width: 85%; }

.layout-option-grid {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.layout-option-btn {
  flex: 1;
  padding: 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--bg-panel);
  text-align: center;
}

.layout-option-btn .layout-preview-img {
  width: 100%;
  aspect-ratio: 0.7;
  background: var(--bg-sidebar);
  border-radius: 3px;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.layout-option-btn .layout-preview-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.layout-option-btn.active {
  border-color: var(--primary);
  background: var(--primary-xlight);
}

.layout-option-btn.active .layout-preview-label {
  color: var(--primary);
}
