/**
 * main.css
 * ------------------------------------------------------------------
 * Design System oficial FKTV Player para LG webOS Smart TV.
 * Paleta idêntica ao Android APK: Dark Glass Blue & Neon Glow.
 * Resolução nativa 1920x1080 FHD com tipografia nítida para visualização
 * de 3 metros de distância (10-foot UI).
 * ------------------------------------------------------------------
 */

:root {
  /* Cores Base FKTV */
  --fktv-bg: #05070C;
  --fktv-bg-elevated: #0B0F18;
  --fktv-panel: #10141F;
  --fktv-panel-alt: #171C29;
  --fktv-border: #232A3A;

  /* Tipografia */
  --fktv-text: #EEF1F6;
  --fktv-text-dim: #8B93A4;
  --fktv-text-faint: #545C6E;

  /* Azuis de Destaque e Efeito Neon */
  --fktv-blue: #3E8FE0;
  --fktv-blue-bright: #7EC8F5;
  --fktv-blue-deep: #163F6E;
  --fktv-blue-subtle: rgba(62, 143, 224, 0.12);
  --fktv-focus-stroke: #7EC8F5;
  --fktv-focus-glow: rgba(126, 200, 245, 0.45);

  /* Cores Funcionais */
  --fktv-danger: #FF5C5C;
  --fktv-success: #4FD48A;
  --fktv-gold: #FBBF24;

  /* Superfícies Translúcidas (Glassmorphism) */
  --fktv-glass-card: rgba(16, 20, 31, 0.85);
  --fktv-glass-border: rgba(62, 143, 224, 0.22);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--fktv-bg);
  color: var(--fktv-text);
  font-family: system-ui, -apple-system, 'Inter', 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
}

/* Telas da Aplicação */
.app-screen {
  display: none;
  width: 100vw;
  height: 100vh;
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  background: var(--fktv-bg);
}

.app-screen.active {
  display: flex;
  flex-direction: column;
}

