/* VideoNotes AI - Phase 1. Created by Harendra Singh Chauhan */
:root {
  --paper: #f2f5fa;
  --sheet: #ffffff;
  --ink: #14213d;
  --ink-soft: #55607a;
  --rule: #d6dce8;
  --hi: #ffd84d;
  --hi-deep: #f2c200;
  --red: #b3321b;
  --red-bg: #fdecea;
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Noto Sans Devanagari", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--paper); color: var(--ink);
  font-family: var(--font-body); font-size: 1rem; line-height: 1.6;
}
.top { padding: 18px clamp(16px, 5vw, 56px); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; letter-spacing: -0.01em; }

main { width: 100%; max-width: 860px; margin: 0 auto; padding: 8px clamp(16px, 5vw, 24px) 48px; flex: 1; }

.intro { margin: 28px 0 28px; }
h1 {
  font-family: var(--font-display); font-weight: 800; letter-spacing: -0.02em;
  font-size: clamp(1.9rem, 5.2vw, 3.1rem); line-height: 1.08; margin: 0 0 14px; max-width: 18ch;
  text-wrap: balance;
}
.lede { margin: 0; max-width: 56ch; color: var(--ink-soft); font-size: 1.05rem; }

.panel, .doc {
  background: var(--sheet); border: 1.5px solid var(--ink); border-radius: 6px;
  box-shadow: 5px 5px 0 var(--ink);
}
.panel { padding: clamp(16px, 3vw, 26px); }
.field-label { display: block; font-weight: 600; margin-bottom: 8px; }
.field-label.small { font-size: .9rem; color: var(--ink-soft); margin-bottom: 4px; }
.row { display: flex; gap: 14px; }
.row-actions { margin-top: 16px; align-items: flex-end; flex-wrap: wrap; }
.select-wrap { flex: 1 1 200px; }

input[type="url"], select {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 1.5px solid var(--rule); border-radius: 6px; padding: 12px 14px; min-height: 48px;
}
input[type="url"]:focus, select:focus, textarea:focus { outline: 3px solid var(--hi); outline-offset: 1px; border-color: var(--ink); }

.btn {
  font: 600 1rem var(--font-body); min-height: 48px; padding: 0 20px; cursor: pointer;
  border: 1.5px solid var(--ink); border-radius: 6px; background: #fff; color: var(--ink);
  transition: transform .08s ease, background-color .15s ease;
}
.btn:hover { background: #eef1f8; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--hi); outline-offset: 2px; }
.btn.primary { background: var(--hi); }
.btn.primary:hover { background: var(--hi-deep); }
.btn.ghost { border-color: var(--rule); color: var(--ink-soft); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
#extractBtn { flex: 0 0 auto; min-width: 190px; }

.progress { margin-top: 20px; }
.bar { height: 6px; background: var(--rule); border-radius: 3px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 35%; background: var(--ink); border-radius: 3px; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
.progress p { margin: 8px 0 0; color: var(--ink-soft); font-size: .95rem; }

.error {
  margin-top: 18px; padding: 12px 14px; background: var(--red-bg); color: var(--red);
  border-left: 5px solid var(--red); border-radius: 4px; font-weight: 600;
}
.error small { display: block; font-weight: 400; margin-top: 4px; }

.result { margin-top: 40px; }
.video-head { margin-bottom: 18px; }
.video-kicker { margin: 0; color: var(--ink-soft); font-size: .9rem; }
h2 { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.3rem, 3.4vw, 1.8rem); line-height: 1.25; margin: 2px 0 6px; overflow-wrap: anywhere; }
.meta { margin: 0; color: var(--ink-soft); font-size: .95rem; }

.doc { overflow: hidden; }
.doc-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 18px; border-bottom: 1.5px solid var(--ink); background: var(--hi); }
.doc-title { margin: 0; font-family: var(--font-display); font-size: 1.1rem; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .95rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }

textarea#transcript {
  display: block; width: 100%; height: min(60vh, 520px); min-height: 260px; resize: vertical;
  border: 0; padding: 18px; font: 1.02rem/1.85 var(--font-body); color: var(--ink);
  background: repeating-linear-gradient(to bottom, #fff 0, #fff calc(1.85em - 1px), #e9edf5 calc(1.85em - 1px), #e9edf5 1.85em);
  background-attachment: local;
}
.doc-foot { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 18px; border-top: 1.5px solid var(--ink); }
.stats { margin: 0; color: var(--ink-soft); font-size: .95rem; }
.stats span { color: var(--ink); font-weight: 600; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.foot { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 26px 16px 30px; border-top: 1.5px solid var(--rule); color: var(--ink-soft); text-align: center; }
.foot strong { font-family: var(--font-display); color: var(--ink); font-size: 1.05rem; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 6px; font-weight: 600; z-index: 10; max-width: calc(100vw - 32px); }

[hidden] { display: none !important; }

@media (max-width: 560px) {
  .row-actions { flex-direction: column; align-items: stretch; }
  .select-wrap { flex: 0 0 auto; }
  #extractBtn { width: 100%; }
  .actions { width: 100%; }
  .actions .btn { flex: 1 1 auto; padding: 0 12px; }
  .panel, .doc { box-shadow: 3px 3px 0 var(--ink); }
}
@media (prefers-reduced-motion: reduce) {
  .bar span { animation: none; width: 100%; opacity: .5; margin: 0; }
  .btn { transition: none; }
}

.notes-panel { margin-top: 34px; }
.notes-panel h2 { font-size: clamp(28px, 5vw, 40px); margin: 8px 0 24px; }
#sourceText { width: 100%; min-height: 180px; border: 2px solid var(--ink); padding: 16px; font: inherit; resize: vertical; }
#notesOutput { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; line-height: 1.8; }
#notesStatus { min-height: 1.5em; }
@media print {
  body { background: white; }
  .top, .intro, #form, #result, .foot, .toast, .notes-panel > :not(#notesResult), #savePdf { display: none !important; }
  .notes-panel { border: 0; box-shadow: none; padding: 0; margin: 0; }
  #notesResult { display: block !important; }
  main { width: 100%; max-width: none; margin: 0; padding: 0; }
}
