/**
 * OCR/Document AI Page Specific Styles
 * Document processing, OCR visualization, ROI calculator
 */

/* Page-specific custom properties */
:root {
  --danger: #C62828;
  --light: #f1f5ff;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

html {
  scroll-behavior: smooth;
}

body {
  background: linear-gradient(135deg, rgba(13, 71, 161, 0.08), rgba(21, 101, 192, 0.08));
  min-height: 100vh;
}

html[data-theme="dark"] body {
  background: linear-gradient(135deg, #050b15, #0f1e33);
}

main.container {
  max-width: 1400px;
  padding: 20px;
}

/* ===== Hero/Page Header ===== */
header.page-hero {
  margin: 20px 0;
  padding: 20px;
  background: var(--color-primary);
  color: var(--text-white);
  border-radius: var(--radius-lg, 16px);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

header.page-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
}

header.page-hero h1 {
  font-size: 2.1em;
  margin-bottom: 6px;
}

.top-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.btnx {
  background: var(--color-primary-light);
  color: var(--text-white);
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
}

.btnx.alt {
  background: var(--color-accent);
  color: var(--text-primary);
}

.btnx.ghost {
  background: var(--bg-card);
  color: var(--color-primary);
  border: 1px solid var(--border-light);
}

html[data-theme="dark"] .btnx.ghost {
  background: rgba(144, 202, 249, 0.12);
  color: var(--text-primary);
  border-color: rgba(144, 202, 249, 0.35);
}

/* ===== Panels & Cards ===== */
.cardx {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg, 16px);
  box-shadow: var(--shadow-card);
  padding: 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

/* ===== Stats ===== */
.stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 20px 0;
}

.stat h3 {
  font-size: 1em;
  color: var(--color-primary);
  margin: 0;
}

.stat .val {
  font-size: 1.8em;
  color: var(--color-primary-light);
  font-weight: 700;
  margin-top: 6px;
}

/* ===== Filter Chips ===== */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.chipx {
  border: 1px solid var(--border-light);
  padding: 6px 10px;
  border-radius: var(--radius-pill, 999px);
  background: var(--bg-card);
  cursor: pointer;
  user-select: none;
}

.chipx.active {
  background: var(--color-primary-alpha-12);
}

html[data-theme="dark"] .chipx.active {
  background: rgba(144, 202, 249, 0.18);
}

/* ===== Tabs ===== */
.tabs .tab a {
  color: var(--color-primary);
}

.tabs .tab a.active {
  color: var(--color-primary-light);
}

.tabs .indicator {
  background: var(--color-primary-light);
}

html[data-theme="dark"] .tabs {
  background: transparent;
}

html[data-theme="dark"] .tabs .tab a {
  color: var(--text-primary);
}

html[data-theme="dark"] .tabs .tab a.active {
  color: var(--text-primary);
}

html[data-theme="dark"] .tabs .indicator {
  background: rgba(144, 202, 249, 1);
}

/* ===== Image Cards ===== */
.image-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg, 16px);
  padding: 16px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-light);
  transition: transform 0.2s;
}

.image-card:hover {
  transform: translateY(-3px);
}

.file-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.95em;
}

.file-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--color-primary-alpha-12);
  color: var(--color-primary);
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kv {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 6px;
  font-size: 0.92em;
  margin-top: 8px;
}

.kv div:nth-child(odd) {
  color: var(--color-primary);
}

/* ===== Processing Bar ===== */
.processing-bar {
  height: 14px;
  background: var(--color-primary-alpha-12);
  border-radius: var(--radius-md, 8px);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--color-success);
  transition: width 0.8s ease;
}

.accuracy {
  font-size: 0.9em;
  margin-top: 6px;
}

/* ===== Status Chips ===== */
.chip {
  font-size: 0.78em;
  padding: 4px 8px;
  border-radius: var(--radius-pill, 999px);
  background: #f4f6ff;
  color: var(--color-primary);
  border: 1px solid var(--border-light);
}

.chip.ok {
  background: rgba(46, 125, 50, 0.12);
  border-color: rgba(46, 125, 50, 0.2);
  color: var(--color-success);
}

.chip.warn {
  background: rgba(255, 193, 7, 0.18);
  border-color: rgba(255, 193, 7, 0.35);
  color: #B26A00;
}

.chip.flag {
  background: rgba(198, 40, 40, 0.12);
  border-color: rgba(198, 40, 40, 0.2);
  color: #8C1D1D;
}

.rules {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

/* ===== Schema & Code Output ===== */
.mono {
  font-family: var(--mono);
  font-size: 0.85em;
  white-space: pre;
  overflow: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg, 12px);
  padding: 12px;
  background: var(--bg-card);
}

.copy-btn {
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  border-radius: var(--radius-md, 8px);
  padding: 6px 10px;
  cursor: pointer;
}

html[data-theme="dark"] .copy-btn {
  background: rgba(144, 202, 249, 0.12);
  color: var(--text-primary);
  border-color: rgba(144, 202, 249, 0.35);
}

/* ===== Controls ===== */
.ctrl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.ctrl {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ctrl label {
  font-size: 0.9em;
  color: var(--color-primary);
  display: flex;
  justify-content: space-between;
}

input[type="range"] {
  width: 100%;
}

.sim-toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 10px;
}

.btn-mini {
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  border-radius: var(--radius-md, 8px);
  padding: 6px 10px;
  cursor: pointer;
}

.btn-mini.active {
  background: var(--color-primary-alpha-12);
}

html[data-theme="dark"] .btn-mini {
  background: rgba(144, 202, 249, 0.12);
  border-color: rgba(144, 202, 249, 0.35);
  color: var(--text-primary);
}

/* ===== Stack Builder ===== */
.stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stack-list {
  min-height: 220px;
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-lg, 12px);
  padding: 10px;
}

.step {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 6px 10px;
  margin: 6px 0;
  background: var(--bg-card);
}

.step .actions {
  display: flex;
  gap: 6px;
}

.yaml {
  height: 240px;
}

/* ===== Footer ===== */
footer .btn-flat {
  color: var(--color-primary-light);
}
