/* Multilingual Trebe Realtime Plus Web — mismo aspecto que la app de escritorio (Trebe Design System) */
@font-face { font-family: "Poppins"; src: url("/static/assets/fonts/Poppins-Light.ttf") format("truetype"); font-weight: 300; }
@font-face { font-family: "Poppins"; src: url("/static/assets/fonts/Poppins-Regular.ttf") format("truetype"); font-weight: 400; }
@font-face { font-family: "Poppins"; src: url("/static/assets/fonts/Poppins-Medium.ttf") format("truetype"); font-weight: 500; }
@font-face { font-family: "Poppins"; src: url("/static/assets/fonts/Poppins-SemiBold.ttf") format("truetype"); font-weight: 600; }

:root {
  --navy: #031F46; --cyan: #00EAFF; --orange: #F7931E; --orange-hover: #E8851A;
  --bg: #04122A; --surface: #071C3B; --surface-2: #0D2A52; --hover: #12376A;
  --border: #164272; --border-strong: #1D5894; --text: #EAF1FA; --text-2: #8BA7CA; --text-3: #47658D;
  --selection: #1D5894; --rec: #E66767; --ok: #3FD17A;
  --col-size: 17px; --col-lh: 1.6;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { background: var(--bg); color: var(--text); font: 400 14px/1.4 "Poppins", "Segoe UI", system-ui, sans-serif;
       display: flex; flex-direction: column; overflow: hidden; }
::selection { background: var(--selection); }
button, select, input { font: inherit; color: inherit; }
svg.ic { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round;
         stroke-linejoin: round; flex: none; }

/* ---------------------------------------------------------------- barra superior */
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 16px;
          background: linear-gradient(#0A2450, #061831); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { height: 30px; }
.brand .div { width: 1px; height: 28px; background: var(--border-strong); }
.brand .t1 { font-size: 16.5px; font-weight: 500; white-space: nowrap; }
.brand .t2 { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-2); white-space: nowrap; }
.spacer { flex: 1; }
/* APIKEY: campo con el aire de la marca (marino, borde azul, acento cian; rojo si se rechaza) */
.keybox { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 4px 0 12px; border-radius: 8px;
          background: var(--navy); border: 1px solid var(--border-strong); min-width: 0;
          transition: border-color .15s, box-shadow .15s; }
.keybox:hover { border-color: var(--cyan); }
.keybox:focus-within { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0, 234, 255, .14); }
.keybox.bad { border-color: var(--rec); box-shadow: 0 0 0 3px rgba(230, 103, 103, .16); }
.keybox .lbl-ic { display: inline-flex; color: var(--cyan); }
.keybox.bad .lbl-ic { color: var(--rec); }
.keybox .key-lbl { font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--text-2);
                   padding-right: 8px; border-right: 1px solid var(--border-strong); white-space: nowrap; }
.keybox input { border: none; background: transparent; min-height: 0; padding: 0; width: 190px; min-width: 60px;
                font-family: "Poppins", "Segoe UI", system-ui, sans-serif; font-size: 13px; letter-spacing: .04em;
                color: var(--text); caret-color: var(--cyan); }
.keybox input::placeholder { color: var(--text-3); letter-spacing: .02em; }
.keybox input:focus { outline: none; }
.key-eye { width: 28px; height: 28px; border: none; background: none; color: var(--text-2); cursor: pointer; border-radius: 6px;
           display: inline-flex; align-items: center; justify-content: center; }
.key-eye:hover { background: var(--hover); color: var(--text); }
.key-eye svg.ic, .keybox .lbl-ic svg.ic { width: 16px; height: 16px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px;
       background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--hover); border-color: var(--border-strong); }
.btn:disabled { color: var(--text-3); cursor: default; background: var(--surface-2); border-color: var(--border); }
.btn.icon { width: 38px; padding: 0; }
.btn.on { border-color: var(--cyan); color: var(--cyan); background: var(--hover); }
.btn.primary { background: var(--orange); color: var(--navy); border: none; font-weight: 600; letter-spacing: .14em;
               min-width: 124px; text-transform: uppercase; }
.btn.primary:hover { background: var(--orange-hover); }
.btn.primary.rec { background: var(--rec); color: #fff; }
.btn.primary:disabled { background: var(--surface-2); color: var(--text-3); }

/* ---------------------------------------------------------------- barra de control */
.controls { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--surface);
            border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.controls .grp { display: flex; align-items: center; gap: 10px; min-width: 0; }
.controls .grp.src { flex: 1 1 340px; }
.lbl-ic { color: var(--text-2); display: inline-flex; }
select, input[type=text], input[type=number], textarea {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; min-height: 36px; }
select:hover, input:hover { border-color: var(--border-strong); }
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--cyan); }
select option, select optgroup { background: var(--surface-2); color: var(--text); }
#source { min-width: 180px; max-width: 420px; flex: 1; }
#srcLang, #tgtLang { min-width: 170px; }
.meter { width: 120px; height: 6px; border-radius: 3px; background: var(--surface-2); position: relative; overflow: hidden; flex: none; }
.meter i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--cyan); border-radius: 3px; transition: width .08s linear; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot.on { background: var(--orange); }