/* Background Cinemático com Iluminação Radial Azul Profunda */
.bg-cinematic {
  background: radial-gradient(circle at 50% 30%, #0D182E 0%, #05070C 75%),
              linear-gradient(180deg, #05070C 0%, #0D182E 50%, #05070C 100%);
  background-size: cover;
}

/* Sistema de Foco para Smart TV (D-Pad & Magic Remote) */
.focusable {
  outline: none;
  transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1),
              border-color 0.2s ease,
              box-shadow 0.2s ease,
              background-color 0.2s ease;
  cursor: pointer;
}

.focusable:focus,
.focusable.focused {
  border-color: var(--fktv-focus-stroke) !important;
  box-shadow: 0 0 25px var(--fktv-focus-glow) !important;
  transform: scale(1.04);
  z-index: 10;
}

/* Quando o Magic Remote (cursor) estiver ativo, suavizar o hover */
body.magic-remote-active .focusable:hover {
  border-color: var(--fktv-focus-stroke);
  box-shadow: 0 0 20px var(--fktv-focus-glow);
}

/* Botões Padrão */
.btn-primary {
  background: linear-gradient(135deg, #3E8FE0 0%, #163F6E 100%);
  color: #FFFFFF;
  border: 1.5px solid var(--fktv-blue-bright);
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
  padding: 10px 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-secondary {
  background: rgba(16, 20, 31, 0.85);
  color: var(--fktv-text);
  border: 1.5px solid var(--fktv-glass-border);
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Topbar Genérica de Conteúdo */
.content-topbar {
  width: 100%;
  height: 64px;
  background-color: var(--fktv-bg-elevated);
  border-bottom: 1px solid var(--fktv-border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 20px;
}

.topbar-title {
  font-size: 20px;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: 0.5px;
}

.topbar-spacer {
  flex: 1;
}

/* Barra de Busca na Topbar */
.topbar-search-wrap {
  display: flex;
  align-items: center;
  background: rgba(16, 20, 31, 0.9);
  border: 1.5px solid var(--fktv-glass-border);
  border-radius: 24px;
  padding: 6px 14px;
  gap: 10px;
  width: 280px;
  transition: width 0.25s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.topbar-search-wrap:focus-within,
.topbar-search-wrap.active {
  border-color: var(--fktv-blue-bright);
  box-shadow: 0 0 16px rgba(126, 200, 245, 0.4);
  width: 360px;
}

.topbar-search-icon {
  width: 18px;
  height: 18px;
  color: var(--fktv-blue-bright);
  flex-shrink: 0;
}

.topbar-search-input {
  background: transparent;
  border: none;
  outline: none;
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 600;
  width: 100%;
}

.topbar-search-input::placeholder {
  color: var(--fktv-text-dim);
}

.search-badge-red {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  opacity: 0.85;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.search-badge-red:hover {
  opacity: 1;
  transform: scale(1.15);
}

.topbar-search-clear {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #FFFFFF;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 13px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.topbar-search-clear:hover {
  background: var(--fktv-danger);
}

.empty-state {
  text-align: center;
  color: var(--fktv-text-dim);
  font-size: 15px;
  font-weight: 700;
  padding: 60px 20px;
  grid-column: 1 / -1;
  width: 100%;
}

/* Toast de Notificação Global */
.global-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(11, 15, 24, 0.95);
  border: 1.5px solid var(--fktv-blue-bright);
  box-shadow: 0 0 25px rgba(126, 200, 245, 0.35);
  color: #FFFFFF;
  padding: 12px 30px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 700;
  z-index: 1000;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
  pointer-events: none;
}

.global-toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Modais Pop-up */
.app-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 7, 12, 0.85);
  backdrop-filter: blur(16px);
  z-index: 500;
  align-items: center;
  justify-content: center;
}

.app-modal.active {
  display: flex;
}

.modal-card {
  background: rgba(16, 20, 31, 0.95);
  border: 1.5px solid var(--fktv-glass-border);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  padding: 32px;
  max-width: 600px;
  width: 90%;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.modal-title {
  font-size: 22px;
  font-weight: 800;
  color: #FFFFFF;
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #FFFFFF;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
}

/* --- Modal de Aviso de Vencimento da Lista --- */
.expiration-modal-card {
  max-width: 580px;
  background: rgba(14, 18, 28, 0.96);
  border: 1.5px solid rgba(245, 166, 35, 0.4);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(245, 166, 35, 0.15);
  border-radius: 22px;
  padding: 32px;
}

.expiration-modal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.expiration-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(245, 166, 35, 0.15);
  border: 1.5px solid rgba(245, 166, 35, 0.5);
  color: #F5A623;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.expiration-title-group {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.expiration-profile-subtitle {
  font-size: 13px;
  font-weight: 600;
  color: var(--fktv-text-dim);
}

.expiration-days-badge {
  background: rgba(245, 166, 35, 0.18);
  border: 1.5px solid #F5A623;
  color: #F5A623;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 20px;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.expiration-days-badge.danger {
  background: rgba(255, 46, 46, 0.18);
  border-color: #FF2E2E;
  color: #FF5A5A;
}

.expiration-highlight-card {
  background: rgba(20, 26, 40, 0.85);
  border: 1.5px solid rgba(62, 143, 224, 0.2);
  border-radius: 14px;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.expiration-highlight-tag {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: var(--fktv-blue-bright);
}

.expiration-highlight-date {
  font-size: 26px;
  font-weight: 900;
  color: #F5A623;
  letter-spacing: 0.5px;
}

.expiration-highlight-subtext {
  font-size: 13.5px;
  font-weight: 700;
  color: #FFFFFF;
}

.expiration-modal-desc {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--fktv-text);
  margin: 0;
}

/* Spinners de Carregamento */
.loading-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(62, 143, 224, 0.2);
  border-top-color: var(--fktv-blue-bright);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 30px auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Scrollbars Invisíveis para Interface de TV */
::-webkit-scrollbar {
  width: 0;
  height: 0;
}
