/*
 * Recordings: meetings on their way to minutes (index, upload form, review page).
 * Builds on application.css; every class here starts with rec-.
 */

/* ---------- Shared: waveform glyphs ---------- */

.rec-row-glyph, .rec-player-glyph, .rec-pipeline-glyph--wave, .rec-dropzone-wave, .rec-empty-wave, .rec-working-wave {
  display: inline-flex; align-items: center; gap: 3px;
}
.rec-row-glyph i, .rec-player-glyph i, .rec-pipeline-glyph--wave i, .rec-dropzone-wave i, .rec-empty-wave i, .rec-working-wave i {
  display: block; width: 3px; border-radius: 3px; background: var(--ribbon);
  box-shadow: 0 0 8px rgba(67, 183, 253, 0.45);
}
.rec-row-glyph i:nth-child(1), .rec-player-glyph i:nth-child(1) { height: 8px; }
.rec-row-glyph i:nth-child(2), .rec-player-glyph i:nth-child(2) { height: 16px; }
.rec-row-glyph i:nth-child(3), .rec-player-glyph i:nth-child(3) { height: 11px; }
.rec-row-glyph i:nth-child(4), .rec-player-glyph i:nth-child(4) { height: 5px; }

@keyframes rec-bar { 0%, 100% { transform: scaleY(0.35); } 50% { transform: scaleY(1); } }

.rec-pipeline-glyph--wave i, .rec-dropzone-wave i, .rec-empty-wave i, .rec-working-wave i {
  height: 18px; transform-origin: center; animation: rec-bar 1.4s ease-in-out infinite;
}
.rec-pipeline-glyph--wave i:nth-child(2n), .rec-dropzone-wave i:nth-child(2n), .rec-empty-wave i:nth-child(2n), .rec-working-wave i:nth-child(2n) { animation-delay: -0.35s; }
.rec-pipeline-glyph--wave i:nth-child(3n), .rec-dropzone-wave i:nth-child(3n), .rec-empty-wave i:nth-child(3n), .rec-working-wave i:nth-child(3n) { animation-delay: -0.7s; }
.rec-pipeline-glyph--wave i:nth-child(5n), .rec-dropzone-wave i:nth-child(5n), .rec-empty-wave i:nth-child(5n), .rec-working-wave i:nth-child(5n) { animation-delay: -1.05s; }
.rec-empty-wave { margin-bottom: 12px; opacity: 0.7; }
.rec-empty-wave i { animation-duration: 2.6s; }
.rec-dropzone-wave i { height: 26px; animation-duration: 2.2s; }

@media (prefers-reduced-motion: reduce) {
  .rec-pipeline-glyph--wave i, .rec-dropzone-wave i, .rec-empty-wave i, .rec-working-wave i { animation: none; }
}

.rec-status { gap: 6px; }

/* Author display rules (.field, .rec-progress, forms) would otherwise beat the hidden attribute. */
.recordings-area [hidden] { display: none !important; }
.recordings-area .kv { margin: 0; }

/* ---------- Index ---------- */

.rec-hero {
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px 26px; align-items: center;
  padding: 20px 24px; margin-bottom: 18px; overflow: hidden;
  background:
    radial-gradient(520px 240px at 18% 50%, rgba(68, 73, 253, 0.18), transparent 70%),
    radial-gradient(420px 200px at 95% 0%, rgba(67, 183, 253, 0.12), transparent 70%),
    var(--surface);
}

.rec-pipeline { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; position: relative; }
.rec-pipeline::before {
  content: ""; position: absolute; left: 8%; right: 8%; top: 21px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, rgba(193, 233, 252, 0.15), rgba(67, 183, 253, 0.6), rgba(68, 73, 253, 0.5));
}
.rec-pipeline-step { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: 12.5px; line-height: 1.35; }
.rec-pipeline-step strong { font-family: var(--font-display); font-weight: 600; font-size: 14px; color: var(--white); }
.rec-pipeline-glyph {
  position: relative; width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 35% 30%, rgba(67, 183, 253, 0.35), rgba(3, 16, 77, 0.95) 70%);
  border: 1px solid var(--border-strong); box-shadow: 0 0 18px rgba(67, 183, 253, 0.25);
  color: var(--cyan);
}
.rec-pipeline-glyph svg { width: 19px; height: 19px; }
.rec-pipeline-glyph--wave i { height: 14px; width: 2.5px; }

