/* ============================================================
   TraductorEnTiempoRealEN_ES · estilos
   (Multiplataforma: Teams, Zoom, Google Meet, Webex, etc.)
   ============================================================ */

:root {
  --navy:        #0B2545;
  --blue:        #1D4E89;
  --blue-soft:   #E7EEF7;
  --accent:      #F4A261;
  --accent-soft: #FFF6E5;
  --green:       #2E8B57;
  --green-soft:  #E6F5EC;
  --red:         #C0392B;
  --red-soft:    #FBE5E2;
  --tab-red:     #DC2A2A;
  --tab-red-dk:  #B71F1F;
  --grey-50:     #F8FAFC;
  --grey-100:    #F2F4F8;
  --grey-200:    #E5E9F0;
  --grey-300:    #C9D1DC;
  --grey-500:    #5C6470;
  --grey-700:    #2C3340;
  --white:       #FFFFFF;
  --radius:      14px;
  --shadow:      0 8px 24px rgba(11, 37, 69, 0.08);
  --shadow-lg:   0 14px 40px rgba(11, 37, 69, 0.14);
  --mono:        "SFMono-Regular", "Menlo", "Consolas", monospace;
  --sans:        -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
                 "Roboto", "Calibri", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--sans);
  color: var(--grey-700);
  background: linear-gradient(180deg, #F8FAFC 0%, #ECEFF5 100%);
  min-height: 100vh;
}

body.stealth { background: transparent !important; }
body.stealth #app { display: none; }
body.stealth { -webkit-app-region: drag; }

#app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ===== Header ===== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 22px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-mark {
  background: var(--navy);
  color: var(--white);
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
}

.brand-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--navy);
}

.status {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  margin-left: 4px;
}

.status-idle      { background: var(--grey-100); color: var(--grey-500); }
.status-connecting{ background: var(--accent-soft); color: var(--accent); }
.status-live      { background: var(--green-soft);  color: var(--green); animation: pulse 1.8s ease-in-out infinite; }
.status-error     { background: var(--red-soft);    color: var(--red); }
.status-stopped   { background: var(--blue-soft);   color: var(--blue); }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(46, 139, 87, 0.35); }
  50%      { box-shadow: 0 0 0 6px rgba(46, 139, 87, 0); }
}

.meeting-meta { display: flex; gap: 18px; align-items: flex-end; }

.meeting-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--grey-500);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.meeting-label input {
  font-family: var(--sans);
  font-size: 14px;
  padding: 8px 12px;
  width: 280px;
  border: 1px solid var(--grey-200);
  border-radius: 10px;
  background: var(--grey-50);
  color: var(--grey-700);
  transition: border-color .15s;
}

.meeting-label input:focus {
  outline: none;
  border-color: var(--blue);
  background: var(--white);
}

.clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding: 6px 14px;
  background: var(--grey-50);
  border-radius: 10px;
  min-width: 130px;
}

.clock #elapsed {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
}

.clock small {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--grey-500);
}

/* ===== Botón HQS (High-Quality Switch) ===== */
.btn-hqs {
  background: var(--grey-500);
  color: white;
  position: relative;
  transition: background .25s ease, box-shadow .25s ease;
}

.btn-hqs.hqs-on {
  background: linear-gradient(135deg, #E1A93C 0%, #C0821A 100%);
  color: var(--white);
  box-shadow: 0 0 0 2px rgba(225, 169, 60, 0.25), var(--shadow);
}

.btn-hqs.hqs-on .btn-icon {
  animation: hqs-pulse 1.6s ease-in-out infinite;
}

.btn-hqs.hqs-swapping {
  background: linear-gradient(135deg, #5C6470 0%, #2C3340 100%);
  color: var(--white);
  cursor: progress;
}

.btn-hqs.hqs-swapping .btn-icon {
  animation: spin 1s linear infinite;
}

@keyframes hqs-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.18); }
}

/* ===== Controles ===== */
.controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.controls .btn { min-width: 180px; }

.btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 20px;
  border-radius: var(--radius);
  border: 0;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .15s ease, background .15s ease;
  box-shadow: var(--shadow);
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn:not(:disabled):hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn:not(:disabled):active { transform: translateY(0); }

.btn-icon { font-size: 18px; line-height: 1; }
.btn-label { letter-spacing: 0.3px; }

.btn-start     { background: var(--green); color: white; }
.btn-start-tab { background: var(--tab-red); color: white; }
.btn-start-tab:not(:disabled):hover { background: var(--tab-red-dk); }
.btn-stop      { background: var(--red);   color: white; }
.btn-invisible { background: var(--grey-700); color: white; }
.btn-voice     { background: var(--blue);  color: white; }
.btn-voice.voice-off { background: var(--grey-500); }

