/* ==========================================================================
   DESIGN SYSTEM - MODO FOCO (V8 - ARQUITETURA HÍBRIDA)
   ========================================================================== */

:root {
    /* Paleta de Alta Conversão e Contraste */
    --bg-base: #030617;                 /* Fundo Absoluto (Deep Space) */
    --bg-surface: #0d1427;              /* Containers Principais */
    --bg-surface-hover: #16213d;        /* Interações Sutis */
    --bg-surface-light: #1e293b;        /* Badges e Inputs */
    
    --text-primary: #f8fafc;            /* Títulos e Textos Principais */
    --text-secondary: #94a3b8;          /* Descrições e Auxiliares */
    
    --brand-primary: #4f46e5;           /* Indigo Principal (Ação Primária) */
    --brand-hover: #6366f1;             /* Indigo Iluminado */
    
    --border-color: #202538;            /* Divisões e Linhas base */
    --border-light: #334155;            /* Hover de bordas */
    
    --danger: #ef4444;                  /* Alertas de interrupção */
    
    /* Geometria e Sombras */
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 8px;
    --shadow-float: 0 20px 40px -10px rgba(0, 0, 0, 0.8);
    --shadow-glow: 0 0 15px rgba(79, 70, 229, 0.4);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Estado Padrão (Hub) */
html {
    background-color: #0f172a !important; /* Cor da Header */
    transition: background-color 0.4s ease;
}

/* Estado de Aula (Quando o JS injetar a classe 'foco-active') */
html.foco-active {
    background-color: #030617 !important; /* Cor do Fundo Escuro */
}

body {
    background-color: transparent !important; /* Permite que o Safari "veja" a cor do HTML */
    margin: 0 !important;
}

#metria-foco-app {
    background-color: #030617; /* O fundo escuro fica aqui */
    min-height: 100vh;
}
#metria-foco-app[data-state="hub"] #foco-view { display: none; }
#metria-foco-app[data-state="foco"] #hub-view { display: none; }
#metria-foco-app[data-state="foco"] .hub-global-navbar { display: none; }

.foco-container {
    max-width: 1540px;
    width: 100%;
    margin: 0 auto;
    padding: 40px 32px 80px;
    box-sizing: border-box;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================
   HEADER RECONSTRUÍDO (PADRÃO MÉTRIA PREMIUM)
   ========================================== */
.hub-global-navbar {
    height: 72px; 
    background: #0f172a !important; /* Cor sólida exata solicitada */
    backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08); 
    position: sticky; 
    top: 0; 
    z-index: 1000;
    display: flex; 
    align-items: center; 
    justify-content: center;
}

.hub-global-navbar .header-inner {
    width: 100%; max-width: 1540px; padding: 0 40px;
    display: flex; justify-content: space-between; align-items: center;
}

