/* pwa/src/styles.css */

:root {
  --bg: #dfe8f5;
  --panel: #ffffff;
  --panel-2: #f4f8ff;
  --line: #c8d5ea;
  --text: #0b1d3a;
  --muted: #51617a;

  --badge-bg: #0b4c0d;
  --badge-text: #ffffff;
  --head-accent: #1d8a22;
  --head-accent-2: #34c707;

  --green: #26cf76;

  /* Usamos valores simples en vez de clamp() para compatibilidad con WebViews viejos. */
  --header-h: 4rem;
  --footer-h: 3rem;
  --daily-sidebar-w: 13rem;

  --gap: 0.875rem;
  --radius: 0.75rem;

  --title-size: 1rem;
  --provider-size: 1.2rem;
  --row-size: 0.9rem;
  --num-size: 1.6rem;

  --animal-time-w: 4.7rem;
  --animal-num-w: 3.6rem;
  --animal-icon-size: 2.45rem;
  --animal-name-size: 0.82rem;
  --animal-row-gap: 0.45rem;
  --animal-row-pad-x: 0.35rem;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  overflow: hidden; /* ✅ NO SCROLL */
}

.theme-toggle {
  height: 2em;
  min-width: 4.6em;
  margin-right: 0.5rem;
  border: 0.0625rem solid rgba(255,255,255,0.35);
  border-radius: 0.375rem;
  background: rgba(255,255,255,0.12);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  cursor: pointer;
}

.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------------- Header ---------------- */
.topbar {
  height: var(--header-h);
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.375rem 0.875rem;
  border-bottom: 0.125rem solid #101a34;
  background: linear-gradient(180deg, #16264f, #101a34);
}

.topbar__left { display: flex; align-items: center; justify-content: flex-start; }
.topbar__center { display: flex; align-items: center; justify-content: center; gap: 0.875rem; }
.topbar__right { display: flex; align-items: center; justify-content: flex-end; }


.title-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
  background: #f4f7ff;
  color: #121f40;
  font-weight: 800;
  letter-spacing: 0.04em;
  font-size: 1rem;
  text-transform: uppercase;
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  font-size: 0.875rem;
  text-transform: uppercase;
  color: #dfe9ff;
}

.live__dot {
  width: 0.625em;
  height: 0.625em;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0.75em rgba(40,209,124,0.7);
  animation: pulse 1.1s infinite;
}

@keyframes pulse {
  0%   { transform: scale(1); opacity: 1; }
  50%  { transform: scale(0.7); opacity: 0.45; }
  100% { transform: scale(1); opacity: 1; }
}

.client-logo {
  height: 1.9rem;
  width: auto;
  max-width: 13.75rem;
  object-fit: contain;
  filter: drop-shadow(0 0.0625rem 0.375rem rgba(0,0,0,0.25));
  opacity: 0.98;
  display: none; /* se activa por JS si hay src */
}

.timebox {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.375rem 0.625rem;
  border-radius: 0.375rem;
  background: rgba(255,255,255,0.12);
  border: 0.0625rem solid rgba(255,255,255,0.25);
}

.timebox__label {
  color: #d0dcfa;
  font-weight: 800;
  letter-spacing: 0.04em;
  font-size: 0.75rem;
}

.timebox__value {
  font-weight: 900;
  letter-spacing: 0.03em;
  font-size: 1rem;
  color: #ffffff;
}