.btn-report     { background: #2D5C8F; color: white; }
.btn-mindmap    { background: #8E44AD; color: white; }
.btn-htmlreport { background: #16A085; color: white; }
.btn-minutes-en { background: linear-gradient(135deg, #1F4E89 0%, #0B2545 100%); color: white; }
.btn-minutes-es { background: linear-gradient(135deg, #C0392B 0%, #7A1F15 100%); color: white; }
.btn-start-mesa { background: linear-gradient(135deg, #16A085 0%, #0B6B58 100%); color: white; }

.btn.processing { opacity: 0.7; cursor: progress; }
.btn.processing .btn-icon { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ===== Botón POWER (arriba del todo) ===== */
.power-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 6px;
}

.power-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 32px;
  border: none;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background .25s ease, box-shadow .25s ease, transform .15s ease;
  box-shadow: var(--shadow);
  font-family: inherit;
  min-width: 280px;
  justify-content: center;
}

.power-btn:hover { transform: translateY(-1px); }
.power-btn:active { transform: translateY(0); }

.power-btn .power-icon {
  font-size: 24px;
  line-height: 1;
}

.power-btn .power-sub {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  opacity: 0.85;
  margin-left: 4px;
  padding-left: 10px;
  border-left: 1px solid rgba(255,255,255,0.35);
}

.power-btn.power-off {
  background: linear-gradient(135deg, #5C6470 0%, #3A4250 100%);
  color: white;
}

.power-btn.power-on {
  background: linear-gradient(135deg, #F39C12 0%, #D35400 100%);
  color: white;
  box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.30), var(--shadow);
}

.power-btn.power-on .power-icon {
  animation: power-pulse 1.8s ease-in-out infinite;
}

.power-btn.power-switching {
  background: linear-gradient(135deg, #5C6470 0%, #2C3340 100%);
  color: white;
  cursor: progress;
}

.power-btn.power-switching .power-icon {
  animation: spin 1s linear infinite;
}

.power-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@keyframes power-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.20); }
}

/* ===== Selector de longitud máxima de segmento ===== */
.seg-len {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--white);
  border: 1px solid var(--grey-200, #E1E5EB);
  border-radius: var(--radius, 12px);
  box-shadow: var(--shadow);
  min-width: 240px;
  flex: 1;
}

.seg-len-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy, #1F2A3A);
  white-space: nowrap;
  user-select: none;
}

.seg-len-icon {
  font-size: 15px;
  line-height: 1;
}

.seg-len-range {
  flex: 1;
  appearance: none;
  -webkit-appearance: none;
  height: 4px;
  background: var(--grey-200, #E1E5EB);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}

.seg-len-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--blue, #2D5C8F);
  border: 2px solid var(--white, #fff);
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
  cursor: pointer;
  transition: transform .12s ease;
}

.seg-len-range::-webkit-slider-thumb:hover { transform: scale(1.1); }

.seg-len-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--blue, #2D5C8F);
  border: 2px solid var(--white, #fff);
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
  cursor: pointer;
}

.seg-len-value {
  min-width: 44px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 14px;
  color: var(--blue, #2D5C8F);
}

/* ===== Sección post-sesión ===== */
.post-session {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-top: 4px;
  border-left: 4px solid var(--accent);
}

.post-title {
  margin: 0 0 4px;
  color: var(--navy);
  font-size: 17px;
  font-weight: 700;
}

.post-sub {
  margin: 0 0 16px;
  color: var(--grey-500);
  font-size: 13px;
}

.post-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.post-links {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.post-links .link-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--grey-50);
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--grey-700);
}

.post-links .link-item .label-tag {
  font-weight: 700;
  color: var(--navy);
}

.post-links .link-item a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
}

.post-links .link-item a:hover { text-decoration: underline; }

@media (max-width: 900px) {
  .post-actions { flex-direction: column; }
}

/* ===== Leyenda ===== */
.legend {
  display: flex;
  gap: 18px;
  font-size: 12px;
  color: var(--grey-500);
  padding: 0 4px;
}

.legend-col { display: inline-flex; align-items: center; gap: 6px; }

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-en        { background: var(--blue); }
.dot-es        { background: var(--accent); }
.dot-translate { background: var(--green); }

/* ===== Timeline ===== */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  min-height: 380px;
  max-height: calc(100vh - 280px);
  overflow-y: auto;
  scroll-behavior: smooth;
}

.empty-state {
  margin: auto;
  text-align: center;
  color: var(--grey-500);
  max-width: 520px;
}

.empty-state p { margin: 4px 0; }
.empty-hint    { font-size: 13px; color: var(--grey-500); }

.entry {
  display: grid;
  grid-template-columns: 70px 1fr 1fr;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--grey-50);
  border: 1px solid var(--grey-200);
  align-items: start;
  animation: slideIn .25s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.entry .time {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--grey-500);
  padding-top: 2px;
}

.entry .original,
.entry .translation {
  font-size: 14px;
  line-height: 1.45;
  text-align: justify;
  hyphens: auto;
}

.entry .original {
  color: var(--grey-700);
}

.entry .translation {
  color: var(--navy);
  font-weight: 500;
}

.entry .lang-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  margin-right: 6px;
  vertical-align: middle;
  letter-spacing: 0.6px;
}

.lang-en { background: var(--blue-soft);   color: var(--blue);   }
.lang-es { background: var(--accent-soft); color: var(--accent); }

.entry.partial {
  background: linear-gradient(90deg, #FFFEF5, #FFFAEC);
  border-color: #F5E2B3;
}

.entry.partial::after {
  content: "…";
  position: absolute;
  margin-left: -16px;
  color: var(--accent);
  font-weight: 700;
}

/* ===== Footer ===== */
.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--grey-500);
  padding: 4px 6px;
}

.app-footer code {
  font-family: var(--mono);
  font-size: 11.5px;
  background: var(--grey-100);
  padding: 2px 6px;
  border-radius: 4px;
}

.error-box {
  background: var(--red-soft);
  color: var(--red);
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 600;
}

.hidden { display: none !important; }

/* ===== Punto invisible ===== */
.stealth-dot {
  position: fixed;
  top: 8px;
  right: 8px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--green);
  cursor: pointer;
  z-index: 9999;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.6), 0 2px 6px rgba(0,0,0,0.15);
  opacity: 0.55;
  transition: opacity .2s, transform .15s;
}

