/* Telas primárias: ativação, Home e TV. Compatível com Chromium 68. */

.activation-screen {
  /* Arte Infinity Media como fundo. A arte ja e escura a esquerda (onde fica o
     texto branco), entao o overlay e leve, so margem de leitura — nao o 0.88
     antigo que existia para escurecer o wallpaper de logos. A segunda url e
     fallback: enquanto background_activation.png nao existir, a camada 404 fica
     transparente e revela o wallpaper antigo em vez de um fundo quebrado. */
  background-image: linear-gradient(rgba(2, 6, 23, 0.4), rgba(2, 6, 23, 0.4)),
    url("../assets/images/background_activation.jpg"),
    url("../assets/images/hospitality-wallpaper.png");
  background-position: center;
  background-size: cover;
}

/* Mesma escala em vh da tela de ativacao em app.css: a viewport CSS da TV e
   1600x900, nao 1920x1080. Espacamento entre spinner e texto vai em margin —
   gap em flex so existe do Chrome 84 e a TV roda Chrome 68. */
.activation-progress {
  margin-top: 1vh;
  display: flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.8vh;
}

.activation-progress .activation-spinner {
  width: 2.2vh;
  height: 2.2vh;
  margin-right: 1.2vh;
  border-width: 3px;
}

/* Sem display aqui: o Chrome 68 ignora flex/grid aplicado direto em <button>
   (o JS define inline-flex em activation.js). Alinhamento fica por conta do
   centro padrao do proprio botao. */
.activation-retry {
  min-width: 23vh;
  min-height: 4.2vh;
  margin-top: 0.4vh;
  padding: 0 1.6vw;
  align-items: center;
  justify-content: center;
  font-size: 1.9vh;
}

.activation-retry:focus,
.activation-retry.is-focused {
  border-color: #85b4ff !important;
  box-shadow: 0 0 0 5px rgba(133, 180, 255, 0.24);
}

.activation-qr {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.activation-qr svg {
  width: 100%;
  height: 100%;
  display: block;
  shape-rendering: crispEdges;
}

/* QR renderizado como imagem GIF (data-URI): leve para o Chromium 68 da TV.
   image-rendering: pixelated mantém os módulos nítidos ao ampliar. */
.activation-qr img,
.activation-qr-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #ffffff;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.status-disabled .activation-badge {
  border-color: rgba(255, 92, 116, 0.74);
  background: rgba(193, 28, 54, 0.34);
}

.status-disabled .activation-panel {
  border-color: rgba(255, 92, 116, 0.52);
}

.status-disabled .activation-message {
  color: #ffffff;
  font-weight: 600;
}

.status-disabled .activation-qr-card {
  opacity: 0.58;
}

.status-connection_error .activation-badge,
.status-config_error .activation-badge {
  border-color: rgba(255, 209, 102, 0.72);
  background: rgba(142, 95, 15, 0.34);
}

.home-content {
  overflow: hidden;
}

#shell-screen.is-home .screen-background::after {
  display: none;
}

.home-screen {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  overflow: hidden;
}

.home-background-video {
  position: absolute;
  z-index: 0;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-overlay {
  position: absolute;
  z-index: 1;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.70);
}

.home-welcome,
.home-status {
  position: absolute;
  z-index: 2;
  top: 19%;
}

.home-welcome {
  left: 54px;
  max-width: 900px;
}

.home-welcome-label {
  margin-bottom: 6px;
  color: #ffffff;
  font-size: 34px;
  font-weight: 300;
}

.home-welcome h1 {
  margin: 0;
  color: #ffffff;
  font-size: 52px;
  font-weight: 400;
  line-height: 1.15;
}

.home-status {
  right: 40px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  color: #ffffff;
}

.home-weather {
  display: flex;
  align-items: center;
  font-size: 34px;
}

.home-weather-icon {
  width: 52px;
  height: 52px;
  margin-right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffd55c;
  font-size: 42px;
  line-height: 1;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.34);
}

