/* ============================================================
   ivLyrics Sync — App Styles
   ============================================================ */

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }

body {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--ob-bg);
  color: var(--ob-fg);
  font-family: var(--ob-font);
  font-size: var(--ob-fs-sm);
  line-height: var(--ob-lh-relaxed);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

::-webkit-scrollbar        { width: 5px; height: 5px; }
::-webkit-scrollbar-track  { background: transparent; }
::-webkit-scrollbar-thumb  { background: var(--ob-line); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--ob-ink-mute); }
::selection { background: var(--ob-blue-100); color: var(--ob-ink-strong); }

/* ── Header ───────────────────────────────────────────────── */
header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--ob-s-3);
  padding: 18px var(--ob-s-7);
  border-bottom: 1px solid var(--ob-line-soft);
}

.logo-mark { width: 36px; height: 36px; flex-shrink: 0; }

.brand h1 {
  font-size: var(--ob-fs-md);
  font-weight: var(--ob-w-bold);
  letter-spacing: var(--ob-tracking-tight);
  color: var(--ob-fg-strong);
  line-height: var(--ob-lh-snug);
}
.brand h1 em { font-style: normal; color: var(--ob-blue); }

.brand p {
  font-family: var(--ob-font-mono);
  font-size: 10.5px;
  font-weight: var(--ob-w-medium);
  letter-spacing: var(--ob-tracking-wide);
  text-transform: uppercase;
  color: var(--ob-fg-mute);
  margin-top: 2px;
}

/* ── Tab Navigation ───────────────────────────────────────── */
.tabs-nav-wrap {
  flex-shrink: 0;
  padding: var(--ob-s-3) var(--ob-s-7) 0;
}

.tabs-nav {
  display: inline-flex;
  gap: 3px;
  background: var(--ob-bg-alt);
  border: 1px solid var(--ob-line);
  border-radius: var(--ob-r-md);
  padding: 4px;
}

.tab-btn {
  padding: 7px var(--ob-s-4);
  border: none;
  background: transparent;
  color: var(--ob-fg-soft);
  font-family: var(--ob-font);
  font-size: var(--ob-fs-xs);
  font-weight: var(--ob-w-medium);
  border-radius: var(--ob-r-sm);
  cursor: pointer;
  transition:
    background var(--ob-dur-fast) var(--ob-ease),
    color var(--ob-dur-fast) var(--ob-ease);
  white-space: nowrap;
}
.tab-btn:hover { color: var(--ob-fg); background: rgba(10, 10, 10, 0.04); }
.tab-btn.active { background: var(--ob-blue); color: var(--ob-fg-on-color); }

/* ── Main ─────────────────────────────────────────────────── */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: var(--ob-s-4) var(--ob-s-7);
  min-height: 0;
  overflow: hidden;
}

/* ── Tab Panels ───────────────────────────────────────────── */
.tab-panel { display: none; flex: 1; flex-direction: column; min-height: 0; }
.tab-panel.active { display: flex; }

/* ── Panel Grid ───────────────────────────────────────────── */
.panel-grid {
  display: grid;
  grid-template-columns: 1fr 136px 1fr;
  gap: var(--ob-s-3);
  flex: 1;
  min-height: 0;
}

/* ── Card ─────────────────────────────────────────────────── */
.card {
  background: var(--ob-bg);
  border: 1px solid var(--ob-line);
  border-radius: var(--ob-r-md);
  padding: var(--ob-s-4) 18px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.card-label {
  font-family: var(--ob-font-mono);
  font-size: 10px;
  font-weight: var(--ob-w-semibold);
  letter-spacing: var(--ob-tracking-wide);
  text-transform: uppercase;
  color: var(--ob-fg-mute);
  margin-bottom: 10px;
  flex-shrink: 0;
}
.card-label em { font-style: normal; color: var(--ob-blue); }

/* ── Textareas ────────────────────────────────────────────── */
.textarea-editor {
  display: grid;
  grid-template-columns: auto 1fr;
  flex: 1;
  min-height: 0;
  width: 100%;
  border: 1.5px solid var(--ob-line);
  border-radius: 10px;
  overflow: hidden;
  transition:
    border-color var(--ob-dur-fast) var(--ob-ease),
    box-shadow var(--ob-dur-fast) var(--ob-ease);
}
.textarea-editor:focus-within {
  border-color: var(--ob-blue);
  box-shadow: 0 0 0 4px rgba(10, 78, 228, 0.16);
}

.line-gutter {
  background: var(--ob-bg-alt);
  border-right: 1px solid var(--ob-line);
  padding: var(--ob-s-3) 8px;
  font-family: var(--ob-font-mono);
  font-size: var(--ob-fs-xs);
  line-height: 1.75;
  color: var(--ob-fg-mute);
  text-align: right;
  overflow: hidden;
  user-select: none;
  white-space: pre;
  min-width: 28px;
}

textarea {
  min-height: 0;
  width: 100%;
  background: var(--ob-bg-alt);
  border: none;
  border-radius: 0;
  color: var(--ob-fg-strong);
  font-family: var(--ob-font-mono);
  font-size: var(--ob-fs-xs);
  line-height: 1.75;
  padding: var(--ob-s-3) var(--ob-s-3);
  resize: none;
  outline: none;
  overflow-y: auto;
}
textarea:focus {
  background: var(--ob-bg);
}
textarea.is-output {
  background: var(--ob-bg-warm);
  color: var(--ob-fg-strong);
}
textarea.is-output:focus {
  background: var(--ob-bg-warm);
}
textarea::placeholder { color: var(--ob-fg-mute); }

/* Stacked inputs */
.inputs-stack { display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 0; }
.input-block   { display: flex; flex-direction: column; min-height: 0; }
.input-block.grow-1 { flex: 1; }
.input-block.grow-2 { flex: 2; }

/* ── Splitters ────────────────────────────────────────────── */
.splitter-v {
  flex-shrink: 0;
  height: 6px;
  background: var(--ob-bg-alt);
  border-top: 1px solid var(--ob-line);
  border-bottom: 1px solid var(--ob-line);
  cursor: row-resize;
  display: flex;
  align-items: center;
  justify-content: center;
}
.splitter-v::after {
  content: '';
  display: block;
  width: 32px;
  height: 2px;
  border-radius: 2px;
  background: var(--ob-ink-mute);
  opacity: 0.4;
}
.splitter-v:hover::after { opacity: 0.8; }

.splitter-h-handle {
  width: 8px;
  height: 48px;
  background: var(--ob-bg-alt);
  border: 1px solid var(--ob-line);
  border-radius: var(--ob-r-xs);
  cursor: col-resize;
  transition: background var(--ob-dur-fast) var(--ob-ease), border-color var(--ob-dur-fast) var(--ob-ease);
}
.splitter-h-handle:hover {
  background: var(--ob-blue-050);
  border-color: var(--ob-blue);
}

/* ── Action Column ────────────────────────────────────────── */
.action-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--ob-s-2);
  padding: 0 2px;
}

