/* styles.css */
:root {
  --bg: #0b0c10;
  --panel: #10121a;
  --card: #131626;
  --text: #e8e9f2;
  --muted: #a2a6ba;
  --border: rgba(255,255,255,.10);
  --accent: #5dd6ff;
  --accent2: #b18cff;
  --danger: #ff657a;

  --radius: 14px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: var(--bg);          /* solid base (prevents horizontal glow bands) */
  color: var(--text);
  position: relative;             /* for ::before glow layer */
  overflow-x: hidden;
}

/* Decorative glow only at the top (prevents bands mid-page / footer area) */
body::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 720px; /* adjust if you want more/less glow reach */
  background:
    radial-gradient(1200px 600px at 20% 0%, rgba(93,214,255,.14), transparent 60%),
    radial-gradient(900px 500px at 90% 10%, rgba(177,140,255,.12), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* Keep all page content above the glow layer */
body > * {
  position: relative;
  z-index: 1;
}

a { color: inherit; }

.header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 18px 18px 10px;
  backdrop-filter: blur(10px);
  background: rgba(11,12,16,.75);
  border-bottom: 1px solid var(--border);
}

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

.logo {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: linear-gradient(135deg, rgba(93,214,255,.25), rgba(177,140,255,.25));
  border: 1px solid var(--border);
}

.logo img { width: 32px; height: 32px; display: block; }

.title { font-weight: 800; letter-spacing: .2px; }
.subtitle { font-size: 13px; color: var(--muted); margin-top: 2px; }

.nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tab {
  border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.tab.active {
  background: linear-gradient(135deg, rgba(93,214,255,.22), rgba(177,140,255,.18));
  border-color: rgba(93,214,255,.35);
}

/* Make tab-style links look like the button tabs */
a.tab {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.main {
  padding: 18px;
  max-width: 1150px;
  margin: 0 auto;
}

.panel { display: none; }
.panel.active { display: block; }

.panel-head {
  margin: 12px 0 14px;
}
h1 {
  margin: 0 0 6px;
  font-size: 26px;
}
h2 { margin-top: 22px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }

.dropzone {
  border: 1px dashed rgba(255,255,255,.18);
  border-radius: var(--radius);
  background: rgba(19,22,38,.82); /* patched: more opaque */
  padding: 20px;
  box-shadow: var(--shadow);
}
.dropzone.dragover {
  border-color: rgba(93,214,255,.55);
  background: rgba(93,214,255,.06);
}
.dropzone-inner {
  display: grid;
  gap: 10px;
  place-items: center;
  text-align: center;
  padding: 8px 0;
}
.dz-title { font-weight: 800; font-size: 18px; }
.dz-sub { color: var(--muted); font-size: 13px; }

.row {
  display: flex;
  gap: 14px;
  margin-top: 14px;
  align-items: stretch;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(19,22,38,.88); /* patched: more opaque */
  padding: 14px;
  box-shadow: var(--shadow);
}
.card.side { width: 340px; max-width: 100%; }
.card.grow { flex: 1; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.card-title { font-weight: 800; }
.card-actions { display: flex; gap: 10px; }

.field { display: grid; gap: 6px; margin: 12px 0; }
label { font-size: 13px; color: var(--muted); }
label.inline { display:flex; align-items:center; justify-content: space-between; gap: 12px; }

input[type="text"], input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.18);
  color: var(--text);
  outline: none;
}
input[type="text"]:focus {
  border-color: rgba(93,214,255,.5);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  user-select: none;
}
.btn:hover { border-color: rgba(255,255,255,.25); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(135deg, rgba(93,214,255,.22), rgba(177,140,255,.18));
  border-color: rgba(93,214,255,.35);
}
.btn.secondary {
  background: rgba(255,255,255,.04);
}

.actions { margin-top: 10px; display:flex; gap: 10px; }
.status { margin-top: 10px; min-height: 18px; }

.divider { height: 1px; background: var(--border); margin: 14px 0; }

.file-list {
  display: grid;
  gap: 10px;
}

.file-item {
  display: grid;
  grid-template-columns: 74px 1fr auto;
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(19,22,38,.82); /* patched: more opaque */
}
.file-item.dragging {
  opacity: .55;
  border-color: rgba(93,214,255,.5);
}

.thumb-wrap {
  width: 74px;
  height: 96px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.thumb-canvas {
  width: 70px;
  height: auto;
  display: block;
}

.file-meta {
  display: grid;
  gap: 4px;
  align-content: start;
}
.file-name {
  font-weight: 700;
  line-height: 1.15;
  word-break: break-word;
}
.file-sub {
  font-size: 13px;
  color: var(--muted);
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
}

.file-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.icon-btn {
  border-radius: 12px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  cursor: pointer;
  color: var(--text);
  min-width: 88px;
}
.icon-btn:hover { border-color: rgba(255,255,255,.25); }
.icon-btn.danger { border-color: rgba(255,101,122,.25); }
.icon-btn.danger:hover { border-color: rgba(255,101,122,.5); }

.extract-preview {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.extract-meta { flex: 1; }

.tip-grid {
  display: grid;
  gap: 10px;
  max-width: 420px;
}

.footer {
  padding: 20px 18px 34px;
  text-align: center;
}

code {
  padding: 2px 6px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.18);
  font-size: .95em;
}

@media (max-width: 920px) {
  .row { flex-direction: column; }
  .card.side { width: auto; }
  .file-item { grid-template-columns: 74px 1fr; }
  .file-actions { flex-direction: row; flex-wrap: wrap; justify-content: flex-end; }
}

.mode-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.14);
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
}
.radio input { accent-color: auto; }

