/* Neverland Translation Review — minimal UI styled to feel on-brand. */

:root {
  --brand:        #1A1A1A;
  --brand-light:  #2A2A2A;
  --gold:         #C9A84C;
  --gold-dark:    #A8862A;
  --dusty:        #7E9BB5;
  --dusty-light:  #B8CCDD;
  --cream:        #FAF8F5;
  --cream-dark:   #EFEAE1;
  --text:         #1A1A1A;
  --text-light:   #5A5A5A;
  --text-muted:   #8A8A8A;
  --border:       #E4DFD3;
  --border-strong:#C9C2B0;
  --success:      #2D7A4F;
  --warn:         #B8782E;
  --error:        #B43A3A;
  --shadow-sm:    0 1px 2px rgba(26,26,26,0.06);
  --shadow-md:    0 4px 12px rgba(26,26,26,0.08);
  --radius:       8px;
  --sidebar-w:    280px;
  --topbar-h:     64px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  background: var(--cream-dark);
  padding: 1px 6px;
  border-radius: 4px;
}

.muted { color: var(--text-muted); }

/* -------------------------------------------------------------------------- */
/* Auth gate                                                                   */
/* -------------------------------------------------------------------------- */
#auth-gate {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--cream);
}

.gate-card {
  max-width: 480px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-md);
}

.gate-card h1 {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 26px;
  margin: 0 0 12px;
  color: var(--brand);
}

/* -------------------------------------------------------------------------- */
/* Top bar                                                                     */
/* -------------------------------------------------------------------------- */
#topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(180px, auto) 1fr auto;
  align-items: center;
  gap: 20px;
  height: var(--topbar-h);
  padding: 0 20px;
  background: var(--brand);
  color: white;
  box-shadow: var(--shadow-md);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.brand-mark {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  display: inline-block;
  transform: translateY(1px);
}

.brand-name {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 20px;
}

.brand-sub {
  font-size: 13px;
  color: rgba(255,255,255,0.65);
}

.progress {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-self: center;
  width: 100%;
  max-width: 480px;
}

.progress-text {
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  white-space: nowrap;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.15);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--gold);
  transition: width 0.3s ease;
}

.status {
  display: flex;
  align-items: center;
  gap: 14px;
}

.save-status {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.save-status::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.save-status--idle { color: rgba(255,255,255,0.5); }
.save-status--saving { color: var(--gold); }
.save-status--saved { color: #9CCBA8; }
.save-status--error { color: #E07A7A; }
.save-status--offline { color: #E07A7A; }

.done-btn {
  appearance: none;
  border: 1px solid var(--gold);
  background: var(--gold);
  color: var(--brand);
  font-weight: 600;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, transform 0.05s ease;
}

.done-btn:hover { background: #D9B85B; }
.done-btn:active { transform: scale(0.98); }

/* -------------------------------------------------------------------------- */
/* Layout                                                                      */
/* -------------------------------------------------------------------------- */
#layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - var(--topbar-h));
}

/* -------------------------------------------------------------------------- */
/* Sidebar                                                                     */
/* -------------------------------------------------------------------------- */
#sidebar {
  background: white;
  border-right: 1px solid var(--border);
  padding: 24px 20px;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}

.sidebar-section { margin-bottom: 24px; }
.sidebar-section--filters { margin-top: 8px; }

.sidebar-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: block;
}

#search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  background: var(--cream);
}

#search:focus {
  outline: none;
  border-color: var(--gold);
  background: white;
}

.page-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.page-list li {
  padding: 0;
  margin: 2px 0;
}

.page-list button {
  appearance: none;
  width: 100%;
  background: transparent;
  border: none;
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  transition: background 0.1s ease;
}

.page-list button:hover { background: var(--cream-dark); }

.page-list button.active {
  background: var(--brand);
  color: white;
  font-weight: 500;
}

.page-list .page-progress {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.page-list button.active .page-progress { color: rgba(255,255,255,0.7); }
.page-list button .page-progress.complete { color: var(--success); font-weight: 600; }
.page-list button.active .page-progress.complete { color: #9CCBA8; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 4px 0;
  cursor: pointer;
  color: var(--text-light);
}

.sidebar-help {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.sidebar-help details summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-light);
  font-weight: 500;
}

.sidebar-help ul {
  margin: 12px 0 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.5;
}