/* Marca */
.brand-text { font-weight: 900; font-size: 1.2rem; color: #fff; display: flex; align-items: center; }
.brand-divider { width: 1px; height: 20px; background: rgba(255, 255, 255, 0.15); margin: 0 12px; }
.view-title { font-size: 0.8rem; font-weight: 700; color: #4f46e5; letter-spacing: 2px; text-transform: uppercase; }

/* Busca Integrada */
.navbar-search-wrapper {
    flex: 1; max-width: 680px; margin: 0 40px; display: flex; align-items: center;
    background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 40px; padding: 4px;
}

/* --- Correção da Barra de Pesquisa --- */

/* 1. Ajuste do Ícone da Lupa */
.search-input-group i {
    color: #94a3b8; /* Cor secundária do tema */
    margin-right: 12px; /* Espaço correto entre a lupa e o texto */
    font-size: 1rem;
    display: flex;
    align-items: center;
}

/* 2. Estilização do Botão "X" (Limpar) */
.search-input-group button {
    background: transparent; /* Remove o fundo rosa/vermelho */
    border: none;            /* Remove a borda */
    color: #94a3b8;          /* Cor do ícone (cinza claro) */
    cursor: pointer;         /* Mostra a mãozinha ao passar o mouse */
    padding: 8px;           /* Área de clique confortável */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease; /* Transição suave */
    font-size: 1rem;
}

/* Efeito Hover no "X" */
.search-input-group button:hover {
    color: #ffffff; /* Fica branco ao passar o mouse */
}

/* Garante que o input não tenha fundo ou borda padrão */
.search-input-group input {
    background: transparent !important;
    border: none !important;
    color: #ffffff !important;
    flex-grow: 1; /* Ocupa o espaço disponível */
}

/* Container do grupo de input para garantir o alinhamento */
.search-input-group {
    display: flex;
    align-items: center;
    flex: 1;
    padding-left: 12px; /* Espaço para a lupa não colar no canto */
    background: transparent !important; /* Remove a barra de dentro */
    border: none !important; /* Remove a borda de dentro */
}

.search-clear-btn {
    background: transparent !important;
    border: none !important;
    color: #94a3b8; /* Cor cinza discreta do seu header */
    cursor: pointer;
    padding: 8px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.search-clear-btn:hover {
    color: #ffffff; /* Fica branco no hover */
}
/* Bloqueia o fundo branco do navegador quando sugere textos antigos */
.search-input-group input:-webkit-autofill,
.search-input-group input:-webkit-autofill:hover, 
.search-input-group input:-webkit-autofill:focus {
    -webkit-text-fill-color: white !important; /* Mantém a letra clara */
    -webkit-box-shadow: 0 0 0px 1000px rgba(255, 255, 255, 0.04) inset !important; /* Força o fundo escuro */
    transition: background-color 5000s ease-in-out 0s; /* Truque para o fundo não mudar */
}
.search-icon { color: #94a3b8; font-size: 0.9rem; margin-right: 12px; }
.search-input-group input { background: transparent !important; border: none !important; color: white !important; font-size: 0.95rem; width: 100%; outline: none; }

.navbar-filters { display: flex; gap: 4px; background: rgba(0, 0, 0, 0.2); padding: 4px; border-radius: 30px; }
.filter-btn { background: transparent; border: none; color: #94a3b8; padding: 8px 18px; border-radius: 25px; font-size: 0.8rem; font-weight: 700; cursor: pointer; }
.filter-btn.active { background: #4f46e5; color: white; box-shadow: none !important; }

/* Perfil Dinâmico */
.user-profile-btn { display: flex; align-items: center; gap: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.08); padding: 6px 16px 6px 6px; border-radius: 50px; cursor: pointer; }

/* 1. Removemos o padding, a borda e o fundo do container */
.user-avatar {
    border: none !important;
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important; /* Remove qualquer sombra/brilho */
    overflow: hidden; /* Garante o corte redondo perfect */
    display: flex; /* Centraliza a imagem internamente */
    align-items: center;
    justify-content: center;
}

/* 2. Garantimos que a imagem preencha todo o espaço sem bordas */
.user-avatar img {
    border: none !important;
    outline: none !important;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Mantém a proporção da foto */
    border-radius: 50%; /* Força a foto a ser redonda */
}
.user-info { display: flex; flex-direction: column; line-height: 1.1; }
.user-name { font-size: 0.85rem; color: white; font-weight: 600; max-width: 100px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.65rem; color: #94a3b8; font-weight: 600; text-transform: uppercase; }

/* Dropdown */
.profile-dropdown { position: absolute; top: 110%; right: 0; width: 200px; background: #0d1427; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 12px; padding: 8px; opacity: 0; visibility: hidden; transform: translateY(10px); transition: 0.2s; z-index: 1010; }
.user-dropdown-wrapper:hover .profile-dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; color: #cbd5e1; text-decoration: none; font-size: 0.85rem; transition: 0.2s; }
.dropdown-item:hover { background: rgba(255, 255, 255, 0.05); color: white; }
.dropdown-item.danger:hover { background: rgba(239, 68, 68, 0.1); color: #ef4444; }

/* --- Perfil do Usuário (Global Sync) --- */
.user-dropdown-wrapper { position: relative; padding-bottom: 10px; margin-bottom: -10px; }

.user-profile-btn {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 6px 14px 6px 6px; border-radius: 50px; cursor: pointer; transition: all 0.3s ease;
}
.user-profile-btn:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.2); }

.user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, #06b6d4, #4f46e5); 
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; color: white; font-size: 0.9rem;
    border: 2px solid rgba(255, 255, 255, 0.1); overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.user-info { display: flex; flex-direction: column; line-height: 1.1; padding-right: 4px; }
.user-role { font-size: 0.7rem; color: #94a3b8; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.user-name { font-size: 0.85rem; color: white; font-weight: 600; max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.arrow-icon { font-size: 0.75rem; color: #94a3b8; margin-left: 4px; transition: transform 0.3s; }
.user-dropdown-wrapper:hover .arrow-icon { transform: rotate(180deg); }

/* Menu Dropdown */
.profile-dropdown {
    position: absolute; top: 100%; right: 0; width: 220px;
    background: #0f172a; border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); padding: 8px;
    opacity: 0; visibility: hidden; transform: translateY(10px); transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1); z-index: 1010;
}
.user-dropdown-wrapper:hover .profile-dropdown { opacity: 1; visibility: visible; transform: translateY(0); }

.dropdown-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px;
    border-radius: 8px; color: #cbd5e1; text-decoration: none; font-size: 0.9rem; font-weight: 500; transition: 0.2s;
}
.dropdown-item i { width: 18px; text-align: center; color: #94a3b8; transition: 0.2s; }
.dropdown-item:hover { background: rgba(255, 255, 255, 0.05); color: white; }
.dropdown-item:hover i { color: #6366f1; }
.dropdown-item.danger:hover { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.dropdown-item.danger:hover i { color: #ef4444; }

.dropdown-divider { height: 1px; background: rgba(255, 255, 255, 0.06); margin: 6px 0; }

/* ==========================================
   3. GERENCIAMENTO DE ESTADO DA BUSCA
   ========================================== */
#metria-foco-app[data-search-active="false"] .search-mode-only { display: none !important; }
#metria-foco-app[data-search-active="true"] .default-mode-only { display: none !important; }

#search-results-section { animation: fadeIn 0.3s ease-out; }

/* Grid otimizado para os Cards Editoriais */
.hub-results-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; margin-top: 24px; }

/* ==========================================
   4. PRATELEIRAS E ESTRUTURA (PREMIUM)
   ========================================== */
.hub-library-wrapper { display: flex; flex-direction: column; gap: 50px; }
.library-section { display: flex; flex-direction: column; gap: 16px; }
.section-header { margin-bottom: 8px; }

/* Títulos Premium */
.header-title-group { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }

.section-icon-premium { 
    font-size: 1.1rem; color: #6366f1; 
    background: rgba(99, 102, 241, 0.15); 
    width: 36px; height: 36px; border-radius: 10px; 
    display: flex; align-items: center; justify-content: center;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.section-title { font-size: 1.5rem; font-weight: 800; margin: 0; color: #ffffff; letter-spacing: -0.5px; }
.section-subtitle { font-size: 0.95rem; color: #94a3b8; margin: 0; font-weight: 500; }

/* Carrossel (ESTRUTURA ESSENCIAL MANTIDA) */
.library-cards-container {
    display: flex; gap: 24px; overflow-x: auto; 
    padding: 12px 16px 32px 16px; 
    margin: -12px -16px 0 -16px;
    scroll-snap-type: x mandatory; scroll-behavior: smooth;
    -webkit-mask-image: linear-gradient(to right, black 95%, transparent 100%);
    mask-image: linear-gradient(to right, black 95%, transparent 100%);
}

.library-cards-container::-webkit-scrollbar { height: 8px; }
.library-cards-container::-webkit-scrollbar-track { background: transparent; }
.library-cards-container::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

.empty-state-shelf { 
    color: #94a3b8; font-size: 0.95rem; padding: 40px 0; 
    font-style: italic; width: 100%; border: 1px dashed rgba(255,255,255,0.1); 
    border-radius: 12px; text-align: center; 
}

/* ==========================================
   CARDS EDITORIAIS (FILA E PESQUISA) - DARK
   ========================================== */
.editorial-card {
    background: #111520;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    display: flex; flex-direction: column; flex: 0 0 280px; 
    scroll-snap-align: start; overflow: hidden;
    transition: transform 0.3s ease, border-color 0.3s;
}

.editorial-card:hover { transform: translateY(-4px); border-color: #4f46e5; }

.editorial-thumb { 
    position: relative; aspect-ratio: 16/9; background-size: cover; 
    background-position: center; border-bottom: 1px solid rgba(255,255,255,0.05); 
}

.badge-editorial {
    position: absolute; bottom: 8px; right: 8px;
    background: #252a36; color: #ffffff; font-size: 0.65rem; font-weight: 800; 
    padding: 5px 10px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.05); 
    text-transform: uppercase;
}

.editorial-info { padding: 16px; display: flex; flex-direction: column; flex: 1; background: transparent; }

.editorial-info h2 { 
    color: #ffffff; font-size: 1.05rem; font-weight: 700; line-height: 1.3; 
    margin: 0 0 8px; display: -webkit-box; -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical; overflow: hidden; 
    /* MÁGICA DO ALINHAMENTO: 1.05rem * 1.3 * 2 linhas = 2.73rem */
    min-height: 2.73rem; 
}

.editorial-info p { 
    color: #94a3b8; font-size: 0.85rem; margin: 0 0 16px; font-weight: 600; 
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; 
    text-transform: uppercase; letter-spacing: 0.05em; 
}

.editorial-actions { display: flex; gap: 8px; margin-top: auto; }

.btn-primary-outline {
    flex: 1; background: #1e2433; color: #ffffff; border: 1px solid #2d3548;
    padding: 10px; border-radius: 8px; font-weight: 700; cursor: pointer; 
    transition: 0.2s; font-size: 0.9rem;
}
.btn-primary-outline:hover { border-color: #4f46e5; background: #4f46e5; color: white; }

/* ==========================================
   5A. CARD NÍVEL 1: CINEMÁTICO PREMIUM (REFERÊNCIA APP)
   ========================================== */
/* Removemos as alturas fixas para o card abraçar a miniatura perfeita */
/* Removemos as alturas forçadas. O Card agora abraça o conteúdo com naturalidade */
.cinematic-card {
    background: #111520;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    display: flex; flex-direction: column; flex: 0 0 440px; 
    min-height: auto !important; 
    scroll-snap-align: start; overflow: hidden; position: relative;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s, box-shadow 0.3s;
}

.cinematic-card:hover { transform: translateY(-4px); border-color: #4f46e5; }

/* A Imagem 100% Intacta em 16:9 */
.cinematic-thumb {
    width: 100%;
    aspect-ratio: 16/9; /* Garante que NADA seja cortado na thumb */
    flex: none; /* Blinda a imagem contra distorções do layout */
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    flex: none;
}

/* O Esfumaçado e Textos */
.cinematic-overlay {
    position: absolute; 
    bottom: 0; left: 0; right: 0; top: auto; 
    /* Degrade exato: preto sólido na base colando no rodapé e transparente logo acima do título */
    background: linear-gradient(to top, #111520 0%, rgba(17, 21, 32, 0.95) 45%, transparent 100%);
    display: flex; flex-direction: column; justify-content: flex-end;
    padding: 40px 16px 12px 16px; 
}

.badge-cinematic {
    align-self: flex-start;
    background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(4px);
    color: #ffffff; font-size: 0.65rem; font-weight: 800;
    padding: 5px 10px; border-radius: 6px; text-transform: uppercase;
    margin-bottom: 8px; border: 1px solid rgba(255,255,255,0.1);
}

.cinematic-info-block { width: 100%; display: flex; flex-direction: column; gap: 4px; }

.cinematic-info-block h2 {
    color: #ffffff; font-size: 1.15rem; font-weight: 800;
    text-transform: uppercase; margin: 0; line-height: 1.2;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    text-shadow: 0 2px 10px rgba(0,0,0,1);
    min-height: auto; 
}

.cinematic-channel {
    color: #cbd5e1; font-size: 0.9rem; font-weight: 500;
    margin: 0; white-space: nowrap; overflow: hidden; 
    text-overflow: ellipsis; text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

.cinematic-progress-text {
    font-size: 0.85rem; font-weight: 600;
    display: flex; align-items: center; margin-top: 4px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

/* A mágica das Duas Cores Idênticas à sua Referência */
.cinematic-progress-text .time-left { color: #cbd5e1; display: flex; align-items: center; gap: 6px; }
.cinematic-progress-text .time-left i { font-size: 0.9rem; }
.cinematic-progress-text .percent-done { color: #8b5cf6; } /* O Roxo "65% concluído" */

/* O Rodapé (Barra Escura Inferior onde ficam os controles físicos) */
.cinematic-footer { 
    padding: 0 16px 16px 16px; 
    background: #111520; /* Mesma cor exata do começo do degradê */
    display: flex; flex-direction: column; gap: 14px;
    position: relative;
}

.cinematic-progress-track {
    height: 4px; background: rgba(255,255,255,0.15); border-radius: 4px; overflow: hidden; width: 100%;
}

.cinematic-progress-fill {
    height: 100%; background: linear-gradient(90deg, #6366f1, #8b5cf6); border-radius: 4px;
}

/* O Rodapé se funde com a imagem graças ao fundo #111520 */
.cinematic-footer { padding: 0 16px 16px 16px; background: #111520; }

/* ==========================================
   BOTÃO CONTINUAR: ESTADO PADRÃO (SECUNDÁRIO)
   ========================================== */
/* Todos os cards recebem este botão mais "silencioso" e escuro */
.btn-continue {
    width: 100%;
    background: rgba(255, 255, 255, 0.05); /* Fundo quase transparente */
    color: #cbd5e1; /* Texto acinzentado */
    border: 1px solid rgba(255, 255, 255, 0.1); /* Borda sutil */
    padding: 12px; 
    border-radius: 8px;
    font-weight: 600; 
    font-size: 1rem; 
    cursor: pointer; 
    transition: all 0.2s ease;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}

.btn-continue:hover { 
    background: rgba(255, 255, 255, 0.1); 
    color: #ffffff; 
    border-color: rgba(255, 255, 255, 0.2); 
}

/* ==========================================
   O DESTAQUE DINÂMICO (SMART HOVER ANTI-FLICKER)
   ========================================== */

/* 1. ESTADO PADRÃO: O primeiro card é o "Selecionado" */
/* A MÁGICA AQUI: O ":not(:has(...))" faz o card continuar aceso mesmo se o mouse passar pelos buracos (gaps) do carrossel! */
#continue-watching-grid:not(:has(.cinematic-card:hover)) .cinematic-card:first-child .btn-continue {
    background-color: #4f46e5; /* Cor sólida em vez de degradê para permitir transição perfeita */
    color: white; 
    border-color: #4f46e5; 
    font-weight: 700;
    ox-shadow: none !important;
}

#continue-watching-grid:not(:has(.cinematic-card:hover)) .cinematic-card:first-child {
    border-color: rgba(99, 102, 241, 0.4);
    ox-shadow: none !important;
}

/* 2. ROUBO DE FOCO: O card que o usuário focar assume o controle */
#continue-watching-grid .cinematic-card:hover .btn-continue {
    background-color: #4f46e5 !important;
    color: white !important; 
    border-color: #4f46e5 !important; 
    font-weight: 700 !important;
    ox-shadow: none !important;
    transform: scale(1.02);
}

#continue-watching-grid .cinematic-card:hover {
    border-color: rgba(99, 102, 241, 0.6) !important;
    ox-shadow: none !important;
}

/* ==========================================
   POSIÇÕES ABSOLUTAS: EXCLUIR E FAVORITAR
   ========================================== */

/* Botão Remover: Esquerda, formato retangular (Idêntico à referência) */
.cinematic-card .btn-remove-card.cinematic-remove {
    top: 12px; left: 12px; right: auto;
    width: 32px !important; height: 32px !important;
    background: rgba(15, 23, 42, 0.7); backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 8px; 
}
.cinematic-card .btn-remove-card.cinematic-remove i { font-size: 0.85rem; }

/* Botão Coração: Direita, formato flutuante e sombreado */
.cinematic-card .btn-icon-save.btn-heart {
    position: absolute; top: 12px; right: 12px;
    width: 34px; height: 34px; background: transparent !important; 
    border: none !important; color: #ffffff !important; font-size: 1.4rem; 
    z-index: 10; box-shadow: none !important; padding: 0;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.8));
}

/* BLINDAGEM TOTAL: Impede que a regra global crie fundos ou bordas 
   no iPad quando o botão sofre o "Sticky Hover" após ser clicado */
.cinematic-card .btn-icon-save.btn-heart:hover,
.cinematic-card .btn-icon-save.btn-heart:not(.active):hover,
.cinematic-card .btn-icon-save.btn-heart.active {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Mantém apenas o efeito visual do ícone no hover */
.cinematic-card .btn-icon-save.btn-heart:hover { 
    transform: scale(1.1); 
    color: #c7d2fe !important; 
}

/* Lógica visual de "Ligar/Desligar" o coração preenchido */
.btn-heart .icon-heart-filled { display: none; }
.btn-heart.active .icon-heart-empty { display: none; }
.btn-heart.active .icon-heart-filled { display: inline-block; color: #ffffff !important; }

/* ==========================================
   5B. CARD NÍVEL 2: EDITORIAL PREMIUM
   Para "Minha Fila" e "Resultados da Pesquisa"
   ========================================== */
.editorial-card {
    background: var(--bg-surface); 
    border: 1px solid var(--border-color); 
    border-radius: var(--radius-md);
    display: flex; flex-direction: column; flex: 0 0 280px; 
    scroll-snap-align: start; overflow: hidden;
    
    /* Transição suave mantendo a nitidez perfeita */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s, border-color 0.3s, background-color 0.3s;
}

.editorial-card:hover { 
    transform: translateY(-6px); /* Removemos o translateZ(0) daqui também */
    border-color: var(--brand-primary); 
    box-shadow: 0 15px 30px -10px rgba(0, 0, 0, 0.6); 
    background: var(--bg-surface-hover); 
}
.editorial-thumb { position: relative; aspect-ratio: 16/9; background-size: cover; background-position: center; border-bottom: 1px solid var(--border-color); }
.badge-editorial {
    position: absolute; bottom: 8px; right: 8px; background: rgba(3,6,23,0.85); backdrop-filter: blur(4px);
    color: var(--text-primary); font-size: 0.65rem; font-weight: 800; padding: 4px 8px; border-radius: 4px; border: 1px solid rgba(255,255,255,0.1);
}

.editorial-info { padding: 16px; display: flex; flex-direction: column; flex: 1; }
.editorial-info h2 { 
    color: var(--text-primary); font-size: 1.05rem; font-weight: 600; line-height: 1.4; 
    margin: 0 0 8px; display: -webkit-box; -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical; overflow: hidden; 
    /* MÁGICA DO ALINHAMENTO: 1.05rem * 1.4 * 2 linhas = 2.94rem */
    min-height: 2.94rem; 
}
.editorial-info p { color: var(--text-secondary); font-size: 0.85rem; margin: 0 0 16px; }

.editorial-actions { display: flex; gap: 8px; margin-top: auto; }

/* 1. Estado Normal dos Botões */
.btn-primary-outline {
    flex: 1; 
    background: rgba(255, 255, 255, 0.02); 
    color: var(--text-primary); 
    border: 1px solid rgba(255, 255, 255, 0.15); 
    padding: 10px; 
    border-radius: var(--radius-sm); 
    font-weight: 600; 
    cursor: pointer; 
    transition: 0.2s;
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 8px; 
    font-size: 0.9rem;
}
.btn-primary-outline:hover { border-color: var(--brand-primary); background: rgba(79, 70, 229, 0.1); color: var(--brand-primary); }

/* 2. Realce Sutil quando o mouse está NO CARD (mas não no botão) */
.editorial-card:hover .btn-primary-outline:not(:hover),
.editorial-card:hover .btn-icon-save:not(.active):not(:hover) {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

/* =========================================================
   3. O Hover REAL e ABSOLUTO dos botões (UX Premium)
   ========================================================= */

/* A. O botão INICIAR (Sempre sólido no hover para máximo contraste) */
.editorial-card .btn-primary-outline:hover,
.btn-primary-outline:hover { 
    background: var(--brand-primary) !important; 
    border-color: var(--brand-primary) !important;
    color: #ffffff !important; 

}

/* B. O estado ATIVO do Favoritar (Vídeo JÁ está na fila) - Sólido */
.editorial-card .btn-icon-save.active,
.cinematic-card .btn-icon-save.active,
.btn-icon-save.active { 
    background: var(--brand-primary) !important; 
    border-color: var(--brand-primary) !important;
    color: #ffffff !important; 

}

/* C. O estado HOVER do Favoritar DESLIGADO (100% Neutro - Sem borda azul) */
.editorial-card .btn-icon-save:not(.active):hover,
.cinematic-card .btn-icon-save:not(.active):hover,
.btn-icon-save:not(.active):hover {
    background: rgba(255, 255, 255, 0.08) !important; /* Fundo cinza bem leve */
    border-color: rgba(255, 255, 255, 0.3) !important; /* Borda branca/cinza, sem cor da marca */
    color: var(--text-primary) !important; /* Ícone claro, mas não aceso */
    box-shadow: none !important;
}
/* ==========================================
   BOTÕES GLOBAIS
   ========================================== */
.btn-primary {
    flex: 1; background: var(--brand-primary); color: white; border: none;
    padding: 12px; border-radius: var(--radius-sm); font-weight: 700; cursor: pointer; transition: 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 0.95rem;
}
.btn-primary:hover { background: var(--brand-hover); }

.btn-icon-save {
    flex: 0 0 44px; height: 44px; 
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.02); 
    border: 1px solid rgba(255, 255, 255, 0.15); 
    border-radius: var(--radius-sm); 
    cursor: pointer; 
    transition: 0.2s; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 1.2rem;
}
.btn-icon-save:hover, .btn-icon-save.active { color: var(--brand-primary); border-color: var(--brand-primary); background: rgba(79, 70, 229, 0.1); }



/* ==========================================
   6. MODO FOCO: SALA DE AULA
   ========================================== */
.foco-header-minimal { display: flex; justify-content: space-between; align-items: center; padding-bottom: 30px; }
.logo-text { font-weight: 900; font-size: 1.5rem; letter-spacing: 2px; color: var(--text-primary); }
.btn-exit-foco { background: transparent; border: 1px solid var(--border-color); color: var(--text-secondary); padding: 10px 20px; border-radius: 20px; cursor: pointer; font-weight: 600; transition: var(--transition); }
.btn-exit-foco:hover { color: var(--text-primary); border-color: var(--border-light); background: rgba(255,255,255,0.05); }

.foco-execution-grid { display: grid; grid-template-columns: 1fr 340px; gap: 40px; align-items: start; transition: grid-template-columns 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
#metria-foco-app[data-has-playlist="true"] .foco-execution-grid { grid-template-columns: 280px 1fr 340px; }

.playlist-sidebar { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 20px 0; height: calc(100vh - 180px); position: sticky; top: 30px; }
.playlist-sidebar .sidebar-label { padding: 0 20px 15px; font-size: 0.75rem; font-weight: 800; text-transform: uppercase; color: var(--text-secondary); border-bottom: 1px solid var(--border-color); margin-bottom: 8px; }
.playlist-list-items { list-style: none; padding: 0; margin: 0; max-height: calc(100% - 40px); overflow-y: auto; }
.playlist-list-items::-webkit-scrollbar { width: 4px; }
.playlist-list-items::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 10px; }
.playlist-list-items li { padding: 14px 20px; font-size: 0.9rem; color: var(--text-secondary); cursor: pointer; transition: 0.2s; line-height: 1.4; border-left: 3px solid transparent; }
.playlist-list-items li:hover { background: var(--bg-surface-hover); color: var(--text-primary); }
.playlist-list-items li.active-video { color: var(--text-primary); background: rgba(79, 70, 229, 0.08); border-left-color: var(--brand-primary); font-weight: 600; }

.foco-player-area { display: flex; flex-direction: column; gap: 16px; }
.player-mock { aspect-ratio: 16/9; background: #000; border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-float); border: 1px solid rgba(255,255,255,0.05); }
.player-controls-bar { display: flex; justify-content: space-between; align-items: center; padding: 0 8px; }
.player-progress { color: var(--text-secondary); font-weight: 600; font-size: 0.95rem; }

.btn-action-mark { background: rgba(79, 70, 229, 0.1); border: 1px solid rgba(79, 70, 229, 0.3); color: var(--brand-primary); padding: 10px 20px; border-radius: 30px; font-weight: 700; cursor: pointer; transition: 0.2s; display: flex; align-items: center; gap: 8px; }
.btn-action-mark:hover { background: var(--brand-primary); color: white; border-color: var(--brand-primary); }

.marker-input-box { background: var(--bg-surface-light); border: 1px solid var(--brand-primary); border-radius: var(--radius-sm); padding: 8px; display: flex; gap: 12px; box-shadow: var(--shadow-glow); margin-top: 8px; }
.marker-input-box input { flex: 1; background: transparent; border: none; color: var(--text-primary); padding: 8px 12px; outline: none; font-size: 1rem; }
.btn-primary-sm { background: var(--brand-primary); color: white; border: none; padding: 8px 20px; border-radius: 6px; font-weight: 700; cursor: pointer; }

.foco-sidebar { display: flex; flex-direction: column; gap: 24px; position: sticky; top: 30px; }
.timer-flat { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 32px 20px; text-align: center; box-shadow: var(--shadow-float); }
.timer-label { color: var(--text-secondary); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 12px; font-weight: 700; }
#timer-display { color: var(--text-primary); font-size: 4rem; font-weight: 300; font-variant-numeric: tabular-nums; letter-spacing: -2px; display: block; }

.markers-container { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-md); display: flex; flex-direction: column; overflow: hidden; height: calc(100vh - 380px); }
.markers-container .sidebar-label { padding: 20px; border-bottom: 1px solid var(--border-color); margin: 0; display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; font-weight: 700; color: var(--text-primary); }
.badge-count { background: var(--bg-surface-light); padding: 4px 10px; border-radius: 12px; font-size: 0.75rem; color: var(--text-secondary); }

.markers-list { padding: 16px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; flex: 1; }
.markers-list::-webkit-scrollbar { width: 4px; }
.markers-list::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 10px; }

.marker-item { background: rgba(255,255,255,0.02); border: 1px solid transparent; padding: 14px; border-radius: var(--radius-sm); cursor: pointer; transition: 0.2s; display: flex; flex-direction: column; gap: 6px; }
.marker-item:hover { background: var(--bg-surface-hover); border-color: var(--border-light); transform: translateX(4px); }
.marker-time { color: var(--brand-primary); font-weight: 800; font-family: monospace; font-size: 0.85rem; }
.marker-text { color: var(--text-primary); font-size: 0.9rem; line-height: 1.4; }

/* ==========================================
   7. MODAL DE AVISO
   ========================================== */
.foco-modal-overlay { position: fixed; inset: 0; background: rgba(3, 6, 23, 0.9); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.foco-modal-box { background: var(--bg-surface); border: 1px solid var(--border-color); padding: 40px; border-radius: var(--radius-lg); max-width: 440px; width: 90%; text-align: center; box-shadow: var(--shadow-float); }
.modal-icon { font-size: 3rem; margin-bottom: 20px; }
.foco-modal-box h3 { font-size: 1.6rem; margin: 0 0 12px; color: var(--text-primary); }
.foco-modal-box p { color: var(--text-secondary); line-height: 1.5; margin: 0 0 32px; }
.modal-actions { display: flex; gap: 16px; }
.btn-flat { flex: 1; background: transparent; border: 1px solid var(--border-color); color: var(--text-primary); padding: 14px; border-radius: var(--radius-sm); font-weight: 600; cursor: pointer; }
.btn-flat:hover { background: var(--bg-surface-light); }
.btn-danger-outline { flex: 1; background: rgba(239, 68, 68, 0.1); border: 1px solid var(--danger); color: var(--danger); padding: 14px; border-radius: var(--radius-sm); font-weight: 600; cursor: pointer; transition: 0.2s; }
.btn-danger-outline:hover { background: var(--danger); color: white; }

/* Botão de Remoção Sutil (Círculo Perfeito) */
.btn-remove-card {
    position: absolute;
    top: 10px;
    right: 10px;
    
    /* Força dimensões iguais e remove interferências */
    width: 26px !important;
    height: 26px !important;
    padding: 0 !important; 
    min-width: 0 !important;
    line-height: 1 !important;
    
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #94a3b8;
    border-radius: 50%;
    cursor: pointer;
    z-index: 30;
    
    display: flex;
    align-items: center;
    justify-content: center;
    
    font-size: 0.75rem;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Aparece no Hover do Card */
.cinematic-card:hover .btn-remove-card,
.editorial-card:hover .btn-remove-card {
    opacity: 1;
}

.btn-remove-card:hover {
    background: #ef4444 !important;
    color: white !important;
    border-color: #ef4444 !important;
    transform: scale(1.1);
}

/* Garante que o ícone dentro não tenha margens */
.btn-remove-card i {
    margin: 0;
    padding: 0;
}

/* ==========================================
   ANIMAÇÃO DE EXCLUSÃO DE CARDS (SMOOTH EXIT)
   ========================================== */

/* 1. Prepara todos os cards para aceitarem animação total (sem cortes abruptos) */
.cinematic-card, .editorial-card {
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1) !important;
    transform-origin: center; /* Garante que o card encolha para o meio e não para o topo */
}

/* ==========================================
   2. O ESTADO "SENDO REMOVIDO" (Deslizamento Físico Perfeito)
   ========================================== */
.card-removing {
    opacity: 0 !important;
    transform: scale(0.8) !important;
    pointer-events: none !important; 
    animation: none !important; /* Mata qualquer animação de entrada */
}

/* MÁGICA UX 1: O :not(:last-child)
   Impede que o ÚLTIMO card da lista tente puxar fantasmas da direita.
   Se for o último, ele apenas afunda e some, sem quebrar o tamanho da prateleira.
*/
.editorial-card.card-removing:not(:last-child) {
    margin-right: -304px !important; 
}

.cinematic-card.card-removing:not(:last-child) {
    margin-right: -364px !important; 
}

/* ==========================================
   TRAVA DE ESTABILIDADE (ANTI-TREMOR)
   ========================================== */
/* Essa classe é injetada pelo JS durante a animação */
.library-cards-container.is-updating {
    scroll-snap-type: none !important; /* Apenas desliga o "ímã" do navegador */
    pointer-events: none !important; /* Trava interações com o mouse/toque durante a animação, mantendo a scrollbar visível */
}

/* ==========================================
   ANIMAÇÃO DE ENTRADA (O NOVO CARD NA FILA)
   ========================================== */

@keyframes slideInRight {
    0% {
        opacity: 0;
        transform: translateX(100px); /* Começa 100 pixels mais para a direita */
    }
    100% {
        opacity: 1;
        transform: translateX(0); /* Termina na posição original */
    }
}

.card-entering {
    /* Aplica a animação com a mesma curva suave (bezier) do resto do sistema */
    animation: slideInRight 0.6s cubic-bezier(0.25, 1, 0.5, 1) forwards !important;
}

/* ============================================================
   Refinamento Premium: Prevenção de Tremor na Exclusão
   Impede que os cards adjacentes tentem dar 'hover' (escala)
   enquanto o carrossel está recalculando o layout.
============================================================ */

/* Quando o container de cards tiver um card sendo removido... */
.library-cards-container:has(.card-removing) .cinematic-card:not(.card-removing),
.library-cards-container:has(.card-removing) .editorial-card:not(.card-removing),
.hub-results-grid:has(.card-removing) .editorial-card:not(.card-removing) {
    /* Impede que o mouse ative o aumento de tamanho nos cards que estão deslizando */
    pointer-events: none !important;
}

/* Garante que o card que ESTÁ sendo removido mantenha sua própria animação */
.editorial-shelf .cinematic-card.card-removing,
.editorial-shelf .editorial-card.card-removing {
    pointer-events: none !important;
    /* Aqui NÃO resetamos transition/transform, pois ele precisa encolher */
    transition: 0.4s ease-in-out !important; 
}

/* ============================================================
   UX PREMIUM: FÍSICA DE EXPANSÃO E PROTEÇÃO DA SCROLLBAR
   ============================================================ */

/* 1. O Container Principal (Transição e Trava no Topo) */
.library-cards-container {
    /* Trava os cards no topo. A scrollbar nasce no fundo vazio e não empurra nada! */
    align-items: flex-start !important; 
    
    /* Previne scroll vertical indesejado durante a animação de altura */
    overflow-y: hidden !important; 
    
    /* A mágica da sanfona: anima a altura suavemente em 0.4s */
    transition: min-height 0.4s cubic-bezier(0.25, 1, 0.5, 1) !important;
}

/* 2. O Estado Vazio (Encolhimento Suave) */
.library-cards-container:has(.empty-state-shelf) {
    min-height: 160px !important;
    align-items: center !important; /* Centraliza a mensagem verticalmente */
}

/* 3. O Estado Cheio (Expansão Suave + Reserva Cativa de Espaço) */
/* A altura é milimetricamente calculada para: Altura do Card + Sombras + Padding + Scrollbar */
#continue-watching-grid:not(:has(.empty-state-shelf)) {
    min-height: 320px !important; 
}

#watch-later-grid:not(:has(.empty-state-shelf)) {
    min-height: 360px !important; 
}

/* 4. Suavidade para o Card de "Vazio" */
.empty-state-shelf {
    animation: fadeIn 0.4s ease-out forwards;
    margin: auto; /* Centraliza horizontalmente no flex */
    width: 100%;
}

/* --- ESTILO DA MARCA E SÍMBOLO --- */
.brand-text .trademark {
    font-size: 1.0em !important; /* Aumenta o tamanho do ® */
    vertical-align: super;
    margin-left: 4px;
    font-weight: 400;
    color: #94a3b8; /* Cor cinza suave para o símbolo */
}


/* ============================================================
   UX PREMIUM: RESPONSIVIDADE DO PLAYER (GAVETA GLOBAL)
   ============================================================ */

/* 1. Mínimo para o Player e Ajuste da Barra de Controles */
.foco-player-area { min-width: 0; width: 100%; }
.player-controls-bar { gap: 12px; }

/* 2. O Botão Toggle (Sempre oculto por padrão) */
#btn-toggle-playlist {
    display: none;
    background: rgba(79, 70, 229, 0.1);
    color: var(--brand-primary);
    border: 1px solid rgba(79, 70, 229, 0.3);
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
}
#btn-toggle-playlist:hover { background: var(--brand-primary); color: white; }

/* MAS se houver playlist rolando, exibe o botão em QUALQUER tamanho de tela */
#metria-foco-app[data-has-playlist="true"] #btn-toggle-playlist { 
    display: flex; 
}

/* 3. Fundo escuro (Overlay) quando a gaveta abre */
.drawer-overlay {
    position: fixed; inset: 0;
    background: rgba(3, 6, 23, 0.8); backdrop-filter: blur(4px);
    z-index: 1999; opacity: 0; visibility: hidden; transition: 0.3s ease;
}
.drawer-overlay.active { opacity: 1; visibility: visible; }

/* 4. A MÁGICA: Força o Grid a ter 2 colunas mesmo com Playlist (Player Gigante) */
#metria-foco-app[data-has-playlist="true"] .foco-execution-grid {
    grid-template-columns: 1fr 340px !important; 
}

/* 5. Transforma a barra lateral esquerda em uma Gaveta Flutuante (GLOBAL) */
.playlist-sidebar {
    position: fixed !important;
    top: 0; left: -350px; /* Fica escondida fora da tela */
    width: 320px; height: 100vh !important;
    z-index: 2000;
    background: var(--bg-surface);
    box-shadow: 20px 0 50px rgba(0,0,0,0.8);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid var(--border-color);
    border-radius: 0 !important;
    padding-top: 40px !important;
}

/* A classe que o JS usa para puxar a gaveta para dentro */
.playlist-sidebar.drawer-open { left: 0; }

/* ==========================================
   BREAKPOINT 1: NOTEBOOKS (< 1280px)
   ========================================== */
@media (max-width: 1280px) {
    /* O Player toma a coluna da esquerda, mantendo só o Timer na direita */
    #metria-foco-app[data-has-playlist="true"] .foco-execution-grid {
        grid-template-columns: 1fr 340px; 
        gap: 24px;
    }

    /* Mostra o botão para abrir a trilha */
    #metria-foco-app[data-has-playlist="true"] #btn-toggle-playlist { display: flex; }

    /* Transforma a barra lateral esquerda em uma Gaveta Flutuante */
    .playlist-sidebar {
        position: fixed !important;
        top: 0; left: -350px; /* Fica escondida fora da tela */
        width: 320px; height: 100vh !important;
        z-index: 2000;
        background: var(--bg-surface);
        box-shadow: 20px 0 50px rgba(0,0,0,0.8);
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border-right: 1px solid var(--border-color);
        border-radius: 0 !important;
        padding-top: 40px !important; /* Espaço pro X ou topo da tela */
    }

    /* A classe que o JS vai usar para "puxar" a gaveta para dentro */
    .playlist-sidebar.drawer-open { left: 0; }
}

/* ==========================================
   BREAKPOINT: TABLETS/MOBILES (< 960px)
   ========================================== */
@media (max-width: 960px) {
    /* No celular, tudo vira 1 coluna. Player em cima, ferramentas embaixo. */
    #metria-foco-app[data-has-playlist="true"] .foco-execution-grid,
    .foco-execution-grid {
        grid-template-columns: 1fr !important; 
    }
    .foco-sidebar { position: relative; top: 0; }
    .markers-container { height: 350px; } 
}