.rec-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 12px; background: rgba(1, 9, 45, 0.4); }
.rec-stat { display: flex; flex-direction: column; padding: 12px 16px; }
.rec-stat:nth-child(even) { border-left: 1px solid var(--border); }
.rec-stat:nth-child(n + 3) { border-top: 1px solid var(--border); }
.rec-stat .stat-value { font-size: 26px; }
.rec-stat .stat-label { font-size: 10px; }

.rec-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.rec-row { border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--glow); transition: border-color 0.15s, background 0.15s; }
.rec-row:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.rec-row--drafted { box-shadow: var(--glow), inset 3px 0 0 var(--violet-soft); }
.rec-row--failed { box-shadow: var(--glow), inset 3px 0 0 var(--danger); }
.rec-row--approved { box-shadow: var(--glow), inset 3px 0 0 var(--ok); }
.rec-row--discarded { opacity: 0.62; }
.rec-row-link { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 14px 18px; color: var(--text); }
.rec-row-link:hover { color: var(--text); }
.rec-row-glyph {
  width: 40px; height: 40px; justify-content: center; border-radius: 11px;
  background: rgba(1, 9, 45, 0.55); border: 1px solid var(--border);
}
.rec-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rec-row-title { font-family: var(--font-display); font-weight: 600; font-size: 16px; color: var(--white); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-row-meta { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-row-side { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.rec-dots { display: inline-flex; align-items: center; gap: 4px; }
.rec-dot { width: 22px; height: 4px; border-radius: 4px; background: rgba(157, 179, 224, 0.18); }
.rec-dot--done { background: var(--ribbon); box-shadow: 0 0 6px rgba(67, 183, 253, 0.45); }
.rec-dot--current { background: var(--warn); animation: pulse 1.8s ease-in-out infinite; }
.rec-dot--failed { background: var(--danger); }

/* ---------- Upload form ---------- */

.rec-new { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.rec-form { gap: 16px; }
.rec-step-head { display: flex; align-items: flex-start; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.rec-step-head h2 { font-size: 16px; }
.rec-step-head p { margin: 2px 0 0; font-size: 13px; }
.rec-step-num {
  flex: none; width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--navy-950); background: var(--ribbon);
  box-shadow: 0 0 14px rgba(67, 183, 253, 0.45);
}

.rec-consent {
  display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: start; padding: 12px 14px; cursor: pointer;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: rgba(1, 9, 45, 0.35);
  transition: border-color 0.15s, background 0.15s;
}
.rec-consent:hover { border-color: var(--border-strong); }
.rec-consent:has(input:checked) { border-color: rgba(62, 230, 168, 0.45); background: rgba(62, 230, 168, 0.05); }
.rec-consent input { margin-top: 2px; accent-color: var(--cyan); width: 16px; height: 16px; }
.rec-consent span { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.rec-consent strong { color: var(--white); font-weight: 600; }
.rec-consent--labels:has(input:checked) { border-color: rgba(138, 141, 255, 0.5); background: rgba(68, 73, 253, 0.08); }
.rec-attendees textarea { min-height: 96px; }

.rec-dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 32px 16px;
  border: 1.5px dashed var(--border-strong); border-radius: 12px; text-align: center; cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.rec-dropzone:hover, .rec-dropzone--over { border-color: var(--cyan); background: rgba(67, 183, 253, 0.06); box-shadow: inset 0 0 34px rgba(67, 183, 253, 0.1); }
.rec-dropzone--chosen { border-style: solid; border-color: rgba(62, 230, 168, 0.6); background: rgba(62, 230, 168, 0.05); }
.rec-dropzone-title { font-weight: 600; color: var(--white); }
.rec-file-input { margin-top: 6px; color: var(--text-muted); max-width: 100%; }
[data-controller~="recording-upload"] .rec-file-input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }

.rec-progress { display: flex; flex-direction: column; gap: 8px; }
.rec-progress-head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; }
.rec-progress .meter { height: 10px; }
.rec-progress .hint { margin: 0; }

.rec-aside { position: sticky; top: 74px; }
.rec-next { margin: 0; padding: 14px 18px 16px 36px; display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; color: var(--text-muted); }
.rec-next strong { color: var(--text); }
.rec-privacy { font-size: 13.5px; }
.rec-privacy svg { width: 14px; height: 14px; vertical-align: -2px; }

/* ---------- Recording page ---------- */

.rec-banner { margin-bottom: 16px; }
.rec-banner svg { width: 15px; height: 15px; vertical-align: -2px; }
.rec-banner--approved { border-color: rgba(62, 230, 168, 0.4); background: rgba(62, 230, 168, 0.07); }

.rec-timeline-panel { display: flex; align-items: center; gap: 18px; padding: 16px 22px; margin-bottom: 16px; }
.rec-timeline { list-style: none; margin: 0; padding: 0; flex: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
.rec-step-node { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rec-node {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid rgba(157, 179, 224, 0.3); background: rgba(1, 9, 45, 0.6);
}
.rec-node svg { width: 14px; height: 14px; color: var(--navy-950); }
.rec-step-node--done .rec-node { border-color: transparent; background: var(--ribbon); box-shadow: 0 0 12px rgba(67, 183, 253, 0.5); }
.rec-step-node--current .rec-node { border-color: var(--warn); box-shadow: 0 0 0 4px rgba(255, 200, 87, 0.12); animation: pulse 1.8s ease-in-out infinite; }
.rec-step-node--failed .rec-node { border-color: var(--danger); background: rgba(255, 93, 122, 0.18); }
.rec-node-text { display: flex; flex-direction: column; min-width: 0; }
.rec-node-label { font-weight: 600; font-size: 13.5px; color: var(--text); white-space: nowrap; }
.rec-step-node--todo .rec-node-label { color: var(--text-faint); }
.rec-node-time { font-size: 12px; white-space: nowrap; }
.rec-step-node--failed .rec-node-time { color: var(--danger); }
.rec-link { flex: 1; min-width: 12px; height: 2px; margin: 0 12px 0 4px; border-radius: 2px; background: rgba(157, 179, 224, 0.16); }
.rec-step-node--done .rec-link { background: linear-gradient(90deg, var(--cyan), rgba(68, 73, 253, 0.6)); }
.rec-step-node:last-child .rec-link { display: none; }
.rec-timeline-status { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

.rec-working { position: relative; overflow: hidden; margin-bottom: 16px; }
.rec-working-wave { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); gap: 4px; opacity: 0.55; }
.rec-working-wave i { height: 30px; animation-duration: 1.1s; }

.rec-review { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.rec-col { min-width: 0; }

.rec-player audio { width: 100%; height: 40px; border-radius: 999px; }
.rec-player .hint { margin: 10px 0 0; }
.rec-player .panel-header .rec-player-glyph { margin-right: 2px; }

.rec-transcript { max-height: calc(100vh - 120px); display: flex; flex-direction: column; }
.rec-turns { list-style: none; margin: 0; padding: 6px 0; overflow-y: auto; }
.rec-turn { padding: 10px 18px 10px 16px; border-left: 3px solid var(--speaker); margin-left: 12px; }
.rec-turn + .rec-turn { margin-top: 2px; }
.rec-turn:hover { background: rgba(23, 66, 149, 0.18); }
.rec-turn-head { display: flex; align-items: center; gap: 10px; margin-bottom: 3px; }
.rec-turn-speaker { font-family: var(--font-display); font-weight: 600; font-size: 13px; color: var(--speaker); }
.rec-turn p { margin: 0; color: var(--text); line-height: 1.6; }
.rec-time {
  padding: 1px 7px; border-radius: 6px; border: 1px solid var(--border); background: rgba(1, 9, 45, 0.5);
  color: var(--text-muted); font-size: 11.5px; cursor: pointer;
}
.rec-time:hover { color: var(--white); border-color: var(--cyan); }

.rec-speakers { border-bottom: 1px solid var(--border); }
.rec-speakers summary { cursor: pointer; padding: 10px 18px; font-size: 13.5px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.rec-speakers summary svg { width: 16px; height: 16px; color: var(--cyan); flex: none; }
.rec-speakers-title { font-weight: 600; white-space: nowrap; }
.rec-speakers summary .faint { font-size: 12.5px; }
.rec-speakers-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; padding: 4px 18px 14px; }
.rec-speaker-field { flex: 1 1 180px; gap: 4px; }
.rec-speaker-chip { color: var(--speaker) !important; font-family: var(--font-display); }

.rec-draft-tabs { display: inline-flex; padding: 3px; border-radius: 9px; background: rgba(1, 9, 45, 0.55); border: 1px solid var(--border); }
.rec-draft-tab { padding: 4px 12px; border-radius: 7px; border: 0; background: none; color: var(--text-muted); font: 600 12.5px var(--font-body); cursor: pointer; }
.rec-draft-tab--active { background: var(--surface-hover); color: var(--white); }
.rec-draft-form { display: flex; flex-direction: column; }
.rec-draft-text {
  width: 100%; min-height: 560px; padding: 16px 18px; border: 0; border-bottom: 1px solid var(--border); resize: vertical;
  background: rgba(1, 9, 45, 0.45); color: var(--text); font: 13px/1.65 var(--font-mono); outline: none;
}
.rec-draft-text:focus { box-shadow: inset 0 0 0 2px rgba(67, 183, 253, 0.3); }
.rec-draft-actions { display: flex; align-items: center; gap: 10px; padding: 10px 18px; }

.rec-markdown { font-size: 14px; line-height: 1.6; }
.rec-markdown h2 { font-size: 21px; margin: 0 0 10px; }
.rec-markdown h3 { font-size: 15px; margin: 18px 0 6px; color: var(--sky); font-family: var(--font-display); letter-spacing: 0.01em; }
.rec-markdown h4, .rec-markdown h5 { font-size: 14px; margin: 14px 0 6px; }
.rec-markdown p { margin: 0 0 8px; color: var(--text); }
.rec-markdown em { color: var(--text-muted); }
.rec-markdown ul, .rec-markdown ol { margin: 0 0 10px; padding-left: 20px; }
.rec-markdown li { margin: 3px 0; }
.rec-markdown li::marker { color: var(--cyan); }

.rec-consents { list-style: none; margin: 0; padding: 6px 0; }
.rec-consents li { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; padding: 7px 18px; font-size: 13.5px; }
.rec-consents li + li { border-top: 1px solid rgba(67, 183, 253, 0.08); }
.rec-visibility { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.rec-visibility svg { width: 12px; height: 12px; }
.rec-ledger-link { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 0 4px; }
.rec-ledger-link svg { width: 14px; height: 14px; }

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  .rec-review { grid-template-columns: 1fr; }
  .rec-transcript { max-height: 70vh; }
}
@media (max-width: 1100px) {
  .rec-hero { grid-template-columns: 1fr; }
  .rec-new { grid-template-columns: 1fr; }
  .rec-aside { position: static; }
}
@media (max-width: 760px) {
  .rec-pipeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rec-pipeline::before { display: none; }
  .rec-row-link { grid-template-columns: 34px minmax(0, 1fr); }
  .rec-row-side { grid-column: 1 / -1; justify-content: flex-start; }
  .rec-timeline-panel { flex-direction: column; align-items: stretch; }
  .rec-timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .rec-link { display: none; }
  .rec-timeline-status { align-items: flex-start; }
}