.sidebar-help li { margin-bottom: 6px; }

.html-pill {
  display: inline-block;
  background: rgba(184,120,46,0.15);
  color: var(--warn);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  vertical-align: middle;
}

/* -------------------------------------------------------------------------- */
/* Content                                                                     */
/* -------------------------------------------------------------------------- */
#content {
  padding: 32px 40px 80px;
  max-width: 1100px;
}

.page-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 30px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--brand);
}

.page-header .page-meta {
  font-size: 13px;
  color: var(--text-light);
}

/* -------------------------------------------------------------------------- */
/* String cards                                                                */
/* -------------------------------------------------------------------------- */
.string-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.string-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.string-card.reviewed {
  border-color: rgba(45,122,79,0.25);
  background: #FAFCFA;
}

.string-card.changed {
  border-color: rgba(201,168,76,0.5);
}

.string-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.string-key {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--cream-dark);
  padding: 2px 8px;
  border-radius: 4px;
}

.string-flags {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
}

.flag-changed {
  font-size: 11px;
  background: rgba(201,168,76,0.18);
  color: var(--gold-dark);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}

.flag-reviewed {
  font-size: 11px;
  background: rgba(45,122,79,0.12);
  color: var(--success);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}

.string-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 12px;
}

.lang-block { display: flex; flex-direction: column; gap: 6px; }

.lang-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.lang-en-content {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  user-select: text;
}

.lang-fr-edit {
  width: 100%;
  min-height: 80px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  background: white;
  resize: vertical;
  color: var(--text);
}

.lang-fr-edit:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.18);
}

.string-card-foot {
  display: flex;
  gap: 16px;
  align-items: stretch;
  margin-top: 4px;
}

.notes-block { flex: 1; }

.notes-input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  background: var(--cream);
  resize: vertical;
  color: var(--text);
}

.notes-input:focus {
  outline: none;
  border-color: var(--dusty);
  background: white;
}

.notes-input::placeholder { color: var(--text-muted); }

.review-btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: white;
  color: var(--text-light);
  font-weight: 500;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  align-self: flex-start;
  white-space: nowrap;
  transition: background 0.1s ease, color 0.1s ease, border-color 0.1s ease;
}

.review-btn:hover { background: var(--cream-dark); }

.review-btn.is-reviewed {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.review-btn.is-reviewed::before {
  content: '✓ ';
  font-weight: 700;
}

.html-warning {
  margin-top: 6px;
  font-size: 12px;
  color: var(--warn);
  padding: 6px 10px;
  background: rgba(184,120,46,0.08);
  border-radius: 6px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

/* -------------------------------------------------------------------------- */
/* Toast                                                                       */
/* -------------------------------------------------------------------------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--brand);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  box-shadow: var(--shadow-md);
  z-index: 100;
}

.toast.toast--error { background: var(--error); }

/* -------------------------------------------------------------------------- */
/* Modal                                                                       */
/* -------------------------------------------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(26,26,26,0.45);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 24px;
}

.modal-card {
  background: white;
  border-radius: var(--radius);
  padding: 28px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-md);
}

.modal-card h2 {
  font-family: 'Playfair Display', serif;
  margin: 0 0 12px;
  color: var(--brand);
  font-size: 22px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  flex-wrap: wrap;
}

.modal-fallback {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-muted);
}

.modal-fallback strong { color: var(--text-light); }

a.btn { text-decoration: none; text-align: center; display: inline-block; }

.btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: white;
  font-family: inherit;
  font-size: 14px;
  padding: 9px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  color: var(--text);
}

.btn-primary {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

.btn-primary:hover { background: var(--brand-light); }

.btn-secondary:hover { background: var(--cream-dark); }

/* -------------------------------------------------------------------------- */
/* Responsive                                                                  */
/* -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  :root { --sidebar-w: 100%; }

  #topbar {
    grid-template-columns: 1fr auto;
    height: auto;
    padding: 12px 16px;
    gap: 12px;
  }

  .progress { grid-column: 1 / -1; max-width: none; order: 3; }
  .brand-sub { display: none; }

  #layout { grid-template-columns: 1fr; }

  #sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  #content { padding: 20px 16px 60px; }

  .string-grid {
    grid-template-columns: 1fr;
  }

  .string-card-foot { flex-direction: column; }
  .review-btn { width: 100%; }
}
