/* assets/css/layout.css - Estilos Estruturais (Header/Modais/Sidebar) vFinal Fix */

/* --- HEADER & NAVEGAÇÃO --- */
.site-header {
    background: #ffffff; border-bottom: 1px solid #e5e7eb;
    height: 80px; position: sticky; top: 0; z-index: 1000;
    display: flex; align-items: center; width: 100%;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.header-container {
    width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 20px;
    display: flex; justify-content: space-between; align-items: center;
}

.logo { font-size: 1.8rem; font-weight: 800; color: #111; letter-spacing: -1px; text-decoration: none; display: flex; align-items: center; }
.logo span { color: var(--primary); }

.nav-desktop { display: flex; gap: 20px; align-items: center; }
.nav-link { font-weight: 600; color: #4b5563; font-size: 0.9rem; cursor: pointer; transition: 0.2s; display: flex; align-items: center; gap: 5px; text-decoration: none; }
.nav-link:hover { color: var(--primary); }
.nav-link i { font-size: 0.75rem; opacity: 0.6; margin-top: 2px; }

/* MEGA MENU */
.nav-item { position: relative; height: 80px; display: flex; align-items: center; }
.mega-menu {
    position: absolute; top: 80px; left: 50%; transform: translateX(-50%) translateY(10px);
    background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1); min-width: 600px;
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 15px;
    opacity: 0; visibility: hidden; transition: all 0.2s ease; z-index: 1100;
}
.nav-item:hover .mega-menu { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

/* Menu de Usuário (Direita) */
.nav-item:hover .mega-menu.user-dropdown { transform: translateY(0); }
.mega-menu.user-dropdown {
    left: auto; right: 0; min-width: 220px;
    grid-template-columns: 1fr; padding: 10px;
    transform: translateY(10px);
}
.mega-menu.user-dropdown::before {
    content: ''; position: absolute; top: -20px; left: 0; width: 100%; height: 20px; background: transparent;
}

.mega-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border-radius: 8px; transition: 0.2s; text-decoration: none; }
.mega-item:hover { background: #f9fafb; }
.mega-item:hover h4 { color: var(--primary); }
.mega-icon { width: 32px; height: 32px; background: #f3f4f6; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--primary); font-size: 1rem; flex-shrink: 0; }
.mega-text h4 { font-size: 0.9rem; font-weight: 700; margin: 0 0 2px 0; color: #333; }
.mega-text p { font-size: 0.75rem; color: #666; margin: 0; line-height: 1.3; }

/* ACTIONS */
.header-actions { display: flex; align-items: center; gap: 10px; position: relative; }
.nav-action-btn {
    background: transparent; border: none; cursor: pointer; 
    font-size: 1.1rem; color: #666; width: 40px; height: 40px; 
    border-radius: 50%; transition: 0.2s; display: flex; align-items: center; justify-content: center;
}
.nav-action-btn:hover { background: #f3f4f6; color: var(--primary); }

/* BUSCA NETFLIX */
.netflix-search-box {
    display: flex; align-items: center; position: relative;
    transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid transparent; background: transparent;
    height: 40px; width: 40px; overflow: hidden; border-radius: 20px;
}
.netflix-search-box.active {
    background: #fff; border: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05); border-radius: 4px; width: 280px;
}
.search-btn {
    background: transparent; border: none; color: #666; font-size: 1.1rem; cursor: pointer; 
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
    position: absolute; left: 0; top: 0; z-index: 2;
}
.search-input-wrapper {
    display: flex; align-items: center; width: 100%; height: 100%;
    padding-left: 40px; opacity: 0; transition: opacity 0.2s ease 0.1s;
}
.netflix-search-box.active .search-input-wrapper { opacity: 1; }
.search-input-wrapper input {
    width: 100%; border: none; background: transparent;
    font-size: 0.9rem; color: #333; outline: none;
    padding-right: 30px; height: 100%;
}
.clear-search {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    color: #999; cursor: pointer; font-size: 0.9rem; display: none; z-index: 3;
}
.netflix-search-box.active .clear-search { display: block; }

/* RESULTADOS BUSCA */
.search-dropdown-results {
    position: fixed; top: 80px; right: 80px; width: 300px;
    background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    max-height: 400px; overflow-y: auto; display: none; z-index: 999;
}
.search-dropdown-results.show { display: block; }
.search-item {
    display: flex; align-items: center; gap: 15px; padding: 12px 15px;
    border-bottom: 1px solid #f9f9f9; text-decoration: none; transition: 0.2s;
}
.search-item:hover { background: #f3f4f6; }
.search-item img { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; }
.search-info h4 { font-size: 0.9rem; margin: 0; color: #333; font-weight: 600; line-height: 1.2; }
.search-info span { font-size: 0.75rem; color: #888; text-transform: uppercase; }

/* === BARRA LATERAL FIXA (STICKY) === */
.right-sidebar {
    position: -webkit-sticky;
    position: sticky;
    top: 100px; 
    align-self: start;
    height: fit-content;
    z-index: 800;
}

/* MOBILE */
.mobile-overlay-bg {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 1999;
    opacity: 0; visibility: hidden; transition: 0.3s; backdrop-filter: blur(2px);
}
.mobile-overlay-bg.active { opacity: 1; visibility: visible; }
.mobile-drawer {
    position: fixed; top: 0; left: 0; width: 85%; max-width: 320px; height: 100%;
    background: #fff; z-index: 2000; transform: translateX(-100%); transition: transform 0.3s ease;
    box-shadow: 10px 0 30px rgba(0,0,0,0.1); padding: 25px; overflow-y: auto;
}
.mobile-drawer.active { transform: translateX(0); }
.mobile-nav-group { margin-bottom: 20px; border-bottom: 1px solid #f3f4f6; padding-bottom: 15px; }
.mobile-nav-title {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.9rem; font-weight: 700; color: #333; cursor: pointer; padding: 10px 0;
}
.mobile-nav-title i { font-size: 0.8rem; color: #999; transition: 0.3s; }
.mobile-nav-title.active { color: var(--primary); }
.mobile-nav-title.active i { transform: rotate(180deg); color: var(--primary); }
.nav-content { display: none; padding-left: 10px; }
.nav-content.open { display: block; animation: slideDown 0.3s ease; }
.mobile-nav-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 0;
    color: #555; font-size: 0.95rem; font-weight: 500; text-decoration: none;
}
.mobile-nav-item i { width: 20px; text-align: center; color: var(--primary); }
.mobile-menu-btn { display: none; background: none; border: none; font-size: 1.4rem; cursor: pointer; color: #333; margin-right: 15px; }
.btn-mobile-light { width: 100%; background-color: #f5f3ff; color: var(--primary); border: 1px solid #ddd6fe; padding: 12px 0; border-radius: 8px; font-weight: 700; margin-top: 15px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; }

/* --- MODAIS (Auth Fix - O FANTASMA FOI ELIMINADO) --- */
.auth-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 9999; display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; transition: opacity 0.3s ease;
    
    /* FIX: Garante que o fundo seja apenas o escuro semi-transparente */
    background-color: rgba(0, 0, 0, 0.6); 
    backdrop-filter: blur(4px);
    
    /* FIX: Remove padding ou margens que criem espaços brancos */
    padding: 20px; 
    box-sizing: border-box;
}

.auth-overlay.active { opacity: 1; visibility: visible; }

.auth-card {
    background: #fff; width: 100%; max-width: 400px; border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15); padding: 40px; text-align: center; 
    position: relative;
    transform: translateY(20px); transition: transform 0.3s ease;
    
    /* FIX: Garante que o card não tenha fundo transparente herdado */
    z-index: 10000;
}

.auth-overlay.active .auth-card { transform: translateY(0); }

.auth-header h2 { font-size: 1.6rem; margin-bottom: 5px; color: #111; }
.auth-header p { color: #666; margin-bottom: 25px; font-size: 0.9rem; }
.auth-input-group { margin-bottom: 15px; text-align: left; }
.auth-input-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 5px; color: #374151; }
.auth-input { width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 1rem; outline: none; }
.auth-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(98, 0, 234, 0.1); }
.auth-btn { width: 100%; background: var(--primary); color: white; padding: 12px; border: none; border-radius: 8px; font-weight: 700; cursor: pointer; margin-top: 10px; transition: 0.2s; }
.auth-btn:hover { background: var(--primary-dark); }
.close-auth { position: absolute; top: 20px; right: 20px; font-size: 1.5rem; cursor: pointer; color: #9ca3af; transition: 0.2s; }
.close-auth:hover { color: #333; }
.user-menu-trigger { cursor: pointer; }
.user-avatar-small { width: 40px; height: 40px; background: #e0e7ff; color: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; cursor: pointer; font-size: 1.1rem; }

/* Responsive */
@media(max-width: 900px) {
    .nav-desktop { display: none; }
    .mobile-menu-btn { display: block; }
    .netflix-search-box.active { width: 200px; }
    .search-dropdown-results { right: 10px; width: 95%; top: 75px; }
    .right-sidebar { position: static; }
}

/* ========================================================= */
/* === CORREÇÃO DARK MODE: MENU MOBILE (GAVETA) === */
/* ========================================================= */

body.dark-mode .mobile-drawer {
    background-color: #1e1e2d !important; /* Fundo Escuro */
    border-right: 1px solid #333;
}

body.dark-mode .mobile-drawer .logo {
    color: #ffffff !important;
}

body.dark-mode .mobile-nav-title {
    color: #a0a0a0 !important;
    border-bottom-color: #333 !important; /* Linha divisória */
}
body.dark-mode .mobile-nav-title.active {
    color: var(--primary) !important;
}

body.dark-mode .mobile-nav-item {
    color: #e0e0e0 !important; /* Texto claro */
}
body.dark-mode .mobile-nav-item i {
    color: var(--primary) !important;
}
body.dark-mode .mobile-nav-item:hover {
    background-color: rgba(255,255,255,0.05);
}

/* Card do Usuário Logado no Mobile */
body.dark-mode .mobile-user-card {
    background-color: #2b2b36 !important;
    color: #fff !important;
}

/* Botão "Entrar" e "Painel" no Mobile */
body.dark-mode .btn-mobile-light {
    background-color: #2b2b36 !important;
    border-color: #444 !important;
    color: #fff !important;
}
body.dark-mode .btn-mobile-light:hover {
    background-color: #333 !important;
}

/* Ícone de Fechar (X) */
body.dark-mode .mobile-drawer button i.fa-xmark {
    color: #fff !important;
}