/* ---------------- Main / Grid ---------------- */
.main {
  flex: 1;
  min-height: 0;       /* ✅ permite que el grid no empuje y cause scroll */
  overflow: hidden;    /* ✅ NO SCROLL */
  padding: 0.625rem;
  display: flex;
  gap: 0.625rem;
  background: linear-gradient(180deg, #16264f, #101a34);
}

.results-pane {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.results-grid {
  height: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 0.625rem;
  overflow: hidden;
}

.daily-sidebar {
  flex: 0 0 var(--daily-sidebar-w);
  width: var(--daily-sidebar-w);
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 0.375rem;
  border-radius: 0.75rem;
  background: linear-gradient(180deg, #16264f, #101a34);
  border: 0.0625rem solid rgba(255,255,255,0.25);
  overflow: hidden;
}

.daily-sidebar__title {
  margin: 0;
  padding: 0.125rem 0.125rem 0.5rem;
  color: #ffffff;
  font-size: 1.125rem;
  text-align: center;
  font-weight: 900;
  letter-spacing: 0.015em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.daily-sidebar__empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  border-radius: 0.625rem;
  background: rgba(255,255,255,0.08);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 800;
  text-align: center;
}

.daily-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  border-radius: 0.625rem;
  background: transparent;
  border: none;
  box-shadow: none;
}

.daily-card__frame {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border-radius: 0.625rem;
  overflow: hidden;
  background: transparent;
}

.daily-card__image {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 0.625rem;
  background: transparent;
}

/* Cada "tabla" */
.col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: 0.625rem;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid #b8c8e3;
  box-shadow: 0 1px 0 rgba(255,255,255,0.9) inset;
  overflow: hidden;
}

.col__head {
  padding: 0.5rem 0.625rem;
  border-bottom: 1px solid #c3d3ef;
  background: linear-gradient(180deg, #edf3ff, #dbe7fb);
}

.col__title {
  font-weight: 900;
  font-size: 1.2rem;
  line-height: 1.1;
  color: #112149;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
}

.col__body {
  flex: 1;
  min-height: 0;
  overflow: hidden; /* ✅ NO SCROLL dentro */
  display: grid;
  grid-auto-rows: 1fr; /* ✅ distribuye filas en alto disponible */
}

.col__body--grouped {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.col__body--paired {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.col__pair-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.25rem 0.5rem 0.375rem;
  border-bottom: 1px solid #d6e1f3;
}

.col__pair-section:last-child {
  border-bottom: none;
}

.col__pair-title {
  margin: 0 0 0.25rem 0;
  text-align: center;
  font-size: 0.75em;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #1a2f63;
  text-transform: uppercase;
}

.col__group {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 6px 8px;
  border-bottom: 1px solid #d6e1f3;
}

.col__group:last-child {
  border-bottom: none;
}

.col__group-title {
  font-weight: 900;
  font-size: 0.75rem;
  text-align: center;
  color: #1a2f63;
  margin: 0 0 0.375rem 0;
  letter-spacing: 0.02em;
}

.col__abc-rows {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.col__abc-head,
.col__abc-row {
  display: grid;
  grid-template-columns: 72px 1fr 1fr 1fr;
  align-items: center;
  justify-items: center;
  gap: 4px;
}

.col__abc-head {
  margin-bottom: 3px;
}

.col__abc-time-head,
.col__abc-col-head {
  width: 100%;
  text-align: center;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--head-accent), var(--head-accent-2));
  color: #f3f7ff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 4px;
}

.col__abc-row {
  flex: 1;
  min-height: 0;
  padding: 2px 0;
}

.col__abc-time {
  width: 100%;
  text-align: center;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--head-accent), var(--head-accent-2));
  color: #f3f7ff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 2px;
  white-space: nowrap;
}

.col__abc-cell {
  width: 100%;
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  border: 1px solid #d6e2f6;
  background: #f8fbff;
  color: #1a2340;
  font-size: 18px;
  font-weight: 900;
  padding: 0 2px;
  white-space: nowrap;
}

.col__abc-cell--sign {
  font-size: 0.9rem;
  letter-spacing: 0;
  padding: 0 0.125rem;
}

.col__abc-head--ac,
.col__abc-row--ac {
  grid-template-columns: 72px 1fr 1fr;
}

.col__row--dual {
  grid-template-columns: 90px 1fr;
}

.col__num2 {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
}

.col__num2-col {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.col__num2-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.3px;
  text-align: center;
  color: #2d4171;
}

.col__num2-head {
  margin: 2px 0 0 0;
  padding: 0 5.5rem 0 5.25rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
}

.col__num2-head-item {
  text-align: center;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: #2d4171;
}

.col__row--dual .col__num {
  font-size: 1.2rem;
  min-height: 30px;
  padding: 0 0.25rem;
}

.col__num--sign {
  font-size: 0.95rem;
  line-height: 1.05;
  letter-spacing: 0;
}

/* filas */
.col__row {
  display: grid;
  grid-template-columns: 90px 1fr;
  align-items: center;
  justify-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-bottom: 1px solid #d6e1f3;
  min-height: 0;
}

.col__row:last-child { border-bottom: none; }

.col__time {
  color: #f3f7ff;
  opacity: 1;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.015em;
  background: linear-gradient(180deg, var(--head-accent), var(--head-accent-2));
  border-radius: 5px;
  padding: 3px 6px;
  text-align: center;
  width: 5rem;
  white-space: nowrap;
}

.col__num {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.875rem;
  font-weight: 950;
  letter-spacing: 0.015em;
  color: #1a2340;
  background: #f8fbff;
  border: 1px solid #d6e2f6;
  border-radius: 6px;
  width: 100%;
  min-height: 40px;
  padding: 2px 8px;
}

.col__empty {
  color: #9ba9c2;
  font-weight: 800;
}

