/* ---------- Inter (servida en local: la CSP bloquea fuentes externas) ---------- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308,
    U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113,
    U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --pink: #ff2e88;
  --pad: 40px;         /* margen lateral */
  --bg: #0d0d10;
  --panel: #141419;
  --line: #26262e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: #e8e8ec;
  font-family: "Inter", -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  padding-bottom: 60px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- header ---------- */
header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px var(--pad);
  border-bottom: 1px solid var(--line);
}
h1 { font-size: 18px; letter-spacing: 3px; margin: 0; font-weight: 700; color: #fff; }
h1 span { color: var(--pink); font-weight: 400; }
nav { display: flex; gap: 6px; align-items: center; }
nav a {
  color: #fff; text-decoration: none; font-weight: 500;
  padding: 8px 16px; border-radius: 8px; transition: background .15s, color .15s;
}
nav a:hover { background: #ffffff14; }
nav a.active { background: var(--pink); color: #fff; font-weight: 600; }
nav a.active:hover { background: var(--pink); filter: brightness(1.08); }

/* ---------- layout ---------- */
section { padding: 18px var(--pad); }
h2 { font-size: 15px; font-weight: 600; border-left: 3px solid var(--pink); padding-left: 10px; }
h2 small { color: #888; font-weight: 400; }
.error { background: #3a1220; color: #ff7ba6; padding: 10px var(--pad); }
.ok { background: #12301c; color: #7be0a0; padding: 10px var(--pad); }
details { padding: 6px var(--pad); } details summary { cursor: pointer; color: #aaa; }
pre { overflow-x: auto; }

/* ---------- formularios ---------- */
label { display: block; margin: 8px 0; color: #bbb; }
input, textarea, select {
  width: 100%; background: #17171c; color: #eee;
  border: 1px solid #2e2e38; border-radius: 6px; padding: 8px;
  font-family: inherit; font-size: inherit;
}
textarea { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
button {
  background: #26262e; color: #eee; border: 0; border-radius: 6px;
  padding: 10px 18px; margin: 6px 6px 0 0; cursor: pointer;
  font-family: inherit; font-size: inherit; font-weight: 500;
}
button.primary { background: var(--pink); color: #fff; font-weight: 600; }
button.big { font-size: 16px; padding: 14px 40px; }
button.danger { background: #3a1220; color: #ff7ba6; }
button.ok-btn { background: #12301c; color: #7be0a0; }
button:hover { filter: brightness(1.15); }

/* ---------- tarjetas seleccionables (motor / identidad / prompt) ---------- */
.engine-row { display: flex; gap: 12px; flex-wrap: wrap; }
.pick {
  display: block; cursor: pointer; background: var(--panel);
  border: 2px solid var(--line); border-radius: 10px;
  padding: 12px 16px; flex: 1; min-width: 180px; margin: 0;
  transition: background .15s, border-color .15s;
}
.pick input { display: none; }
.pick small { display: block; color: #888; }
.pick pre { font-size: 10px; color: #9fd; white-space: pre-wrap; margin: 6px 0 0; max-height: 90px; overflow: hidden; }
.pick:hover { border-color: #3a3a46; }
/* seleccionado: fondo rosa opaco y letra blanca */
.pick:has(input:checked) { background: var(--pink); border-color: var(--pink); color: #fff; }
.pick:has(input:checked) strong { color: #fff; }
.pick:has(input:checked) small { color: #ffffffcc; }
.pick:has(input:checked) pre { color: #fff; }
.identities { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.identity div { pointer-events: none; }

/* ---------- dropzone ---------- */
.dropzone { border: 2px dashed #3a3a46; border-radius: 12px; padding: 30px; text-align: center; color: #888; cursor: pointer; }
.dropzone.over { border-color: var(--pink); color: var(--pink); }
.dropzone img { max-width: 240px; border-radius: 10px; margin-top: 10px; }
.extra-refs { margin-top: 10px; }
.extra-ref-row { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: 8px; cursor: pointer; }
.extra-ref-row img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
.extra-ref-row span { flex: 1; color: #bbb; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.extra-ref-row button { margin: 0; padding: 6px 12px; font-size: 11px; }

/* ---------- controles / edicion ---------- */
.controls { display: flex; gap: 12px; } .controls label { flex: 1; }
.controls.wrap { flex-wrap: wrap; } .controls.wrap label { flex: 1 1 160px; }
.ident-edit, .structure-edit { display: grid; grid-template-columns: 180px 1fr auto; gap: 8px; align-items: start; margin: 10px 0; }
.checkline { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: #aaa; }
.checkline input { width: auto; margin-top: 2px; }
.inset { padding-left: 10px; color: #ffb0d0; font-size: 13px; }
.hint { color: #888; }

/* ---------- resultados ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.grid img { width: 100%; border-radius: 8px; display: block; cursor: zoom-in; }

/* ---------- lightbox (popup foto + prompt), mitad y mitad ---------- */
.lightbox-overlay { position: fixed; inset: 0; background: #000c; display: none; align-items: center; justify-content: center; z-index: 1000; padding: 24px; }
.lightbox-overlay.open { display: flex; }
.lightbox-box { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; max-width: 1100px; width: 100%; height: 88vh; display: flex; flex-direction: row; overflow: hidden; }
.lightbox-close { position: absolute; top: 6px; right: 10px; background: none; border: none; color: #fff; font-size: 26px; line-height: 1; cursor: pointer; z-index: 1; }
.lightbox-img-wrap { flex: 1 1 50%; background: #000; display: flex; align-items: center; justify-content: center; overflow: hidden; min-width: 0; }
.lightbox-img-wrap img { max-width: 100%; max-height: 100%; display: block; object-fit: contain; }
.lightbox-right { flex: 1 1 50%; display: flex; flex-direction: column; min-width: 0; border-left: 1px solid var(--line); }
.lightbox-actions { display: flex; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.lightbox-actions + .hint { padding: 0 14px 10px; margin: 0; border-bottom: 1px solid var(--line); }
.lightbox-prompt { flex: 1; margin: 0; padding: 10px 14px; overflow: auto; font-size: 11px; color: #9fd; white-space: pre-wrap; font-family: ui-monospace, Consolas, monospace; }
@media (max-width: 800px) {
  .lightbox-box { flex-direction: column; height: 92vh; }
  .lightbox-img-wrap { flex: 0 0 40%; }
  .lightbox-right { flex: 1 1 60%; border-left: 0; border-top: 1px solid var(--line); }
}
.card { position: relative; background: var(--panel); border-radius: 8px; overflow: hidden; }
.card.saved { outline: 2px solid #2fbf6b; }
.card.detailed { opacity: 0.55; }
.card.detailing { outline: 2px solid #e8b23a; }
.badge { position: absolute; top: 6px; left: 6px; font-size: 10px; padding: 2px 8px; border-radius: 10px; background: #000a; color: #ccc; }
.badge.saved { background: #12301c; color: #7be0a0; }
.badge.detailing { background: #4a3a10; color: #ffd27b; }
.badge.pending { display: none; }
.card .actions { display: flex; gap: 4px; padding: 6px; }
.card .actions button { flex: 1; margin: 0; padding: 6px 4px; font-size: 11px; }
.joblist { list-style: none; padding: 0; } .joblist a { color: var(--pink); }
.job-head { display: flex; gap: 20px; align-items: flex-start; padding: 18px var(--pad); }
.job-head .ref { max-width: 220px; border-radius: 10px; }
.status { color: var(--pink); }
.status.st-ok { color: #7be0a0; }
.status.st-error { color: #ff7ba6; }
.status.st-run { color: #ffd27b; }
.error-line { color: #ff7ba6; background: #3a122033; padding: 6px 10px; border-radius: 6px; font-size: 12px; }

/* ---------- GPU ---------- */
.instance { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin: 8px 0; }
.instance code { color: #9fd; }
.instance-actions { display: flex; gap: 6px; }
table.offers { width: 100%; border-collapse: collapse; font-size: 12px; }
table.offers th, table.offers td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--line); }
table.offers th { color: #888; font-weight: 500; }
table.offers button { padding: 6px 14px; margin: 0; }

/* ---------- login ---------- */
.login-wrap { display: flex; justify-content: center; padding-top: 8vh; }
.login-form { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px 32px; width: 340px; }
.login-form h2 { border: 0; padding: 0; }

/* ---------- comparativa (vista antigua) ---------- */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 0 var(--pad); }
.compare .col { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.compare pre { white-space: pre-wrap; font-size: 11px; color: #9fd; background: var(--bg); padding: 8px; border-radius: 6px; }

@media (max-width: 800px) {
  :root { --pad: 16px; }
  .compare { grid-template-columns: 1fr; }
  .job-head { flex-direction: column; }
  header { flex-direction: column; gap: 12px; align-items: flex-start; }
  nav { flex-wrap: wrap; }
}