/* ---------------------------------------------------------------- columnas */
.cols { flex: 1; display: grid; grid-template-columns: 1fr 1px 1fr; min-height: 0; }
.cols.single { grid-template-columns: 1fr; }
.cols.single .divider, .cols.single .col.tgt { display: none; }
.divider { background: var(--border); }
.col { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.col-head { display: flex; align-items: center; gap: 4px; padding: 7px 10px 7px 22px; border-bottom: 1px solid var(--border);
            background: var(--bg); }
.col-title { flex: 1; font-size: 10px; font-weight: 500; letter-spacing: .22em; text-transform: uppercase; color: var(--text-2);
             white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-title.paused { color: var(--orange); }
.col-btn { width: 30px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px;
           border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; }
.col-btn svg.ic { width: 16px; height: 16px; }
.col-btn:hover { background: var(--hover); border-color: var(--border); color: var(--text); }
.col-btn.on { color: var(--orange); border-color: var(--orange); background: var(--hover); }
.flow { flex: 1; overflow-y: auto; display: flex; flex-direction: column; padding: 14px 22px 18px; min-height: 0;
        font-size: var(--col-size); line-height: var(--col-lh); }
.flow-inner { margin-top: auto; }          /* teleprompter: el texto empieza abajo y sube */
.flow p { margin: 0 0 .7em; unicode-bidi: plaintext; overflow-wrap: anywhere; }
.flow .meta { font-family: "Cascadia Mono", Consolas, monospace; font-size: .74em; color: var(--text-2); margin-inline-end: .7em; }
.flow .dim { color: var(--text-2); }
.flow-empty { margin: auto; text-align: center; color: var(--text-2); max-width: 460px; padding: 20px; }
.flow-empty h2 { font-weight: 300; font-size: 22px; color: var(--text); margin: 0 0 10px; }
.flow-empty kbd { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px; font-size: 12px; }

/* ---------------------------------------------------------------- barra de estado */
.statusbar { display: flex; align-items: center; gap: 10px; padding: 6px 16px; background: var(--surface); border-top: 1px solid var(--border);
             min-height: 34px; overflow: hidden; }
.statusbar .badge, #metrics { flex: none; }
#status { flex: 1; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 80px; }
#metrics { font-family: "Cascadia Mono", Consolas, monospace; font-size: 11.5px; color: var(--text-2); white-space: nowrap; }
.badge { border: 1px solid var(--border); border-radius: 10px; padding: 1px 9px; font-size: 10.5px; color: var(--text-2); background: var(--bg);
         white-space: nowrap; }
.badge:empty { display: none; }

/* ---------------------------------------------------------------- menús y diálogos */
.menu { position: absolute; z-index: 30; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 4px;
        min-width: 230px; box-shadow: 0 12px 30px rgba(0, 0, 0, .45); }
.menu button { display: flex; width: 100%; gap: 10px; align-items: center; text-align: left; padding: 7px 14px; border: none; background: none;
               border-radius: 6px; cursor: pointer; }
.menu button:hover { background: var(--hover); }
.menu hr { border: none; height: 1px; background: var(--border); margin: 4px 8px; }
.menu .head { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--text-2); padding: 6px 14px 2px; }

.modal-back { position: fixed; inset: 0; background: rgba(1, 8, 20, .62); z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--bg); border: 1px solid var(--border); border-radius: 14px; width: min(760px, 100%); max-height: calc(100vh - 32px);
         display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.modal h3 { margin: 0; padding: 16px 20px 0; font-weight: 500; font-size: 17px; }
.tabs { display: flex; gap: 4px; padding: 8px 14px 0; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs button { background: none; border: none; color: var(--text-2); padding: 8px 12px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); border-bottom-color: var(--orange); }
.modal-body { padding: 16px 20px; overflow-y: auto; flex: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--border); }
.form { display: grid; grid-template-columns: minmax(150px, 220px) 1fr; gap: 10px 16px; align-items: center; }
.form label.l { color: var(--text-2); }
.form > select, .form > input, .form > textarea { min-width: 0; width: 100%; }
.modal-body { overflow-x: hidden; }
.form > input[type=color] { width: 72px; height: 34px; padding: 3px; background: var(--surface-2); border: 1px solid var(--border);
                            border-radius: 8px; cursor: pointer; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: none; border-radius: 5px; }
input[type=range] { accent-color: var(--cyan); }
.tabs { scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.form .full { grid-column: 1 / -1; }
.hint { color: var(--text-2); font-size: 12px; line-height: 1.5; }
.chk { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.chk input { accent-color: var(--cyan); width: 16px; height: 16px; }
textarea { width: 100%; min-height: 70px; resize: vertical; }
.row-voice { display: grid; grid-template-columns: auto 1.1fr .7fr .55fr 1.4fr auto auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.row-voice select, .row-voice input { min-width: 0; width: 100%; }
.preview { min-height: 150px; border-radius: 12px; padding: 14px; background: repeating-conic-gradient(#0b1730 0 25%, #10213f 0 50%) 0 0 / 22px 22px;
           display: flex; align-items: flex-end; }
.preview .ovl { width: 100%; }
.urlbox { display: flex; gap: 8px; }
.urlbox input { flex: 1; font-family: "Cascadia Mono", Consolas, monospace; font-size: 12px; }
.toast { position: fixed; bottom: 48px; left: 50%; transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--border-strong);
         padding: 9px 16px; border-radius: 10px; z-index: 60; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
.toast.err { border-color: var(--rec); }

@media (max-width: 1100px) { #metrics { display: none; } }
@media (max-width: 900px) { #bSpk, #bVoice { display: none; } .brand .t2 { display: none; } .keybox input { width: 120px; } .keybox .key-lbl { display: none; } }
@media (max-width: 760px) {
  .brand .t2, .brand .div, .brand img { display: none; }
  .cols { grid-template-columns: 1fr; grid-template-rows: 1fr 1px 1fr; }
  .cols.single { grid-template-rows: 1fr; }
  .divider { height: 1px; width: auto; }
  .form { grid-template-columns: 1fr; }
  .row-voice { grid-template-columns: auto 1fr 1fr; }
  #metrics { display: none; }
}