/* animalitos: 3 columnas dentro de row */
.col__row--animal {
  grid-template-columns: var(--animal-time-w) var(--animal-num-w) minmax(0, 1fr);
  gap: var(--animal-row-gap);
  padding-left: var(--animal-row-pad-x);
  padding-right: var(--animal-row-pad-x);
}

.col__num--animal {
  min-height: 38px;
  padding: 0 0.25rem;
}

.col__nameWrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--animal-icon-size);
  align-items: center;
  justify-items: stretch;
  gap: 0.35rem;
  min-width: 0;
  width: 100%;
  padding: 0 0.15rem;
}

.col__name {
  font-size: var(--animal-name-size);
  font-weight: 800;
  color: #20335f;
  opacity: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  width: 100%;
  min-width: 0;
  max-width: none;
}

.col__icon {
  width: var(--animal-icon-size);
  height: var(--animal-icon-size);
  border-radius: 50%;
  border: 0.0625rem solid #c8d6ee;
  object-fit: cover;
  justify-self: center;
  flex: 0 0 auto;
}

.col__icon--pending {
  object-fit: contain;
  padding: 0.25em;
  background: rgba(255,255,255,0.92);
}

/* ---------------- Footer / Progress ---------------- */
.footer {
  height: var(--footer-h);
  padding: 0;
  display: block;
  background: #101a34;
  border-top: 2px solid #0b1330;
}

.progress-track {
  width: calc(100% - 20px);
  height: 6px;
  margin: 4px 10px 0 10px;
  border-radius: 4px;
  background: rgba(255,255,255,0.16);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--green);
  transition: width 80ms linear;
}

.ticker {
  height: 30px;
  line-height: 30px;
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  color: #f5f8ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  padding: 0 10px;
}

/* Tema oscuro por defecto */
body.theme-dark {
  --bg: #071b2a;
  --panel: #0f2a3d;
  --panel-2: #0c2435;
  --line: rgba(255,255,255,0.08);
  --text: #e9f2ff;
  --muted: rgba(233,242,255,0.65);
}

body.theme-dark .title-badge {
  background: #ffffff;
  color: #0b4aa8;
}

body.theme-dark .col {
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: none;
}