.home-weather-icon.weather-sunny { color: #ffd55c; }
.home-weather-icon.weather-partly { color: #f4d45e; }
.home-weather-icon.weather-cloudy { color: #d3dae5; }
.home-weather-icon.weather-rainy,
.home-weather-icon.weather-rain { color: #82b8ff; }
.home-weather-icon.weather-storm { color: #ffd166; }
.home-weather-icon.weather-snowfall,
.home-weather-icon.weather-snow { color: #e8f5ff; }

/* Sol animado da Home: raios giram (SMIL) e variam de tamanho (pulso CSS). */
.weather-sun {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.weather-sun-ray,
.weather-sun-core {
  fill: currentColor;
}

.weather-sun-spin {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  animation: weather-sun-spin 16s linear infinite;
}

.weather-sun-pulse {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  animation: weather-sun-pulse 2s ease-in-out infinite;
}

@keyframes weather-sun-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(-360deg); }
}

@keyframes weather-sun-pulse {
  0%, 100% { transform: scale(0.86); }
  50% { transform: scale(1.1); }
}

.home-time {
  margin-top: 6px;
  display: flex;
  align-items: baseline;
}

.home-time strong {
  font-size: 44px;
  font-weight: 700;
}

.home-time span {
  margin-left: 8px;
  font-size: 28px;
  font-weight: 400;
}

.home-date {
  margin-top: 6px;
  font-size: 27px;
}

.tv-content {
  padding-top: 146px;
  padding-right: 40px;
  padding-left: 48px;
}

.tv-screen {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.tv-section-header {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tv-section-header h1,
.tv-section-header h2 {
  margin: 0;
  color: #ffffff;
  font-size: 31px;
  font-weight: 400;
}

.tv-section-hint {
  color: rgba(255, 255, 255, 0.68);
  font-size: 20px;
}

.tv-section-hint span {
  min-width: 76px;
  margin-left: 22px;
  display: inline-block;
  text-align: right;
}

.channel-strip {
  height: 154px;
  margin-top: 14px;
  display: flex;
  align-items: center;
  overflow-x: hidden;
  overflow-y: hidden;
  scroll-behavior: auto;
}

.channel-card {
  position: relative;
  width: 126px;
  height: 126px;
  margin-right: 24px;
  flex: 0 0 126px;
  overflow: hidden;
  border: 5px solid transparent;
  border-radius: 13px;
  /* Card branco com o logo preenchendo, igual ao mostrador de canais do Flutter
     (as logos vêm com fundo branco, então o card branco funde com elas). */
  background: #ffffff;
  color: #ffffff;
}

.channel-card img {
  width: 100%;
  height: 100%;
  padding: 10px;
  object-fit: contain;
}

.channel-card-name {
  position: absolute;
  right: 4px;
  bottom: 3px;
  left: 4px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.0);
  font-size: 1px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tv-apps-header {
  margin-top: 28px;
}

.tv-app-grid {
  height: 472px;
  margin-top: 14px;
  /* Folga interna para o realce de foco (borda + anel + leve escala) nao ser
     cortado nas bordas do grid; o overflow segue recortando apps excedentes. */
  padding: 12px 46px 12px 12px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  /* A altura da linha vem da propria proporcao do card (padding-top 62.5% =
     1/1.6), nao de um valor fixo. Assim o tile fica SEMPRE 1.6:1, igual ao
     childAspectRatio: 1.6 do Flutter (_AppGrid), mesmo quando o menu lateral
     expande e a largura da coluna muda. Linha fixa em px derivava a proporcao e
     recortava as logos largas (ex.: "prime video" virava "rime vide"). */
  grid-auto-rows: auto;
  grid-column-gap: 28px;
  grid-row-gap: 28px;
  overflow: hidden;
}

.tv-app-card {
  position: relative;
  min-width: 0;
  height: 0;
  /* padding-top 62.5% = 1 / 1.6 -> o card mantem proporcao fixa 1.6:1 seja qual
     for a largura da coluna (hack pre-aspect-ratio, compativel com Chrome 68). */
  padding: 62.5% 0 0 0;
  overflow: hidden;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: #ffffff;
  /* Sem moldura: o logo oficial preenche o tile inteiro (object-fit:cover) e o
     border-radius arredonda os cantos, igual ao _AppGrid do Flutter. O anel
     vermelho aparece so no foco (regra abaixo). */
}

.tv-app-card.is-focused,
.tv-app-card:focus {
  box-shadow: 0 0 0 4px #c11c36, 0 16px 36px rgba(0, 0, 0, 0.42);
}

.tv-app-card img {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 100%;
  /* Igual ao Flutter (_AppGrid): BoxFit.cover. Com o tile na proporcao oficial
     1.6:1 (ver grid acima) os logos oficiais preenchem sem corte; logos fora
     dessa proporcao podem ter leve zoom, comportamento aceito. */
  object-fit: cover;
}

.tv-app-fallback {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #151515;
  font-size: 38px;
  font-weight: 800;
}

/* Glifo embutido de app de sistema reconhecido (Navegador) quando o painel nao
   envia logo. Espelha o fallback de iniciais; o SVG escala com o tile (sem px
   fixo), entao vale igual em 1920x1080 e no viewport 1600x900 da TV. */
.tv-app-glyph {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #151515;
  color: #ffffff;
}

.tv-app-glyph svg {
  display: block;
  width: 46%;
  height: 46%;
}

/* Card do modo app-do-fabricante (channel_source = tv_app). Retangular como os
   tiles de app, com glifo de TV + rótulo "TV" + legenda discreta. Gradiente e
   borda interna dão o acabamento; o realce de foco usa anel branco (o anel
   vermelho global some sobre o fundo vermelho). Inerte nesta etapa. */
.tv-manufacturer-tile {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 300px;
  width: 300px;
  height: 132px;
  /* Folga à esquerda para a escala do foco não ser cortada pelo overflow do
     strip quando o tile fica na ponta. */
  margin-left: 12px;
  padding: 0 26px;
  border: 0;
  border-radius: 13px;
  /* Idle "apagado": vermelho escuro. A seleção acende o tile (contraste por
     luminosidade), seguindo o padrão de seleção por preenchimento do app —
     sem anel/borda externa, então nada de branco nem de corte. */
  background: linear-gradient(135deg, #8f1a2c 0%, #6d1420 100%);
  color: #ffffff;
  text-align: left;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18), 0 10px 26px rgba(0, 0, 0, 0.32);
}

/* Selecionado: acende para o vermelho vivo do app + leve escala + realce
   interno claro. Sobrepõe o realce global (anel vermelho outset), evitando
   qualquer estouro fora do strip. border:0 anula a borda global (0 de largura). */
.tv-manufacturer-tile.is-focused,
.tv-manufacturer-tile:focus {
  background: linear-gradient(135deg, #e6273f 0%, #bb1a30 100%);
  box-shadow: inset 0 0 0 1.5px rgba(255, 190, 200, 0.6), 0 20px 44px rgba(0, 0, 0, 0.55);
  transform: scale(1.04);
}

.tv-manufacturer-icon {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  margin-right: 18px;
}

.tv-manufacturer-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.tv-manufacturer-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tv-manufacturer-title {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 1px;
}

.tv-manufacturer-subtitle {
  margin-top: 5px;
  max-width: 190px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
}

.tv-empty {
  min-width: 420px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 21px;
}

.tv-player-layer {
  position: fixed;
  z-index: 2500;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  overflow: hidden;
  background: #000000;
}

.tv-player-container {
  width: 100%;
  height: 100%;
}

.modal-message {
  margin: 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: 22px;
  line-height: 1.5;
}

.modal-actions {
  margin-top: 30px;
  display: flex;
}

.modal-actions > * + * {
  margin-left: 16px;
}

@media (max-width: 1366px), (max-height: 768px) {
  .home-welcome { left: 38px; }
  .home-welcome-label { font-size: 24px; }
  .home-welcome h1 { font-size: 38px; }
  .home-status { right: 28px; }
  .home-time strong { font-size: 34px; }
  .home-time span, .home-date { font-size: 20px; }
  .home-weather { font-size: 26px; }

  /* A logo do hotel (.header-logo-wrap) e fixa: top 16px + 102px = base em 118px.
     Com padding-top 104px o titulo "Canais ao vivo" subia por baixo da logo e
     ficava cortado nesta viewport compacta (TV ~1280x720). 128px poe o titulo
     abaixo da logo, como ja acontece no layout largo (padding-top 146px). */
  .tv-content { padding-top: 128px; padding-left: 32px; }
  .tv-section-header h1, .tv-section-header h2 { font-size: 23px; }
  .tv-section-hint { font-size: 15px; }
  .channel-strip { height: 116px; }
  .channel-card { width: 88px; height: 88px; margin-right: 18px; flex-basis: 88px; }
  .tv-manufacturer-tile { width: 236px; height: 100px; flex-basis: 236px; padding: 0 20px; }
  .tv-manufacturer-icon { width: 38px; height: 38px; margin-right: 14px; }
  .tv-manufacturer-title { font-size: 25px; }
  .tv-manufacturer-subtitle { font-size: 12px; max-width: 150px; }
  .tv-apps-header { margin-top: 18px; }
  .tv-app-grid { height: 342px; grid-column-gap: 20px; grid-row-gap: 18px; }
}