.stealth-dot:hover { opacity: 1; transform: scale(1.2); }

.stealth-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--green);
  animation: stealthPulse 1.8s ease-out infinite;
}

@keyframes stealthPulse {
  0%   { transform: scale(1);   opacity: 0.55; }
  100% { transform: scale(2.6); opacity: 0; }
}

/* Responsive: tablets / pantallas pequeñas */
@media (max-width: 900px) {
  .app-header {
    flex-direction: column;
    align-items: stretch;
  }
  .meeting-meta { justify-content: space-between; }
  .meeting-label input { width: 100%; }
  .entry { grid-template-columns: 60px 1fr; }
  .entry .translation { grid-column: 1 / -1; padding-top: 4px; border-top: 1px dashed var(--grey-200); }
  .entry .original { grid-column: 2; }
}

/* === Touch-first (iPad / iPhone) === */
.is-ios .btn,
.is-ios .power-btn,
.is-ios .post-actions .btn {
  min-height: 56px;
  font-size: 16px;
  padding: 14px 18px;
}

.is-ios .power-btn { min-width: 0; width: 100%; max-width: 480px; }
.is-ios .controls { gap: 10px; }
.is-ios .controls .btn { min-width: 0; flex: 1 1 calc(50% - 10px); }
.is-ios .seg-len { width: 100%; }
.is-ios .seg-len-range { height: 8px; }   /* slider más fácil de tocar */
.is-ios .seg-len-range::-webkit-slider-thumb { width: 26px; height: 26px; }

@media (max-width: 600px) {
  /* iPhone — portrait */
  body { padding: 12px 10px; }
  .app-header { padding: 14px; gap: 8px; }
  .brand-title { font-size: 16px; line-height: 1.25; }
  .brand-mark { font-size: 14px; padding: 4px 8px; }
  .clock { padding: 8px 10px; }
  .clock #elapsed { font-size: 22px; }
  .controls { gap: 8px; }
  .controls .btn { flex: 1 1 100%; }
  .post-actions { flex-direction: column; }
  .post-actions .btn { flex: 1 1 100%; }
  .seg-len { padding: 12px 14px; }
  .seg-len-label { font-size: 14px; }
  .entry { padding: 12px 10px; }
  .timeline { padding: 12px 8px; }
  .legend { font-size: 12px; gap: 12px; flex-wrap: wrap; }
  .power-btn { font-size: 15px; padding: 14px 20px; }
  .power-btn .power-sub { display: none; }   /* poco espacio en iPhone */
}

/* iPad portrait y landscape — más espacio que iPhone, sigue siendo touch */
@media (min-width: 601px) and (max-width: 1366px) {
  .is-ios .controls .btn { flex: 1 1 calc(50% - 10px); }
}

/* PWA standalone (instalada en Home Screen) — añade un poco de padding
   superior para no quedar pegado a la status bar */
@media (display-mode: standalone) {
  body { padding-top: max(20px, env(safe-area-inset-top)); }
}
