/* app.css — visual theme for grintieproduccions, derived from grintie.psyed.edu.es
   (Twenty Twenty): Inter body, serif headings, cream background, orange accent.
   Copyright Miquel Sancho, MiKi <miki@MKEngineering.org> */

:root {
  --brand-accent: #ff7c06;
  --brand-dark: #b02a1a;
  --color-text: #000000;
  --color-secondary: #6d6d6d;
  --color-border: #dcd7ca;
  --color-bg: #f5efe0;
  --color-surface: #ffffff;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, sans-serif;
  --font-head: "Hoefler Text", "Noto Serif", Garamond, "Times New Roman", serif;
  --maxw: 1100px;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--color-bg); color: var(--color-text);
  font-family: var(--font-body); line-height: 1.6; font-size: 18px;
}
a { color: var(--brand-dark); }
a:hover { color: var(--brand-accent); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

.site-header {
  background: var(--color-surface); border-bottom: 1px solid var(--color-border);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 18px; padding-bottom: 18px; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img.logo { height: 44px; width: auto; display: block; }
.brand .tagline { font-family: var(--font-head); font-size: 15px; color: var(--color-secondary);
  padding-left: 12px; border-left: 1px solid var(--color-border); }
.header-nav { display: flex; align-items: center; gap: 18px; }
.back-grintie { font-size: 14px; color: var(--color-secondary); text-decoration: none; white-space: nowrap; }
.back-grintie:hover { color: var(--brand-accent); }

.langbar { font-size: 14px; }
.langbar form { display: inline; }
.langbar button { background: none; border: none; cursor: pointer; color: var(--color-secondary);
  font: inherit; padding: 2px 6px; }
.langbar button.active { color: var(--brand-dark); font-weight: 700; }

h1, h2, h3 { font-family: var(--font-head); font-weight: 700; line-height: 1.2; }
.page-title { font-size: 38px; margin: 28px 0 6px; }
.subtitle { color: var(--color-secondary); margin: 0 0 24px; }

.filters { background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: 8px; padding: 16px; margin-bottom: 24px; display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 10px; align-items: end; }
.filters label { display: block; font-size: 12px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--color-secondary); margin-bottom: 4px; }
.filters input, .filters select { width: 100%; padding: 8px 10px;
  border: 1px solid var(--color-border); border-radius: 6px; font: inherit; background: #fff; }
@media (max-width: 760px) { .filters { grid-template-columns: 1fr 1fr; } }

.btn { display: inline-block; background: var(--brand-accent); color: #fff; border: none;
  padding: 9px 16px; border-radius: 6px; font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; }
.btn:hover { background: var(--brand-dark); color: #fff; }
.btn.secondary { background: #fff; color: var(--color-text); border: 1px solid var(--color-border); }
.btn.danger { background: var(--brand-dark); }

.count { color: var(--color-secondary); font-size: 15px; margin-bottom: 14px; }

.ref-group h2 { border-bottom: 2px solid var(--brand-accent); padding-bottom: 4px;
  margin-top: 36px; font-size: 24px; }
ol.ref-list { list-style: none; padding: 0; margin: 0; }
ol.ref-list li { position: relative; padding: 14px 12px; margin: 0 -12px;
  border-bottom: 1px solid var(--color-border); display: flex; gap: 14px;
  align-items: flex-start; border-radius: 8px; transition: background .12s ease; }
ol.ref-list li:hover { background: #fff; }
.ref-type { flex: 0 0 132px; text-align: center; }
.ref-type .tag { display: inline-block; }
.ref-body { flex: 1; }
.ref-arrow { flex: 0 0 auto; align-self: center; color: var(--color-secondary);
  font-size: 22px; line-height: 1; opacity: .35; transition: opacity .12s ease, transform .12s ease, color .12s ease; }
ol.ref-list li:hover .ref-arrow { opacity: 1; color: var(--brand-accent); transform: translateX(3px); }
/* Stretched link: the overlay covers the whole card... */
.ref-link { position: absolute; inset: 0; z-index: 1; border-radius: 8px; }
.ref-link:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: -2px; }
/* The text sits BELOW the overlay so clicking anywhere on it navigates;
   only the real links inside the APA text poke above to stay clickable. */
.ref-body .apa a { position: relative; z-index: 2; }
.ref-body .meta { position: relative; z-index: 2; font-size: 13px; color: var(--color-secondary);
  margin-top: 6px; pointer-events: none; }
.tag { display: inline-block; font-size: 12px; font-weight: 700; background: #f0e9d8;
  border: 1px solid var(--color-border); border-radius: 999px; padding: 1px 10px;
  color: var(--brand-dark); text-transform: uppercase; letter-spacing: .03em; }

.pagination { margin: 28px 0; display: flex; gap: 10px; align-items: center; justify-content: center; }

.site-footer { margin-top: 48px; border-top: 1px solid var(--color-border);
  background: var(--color-surface); }
.site-footer .wrap { padding: 22px 20px; color: var(--color-secondary); font-size: 14px;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

/* Backoffice */
.bo-nav { background: #1d1d1b; color: #fff; }
.bo-nav .wrap { display: flex; gap: 18px; align-items: center; padding: 12px 20px; }
.bo-nav a { color: #fff; text-decoration: none; }
.bo-nav a:hover { color: var(--brand-accent); }
.bo-nav .spacer { flex: 1; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin: 20px 0; }
.card { background: #fff; border: 1px solid var(--color-border); border-radius: 8px; padding: 16px; }
.card .num { font-size: 32px; font-weight: 700; font-family: var(--font-head); }
.card .lbl { color: var(--color-secondary); font-size: 14px; }
table.grid { width: 100%; border-collapse: collapse; background: #fff; }
table.grid th, table.grid td { text-align: left; padding: 10px; border-bottom: 1px solid var(--color-border); vertical-align: top; }
table.grid th { font-size: 12px; text-transform: uppercase; color: var(--color-secondary); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; background: #fff;
  border: 1px solid var(--color-border); border-radius: 8px; padding: 20px; }
.form-grid p { margin: 0; display: flex; flex-direction: column; }
.form-grid p.full { grid-column: 1 / -1; }
.form-grid label { font-size: 13px; color: var(--color-secondary); margin-bottom: 4px; }
.form-grid input, .form-grid select, .form-grid textarea { padding: 8px 10px;
  border: 1px solid var(--color-border); border-radius: 6px; font: inherit; }
.preview { background: #fff; border: 1px dashed var(--brand-accent); border-radius: 8px;
  padding: 14px; margin: 16px 0; }
.review-flag { color: var(--brand-dark); font-weight: 700; }
.review-mark { display: block; text-align: center; margin-top: 5px;
  color: var(--brand-accent); font-weight: 700; font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em; }

/* Equal-width row action buttons in the backoffice list */
.row-actions { display: flex; gap: 6px; }
.row-actions .btn { min-width: 92px; text-align: center; }

/* Original-vs-APA comparison (backoffice) */
.cmp-badge { font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.cmp-badge.ok { background: #d7f5d7; color: #1c6b1c; }
.cmp-badge.warn { background: #fdf0c8; color: #8a6d00; }
.cmp-badge.bad { background: #f7d4d0; color: #9c1d10; }
.cmp-diff { line-height: 1.8; }
.cmp-diff ins, .preview ins { background: #d7f5d7; text-decoration: none; border-radius: 3px; padding: 0 2px; }
.cmp-diff del, .preview del { background: #f7d4d0; text-decoration: line-through; border-radius: 3px; padding: 0 2px; }
.messages { list-style: none; padding: 0; }
.messages li { background: #fff; border-left: 4px solid var(--brand-accent); padding: 10px 14px; margin: 8px 0; }