.thumb-placeholder{
  width: 70px;
  height: 96px;
  display: grid;
  place-items: center;
  color: rgba(255,255,255,.25);
  font-size: 12px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 12px;
  background: rgba(0,0,0,.14);
}

.notice{
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
}
.notice.small{ font-size: 13px; color: rgba(255,255,255,.78); }
.mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }

/* --- Patch: center header + tabs + panel headings (mobile-first) --- */
.brand { justify-content: center; }
.brand > div { text-align: center; }
.nav { justify-content: center; }
.panel-head { text-align: center; }

/* --- Security/UX patch (20260102-sec1) --- */

/* better focus visibility */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid rgba(93,214,255,.85);
  outline-offset: 2px;
}

.tab[aria-selected="true"] {
  background: linear-gradient(135deg, rgba(93,214,255,.22), rgba(177,140,255,.18));
  border-color: rgba(93,214,255,.35);
}

/* busy state */
.spinner {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,.25);
  border-top-color: rgba(255,255,255,.85);
  display: none;
}
.btn[data-busy="true"] .spinner { display: inline-block; }
.btn[data-busy="true"] .btn-label { opacity: .8; }
.btn[data-busy="true"] { cursor: progress; }

@keyframes spin { to { transform: rotate(360deg); } }
.btn[data-busy="true"] .spinner { animation: spin .8s linear infinite; }

.panel[aria-busy="true"] {
  opacity: .92;
}

/* dialog */
.dialog::backdrop { background: rgba(0,0,0,.55); }
.dialog {
  border: none;
  padding: 0;
  border-radius: 16px;
  background: transparent;
  width: min(520px, calc(100vw - 24px));
}
.dialog-card {
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 16px;
  background: rgba(16,18,26,.98);
  box-shadow: var(--shadow);
  padding: 16px;
}
.check {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  user-select: none;
  cursor: pointer;
  margin: 8px 0 2px;
}
.check input { accent-color: auto; }

/* nicer disabled link */
a[aria-disabled="true"] { pointer-events: none; opacity: .55; }

/* reduce motion */
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .btn[data-busy="true"] .spinner { animation: none; }
}

/* --- Patch: Support stack (tips) (20260102-tip1) --- */
.support-stack {
  display: grid;
  gap: 12px;
  max-width: 420px;
  margin: 0 auto;
}
.support-row {
  display: grid;
  gap: 6px;
}
.support-btn {
  width: 100%;
}

/* Add vertical spacing after rows so following cards don't touch */
.row {
  margin-bottom: 14px;
}