.arrow {
  color: var(--ob-line);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: var(--ob-s-1) 0;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--ob-s-2);
  width: 100%;
  border: none;
  border-radius: 10px;
  font-family: var(--ob-font);
  font-size: var(--ob-fs-xs);
  font-weight: var(--ob-w-semibold);
  cursor: pointer;
  padding: 9px var(--ob-s-3);
  transition:
    background var(--ob-dur-fast) var(--ob-ease),
    box-shadow var(--ob-dur-fast) var(--ob-ease),
    border-color var(--ob-dur-fast) var(--ob-ease),
    opacity var(--ob-dur-fast) var(--ob-ease);
  white-space: normal;
  line-height: var(--ob-lh-snug);
  text-align: center;
  flex-shrink: 0;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ob-focus-ring); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--ob-blue); color: var(--ob-fg-on-color); }
.btn-primary:hover:not(:disabled) {
  background: var(--ob-blue-700);
  box-shadow: var(--ob-shadow-pop);
}

.btn-success { background: var(--ob-green); color: var(--ob-fg-on-color); }
.btn-success:hover:not(:disabled) {
  background: var(--ob-green-700);
  box-shadow: 0 6px 18px rgba(119, 158, 61, 0.28);
}

.btn-secondary {
  background: var(--ob-bg);
  color: var(--ob-fg-strong);
  border: 1.5px solid var(--ob-line);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--ob-ink); }

.btn-ghost {
  background: transparent;
  color: var(--ob-blue);
  border: none;
}
.btn-ghost:hover:not(:disabled) { background: var(--ob-blue-050); }

/* ── Spinner ──────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  flex-shrink: 0;
}

/* ── Footer ───────────────────────────────────────────────── */
footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ob-s-3);
  padding: 10px var(--ob-s-7) var(--ob-s-3);
  border-top: 1px solid var(--ob-line);
}

#status {
  font-family: var(--ob-font-mono);
  font-size: 11px;
  color: var(--ob-fg-soft);
  transition: color var(--ob-dur-base);
}
#status.ok  { color: var(--ob-green); }
#status.err { color: var(--ob-danger); }

.footer-btns { display: flex; gap: 7px; }
.footer-btns .btn {
  width: auto;
  padding: 8px var(--ob-s-4);
  font-size: var(--ob-fs-xs);
  white-space: nowrap;
}

/* ── Keyboard hint ────────────────────────────────────────── */
.kbd-hint {
  font-family: var(--ob-font-mono);
  font-size: 10px;
  color: var(--ob-fg-mute);
  text-align: center;
  margin-top: 2px;
}
kbd {
  display: inline-block;
  background: var(--ob-bg-alt);
  border: 1px solid var(--ob-line);
  border-radius: var(--ob-r-xs);
  padding: 0 4px;
  font-family: var(--ob-font-mono);
  font-size: 10px;
  color: var(--ob-fg-soft);
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 800px) {
  body { overflow: auto; }
  header, .tabs-nav-wrap, main, footer { padding-left: var(--ob-s-4); padding-right: var(--ob-s-4); }
  .panel-grid { grid-template-columns: 1fr; grid-template-rows: auto auto auto; overflow: visible; }
  .action-col { flex-direction: row; flex-wrap: wrap; justify-content: center; padding: 0; }
  .action-col .btn { width: auto; flex: 1; max-width: 180px; white-space: nowrap; }
  .arrow { display: none; }
  textarea { min-height: 180px; }
  .card { overflow: visible; }
  .inputs-stack .input-block textarea { min-height: 140px; }
  .splitter-v { display: none; }
  .splitter-h-handle { display: none; }
  .input-block.grow-1, .input-block.grow-2 { flex: 1 !important; }
}
