/* Ra2yee | Diary — styles. Follows ra2yee_logo_spec.md. */
:root {
  /* Brand tokens (logo spec §1) */
  --eg-blue: #1034A6;          /* Egyptian Blue — primary buttons, links */
  --deep-blue: #00207b;        /* Deep Egyptian Blue — nav surfaces */
  --teal: #11C2A8;             /* Teal — the "2", secondary accents */
  --ink: #0a1228;              /* Ink — body text */
  --paper: #ffffff;            /* Card backgrounds */

  /* App surfaces */
  --bg: #FAFAF7;               /* Off-white app background */
  --muted: #5b6378;
  --line: #e6e3da;
  --warn: #c84141;
  --ok: #1d8a4d;
  --shadow: 0 6px 18px rgba(0, 32, 123, .08);
  --radius: 10px;
}
html[dir="rtl"] body { direction: rtl; }

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: 'Plus Jakarta Sans', 'Manrope', -apple-system, BlinkMacSystemFont,
               "Segoe UI", "Tajawal", system-ui, sans-serif;
  font-size: 15px; line-height: 1.5;
}
a { color: var(--eg-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--ink); margin: 0 0 .4em; font-family: 'Manrope', system-ui, sans-serif; }
h1 { font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 19px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
.muted { color: var(--muted); font-size: 13px; }

.container { max-width: 1200px; margin: 0 auto; padding: 16px 24px; }
.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.btn {
  display: inline-block; padding: 9px 16px; border-radius: 8px;
  background: var(--eg-blue); color: var(--paper);
  border: 0; cursor: pointer; font-weight: 600; font-size: 14px;
  font-family: inherit;
}
.btn:hover { opacity: .92; text-decoration: none; }
.btn.secondary { background: var(--paper); color: var(--ink); border: 1px solid var(--line); }
.btn.secondary:hover { border-color: var(--eg-blue); color: var(--eg-blue); }
.btn.teal { background: var(--teal); color: var(--paper); }
.btn.warn { background: var(--warn); color: #fff; }
.btn.ghost { background: transparent; color: var(--paper); border: 1px solid rgba(255,255,255,.4); }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; }

input, textarea, select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 6px; font: inherit; background: var(--paper); color: var(--ink);
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--eg-blue);
  box-shadow: 0 0 0 3px rgba(16, 52, 166, .15);
}
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 0; }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; }
.flash.ok { background: #e9f6ec; color: var(--ok); }
.flash.error { background: #fbeaea; color: var(--warn); }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: start; }
th { font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 700; letter-spacing: .04em; }

.chip {
  display: inline-block; font-size: 11px; padding: 3px 9px;
  border-radius: 999px; background: #eef0f5; color: var(--ink); font-weight: 600;
}
.chip.ok    { background: #e3f2e9; color: var(--ok); }
.chip.warn  { background: #fbe9e9; color: var(--warn); }
.chip.muted { background: #eef0f5; color: var(--muted); }

/* ── Ra2yee logo (logo spec §6–§7) ─────────────────────────────────────── */
.ra2yee-logo {
  display: inline-flex; align-items: baseline; gap: 0;
  font-family: 'Manrope', 'Plus Jakarta Sans', system-ui, sans-serif;
  font-weight: 800; font-size: 22px; line-height: 1;
  color: var(--paper); text-decoration: none;
  letter-spacing: -0.01em; user-select: none;
}
.ra2yee-logo .two { color: var(--teal); }
.ra2yee-logo .divider {
  display: inline-block; width: 2px; height: 0.85em;
  background: rgba(255, 255, 255, .7);
  margin: 0 0.35em 0 0.4em; align-self: center;
  transform: translateY(0.04em);
}
.ra2yee-logo .product {
  font-weight: 600; font-size: 0.7em;
  color: rgba(255, 255, 255, .85); letter-spacing: 0.02em;
}
.ra2yee-logo.deep-blue { color: var(--deep-blue); }
.ra2yee-logo.deep-blue .divider { background: rgba(0, 32, 123, .55); }
.ra2yee-logo.deep-blue .product { color: rgba(0, 32, 123, .8); }
.ra2yee-logo.eg-blue { color: var(--eg-blue); }
.ra2yee-logo.eg-blue .divider { background: rgba(16, 52, 166, .55); }
.ra2yee-logo.eg-blue .product { color: rgba(16, 52, 166, .8); }
.ra2yee-logo.dark { color: var(--ink); }
.ra2yee-logo.dark .divider { background: rgba(10, 18, 40, .5); }
.ra2yee-logo.dark .product { color: rgba(10, 18, 40, .7); }

/* ── Admin top nav (deep blue surface, white logo) ────────────────────── */
.nav {
  background: var(--deep-blue); color: var(--paper); padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 32, 123, .12);
}
.nav .left { display: flex; align-items: center; gap: 24px; }
.nav .links a { color: var(--paper); opacity: .85; font-weight: 600; font-size: 14px; }
.nav .links a:hover { opacity: 1; text-decoration: none; }
.nav .links a.active { color: var(--paper); opacity: 1; border-bottom: 2px solid var(--teal); padding-bottom: 4px; }
.nav .right { color: rgba(255,255,255,.7); font-size: 13px; }
.nav .right a { color: rgba(255,255,255,.85); }

/* ── Breadcrumbs ──────────────────────────────────────────────────────── */
.crumbs { font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--eg-blue); text-decoration: none; }
.crumbs .sep { margin: 0 6px; opacity: .6; }

/* ── Study-scoped subnav ──────────────────────────────────────────────── */
.subnav {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 4px;
  display: inline-flex; gap: 2px; margin: 8px 0 16px;
  overflow-x: auto; max-width: 100%;
}
.subnav a {
  padding: 8px 14px; border-radius: 6px; color: var(--ink); font-weight: 600; font-size: 14px;
  white-space: nowrap;
}
.subnav a:hover { background: #eef0f5; text-decoration: none; }
.subnav a.active { background: var(--eg-blue); color: var(--paper); }

/* ── Page header (study scope) ────────────────────────────────────────── */
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 4px;
}
.page-head h1 { margin: 0; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Moderator dashboard layout ───────────────────────────────────────── */
.dash {
  display: grid;
  grid-template-columns: 280px 1fr 380px;
  gap: 16px;
  align-items: start;
}
.dash .rail {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 8px; max-height: 80vh; overflow: auto;
}
.dash .rail h3 { padding: 8px 12px 4px; font-size: 12px; text-transform: uppercase; color: var(--muted); }
.dash .rail .item { display: block; padding: 10px 12px; border-radius: 6px; color: var(--ink); }
.dash .rail .item:hover { background: #f4f3ee; text-decoration: none; }
.dash .rail .item.active { background: #ecf1ff; }
.dash .rail .badge {
  background: var(--teal); color: var(--paper); padding: 2px 8px;
  border-radius: 10px; font-size: 11px; font-weight: 700;
}

.timeline .row {
  border-bottom: 1px solid var(--line); padding: 14px 0;
  align-items: flex-start; display: block;
}
.timeline .event-title { font-weight: 700; font-size: 15px; }
.timeline .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.timeline .media-item img { max-width: 220px; border-radius: 8px; border: 1px solid var(--line); }
.timeline audio, .timeline video { max-width: 100%; display: block; margin-top: 6px; }

.composer .tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px;
}
.composer .tabs button {
  background: transparent; border: 0; padding: 8px 12px; cursor: pointer;
  font-weight: 700; color: var(--muted); font-family: inherit;
}
.composer .tabs button.active { color: var(--ink); border-bottom: 2px solid var(--eg-blue); }
.composer .tabs button:disabled { color: #b3b6c1; cursor: not-allowed; }
.composer .ai-disabled-note { font-size: 12px; color: var(--muted); }

/* ── Respondent PWA ───────────────────────────────────────────────────── */
.pwa-shell { max-width: 720px; margin: 0 auto; padding: 16px; }
.pwa-header {
  background: var(--deep-blue); color: var(--paper);
  margin: -16px -16px 16px; padding: 16px;
}
.pwa-event {
  display: grid; grid-template-columns: 1fr; gap: 12px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.pwa-event.locked { opacity: .55; }
.pwa-event .title { font-weight: 700; font-size: 17px; }
.pwa-event .body { color: var(--muted); }
.pwa-event .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.media-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.media-grid .pad {
  border: 2px dashed var(--line); border-radius: 10px; padding: 16px;
  text-align: center; cursor: pointer; background: var(--paper);
  transition: border-color .15s, background .15s;
}
.media-grid .pad:hover { border-color: var(--eg-blue); background: #f7f8fc; }
.media-grid .pad input { display: none; }
.media-grid .pad .icon { font-size: 28px; }

.completed-card {
  text-align: center; padding: 36px; background: var(--paper);
  border-radius: var(--radius); border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.completed-card h1 { font-size: 28px; }

/* ── Helpers ──────────────────────────────────────────────────────────── */
.stack > * + * { margin-top: 12px; }
.right { text-align: end; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tiny { font-size: 12px; color: var(--muted); }
code, pre { background: #f3f3ed; padding: 2px 6px; border-radius: 4px; font-size: 13px; }

@media (max-width: 1100px) {
  .dash { grid-template-columns: 1fr; }
}