body.theme-dark .col__head {
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

body.theme-dark .col__title {
  color: #e9f2ff;
}

body.theme-dark .col__row {
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

body.theme-dark .col__group {
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

body.theme-dark .col__group-title {
  color: #dce9ff;
}

body.theme-dark .col__pair-section {
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

body.theme-dark .col__pair-title {
  color: #dce9ff;
}

body.theme-dark .col__abc-cell {
  color: #f7fbff;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
}

body.theme-dark .col__num2-label {
  color: #cfe0ff;
}

body.theme-dark .col__num2-head-item {
  color: #cfe0ff;
}

body.theme-dark .col__num {
  color: #f7fbff;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
}

body.theme-dark .col__name {
  color: #e9f2ff;
}

body.theme-dark .col__icon {
  border-color: rgba(255,255,255,0.24);
}

body.theme-dark .col__icon--pending {
  background: rgba(255,255,255,0.08);
}

body.theme-dark .ticker {
  color: #e9f2ff;
}
/* -------------------------------
   Responsive presets: 720p / 1080p / 4K
   ------------------------------- */

/* 720p (y similares: TVs pequeñas, browsers con poco alto) */
@media (max-width: 1280px), (max-height: 720px) {
  :root {
    --header-h: 3.5rem;
    --footer-h: 2.5rem;
    --daily-sidebar-w: 11rem;
    --gap: 0.625rem;

    --title-size: 0.95rem;
    --provider-size: 0.95rem;
    --row-size: 0.95rem;
    --num-size: 1.2rem;
    --animal-time-w: 4.2rem;
    --animal-num-w: 3.1rem;
    --animal-icon-size: 2.1rem;
    --animal-name-size: 0.68rem;
    --animal-row-gap: 0.28rem;
    --animal-row-pad-x: 0.2rem;
  }

  .client-logo { height: 1.75rem; max-width: 10rem; }
  .theme-toggle { height: 1.9em; min-width: 4.25em; font-size: 0.7rem; }
  .title-badge { font-size: 0.875rem; }
  .device-code { font-size: 0.875rem; }
  .topbar { grid-template-columns: minmax(0, 1fr) auto auto; gap: 0.5rem; }
  .topbar__center { gap: 0.5rem; min-width: 0; }
  .col__title { font-size: 1rem; }
  .col__time { width: 4.4rem; font-size: 0.7rem; }
  .col__num { font-size: 1.45rem; }
  .col__row { grid-template-columns: 5rem 1fr; padding: 0 0.375rem; }
  .col__row--dual { grid-template-columns: 5rem 1fr; }
  .col__num2 { gap: 0.25rem; }
  .col__num2-label { font-size: 0.56rem; }
  .col__num2-head { padding: 0 5.5rem 0 5.375rem; }
  .col__abc-cell--sign { font-size: 0.8rem; }
  .col__row--dual .col__num { font-size: 1rem; min-height: 1.625rem; }
  .col__num--sign { font-size: 0.72rem; }
  .col__row--animal { grid-template-columns: var(--animal-time-w) var(--animal-num-w) minmax(0, 1fr); }
  .col__num--animal { min-height: 1.8rem; font-size: 1.2rem; }
  .col__icon { width: var(--animal-icon-size); height: var(--animal-icon-size); }
  .ticker { font-size: 0.7rem; height: 1.625rem; line-height: 1.625rem; }
}

/* 1080p (default “standard” TVs) */
@media (min-width: 1281px) and (max-width: 2559px) and (min-height: 721px) and (max-height: 1439px) {
  :root {
    --header-h: 4rem;
    --footer-h: 3rem;
    --daily-sidebar-w: 13rem;
    --gap: 0.875rem;

    --title-size: 1rem;
    --provider-size: 1.25rem;
    --row-size: 0.875rem;
    --num-size: 1.875rem;
    --animal-time-w: 4.75rem;
    --animal-num-w: 3.45rem;
    --animal-icon-size: 2.35rem;
    --animal-name-size: 0.76rem;
    --animal-row-gap: 0.35rem;
    --animal-row-pad-x: 0.25rem;
  }

  .client-logo { height: 2.1rem; max-width: 13.75rem; }
  .topbar { grid-template-columns: minmax(0, 1fr) auto auto; }
  .topbar__center { min-width: 0; }
  .theme-toggle { height: 2em; min-width: 4.6em; }
  .col__row { grid-template-columns: 5.625rem 1fr; }
  .col__row--dual { grid-template-columns: 5.625rem 1fr; }
  .col__row--animal { grid-template-columns: var(--animal-time-w) var(--animal-num-w) minmax(0, 1fr); }
  .col__num--animal { min-height: 2rem; font-size: 1.35rem; }
  .col__icon { width: var(--animal-icon-size); height: var(--animal-icon-size); }
  .ticker { font-size: 0.82rem; }
  .col__num--sign { font-size: 0.82rem; }
}

/* 4K (UHD) */
@media (min-width: 2560px), (min-height: 1440px) {
  :root {
    --header-h: 5rem;
    --footer-h: 3.75rem;
    --daily-sidebar-w: 16rem;
    --gap: 1.125rem;

    --title-size: 1.45rem;
    --provider-size: 1.6rem;
    --row-size: 1.1rem;
    --num-size: 2.2rem;
    --animal-time-w: 6rem;
    --animal-num-w: 4.5rem;
    --animal-icon-size: 2.9rem;
    --animal-name-size: 0.92rem;
    --animal-row-gap: 0.5rem;
    --animal-row-pad-x: 0.4rem;
  }

  .topbar { padding: 0.875rem 1.375rem; }
  .client-logo { height: 2.9rem; max-width: 20rem; }
  .topbar__center { min-width: 0; }
  .theme-toggle { height: 2.4em; min-width: 5.75em; font-size: 0.875rem; }
  .col__head { padding: 0.875rem 1rem; }
  .col__row { grid-template-columns: 7.5rem 1fr; padding: 0 0.75rem; }
  .col__row--dual { grid-template-columns: 7.5rem 1fr; }
  .col__num2-label { font-size: 0.75rem; }
  .col__num2-head { padding: 0 7.875rem 0 7.75rem; }
  .col__abc-cell--sign { font-size: 1rem; }
  .col__row--dual .col__num { font-size: 1.55rem; min-height: 2.375rem; }
  .col__num--sign { font-size: 1rem; }
  .col__row--animal { grid-template-columns: var(--animal-time-w) var(--animal-num-w) minmax(0, 1fr); }
  .col__time { width: 6.5rem; font-size: 1rem; }
  .col__num { font-size: 2.625rem; }
  .col__num--animal { min-height: 2.3rem; font-size: 1.6rem; }
  .col__icon { width: var(--animal-icon-size); height: var(--animal-icon-size); }
  .progress-track { height: 0.625rem; }
  .ticker { font-size: 1.05rem; height: 2.25rem; line-height: 2.25rem; }
}
.device-code { font-size: 1rem; font-weight: 700; color: #f0f5ff; }
