/* ========================================
   BASE STYLES - Reset + Globais
   ======================================== */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--color-text);
    background-color: var(--color-bg);
    overflow-x: hidden;
    min-height: 100dvh;
    width: 100%;
    max-width: 100%;
}



/* ---- Links ---- */
a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-accent);
}

/* ---- Imagens ---- */
img,
video {
    display: block;
    max-width: 100%;
    height: auto;
}

/* ---- Listas ---- */
ul,
ol {
    list-style: none;
}

/* ---- Botões ---- */
button {
    font-family: var(--font-primary);
    cursor: pointer;
    border: none;
    outline: none;
    background: none;
    color: inherit;
    font-size: inherit;
}

/* ---- Inputs ---- */
input,
select,
textarea {
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    outline: none;
    border: none;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* ---- Scrollbar Customizada ---- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--color-text-muted);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-secondary);
}

/* ---- Seleção de Texto ---- */
::selection {
    background: var(--color-primary);
    color: var(--color-text);
}

/* ---- Utilitários ---- */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--color-text-muted);
}

.text-accent {
    color: var(--color-accent);
}

/* ---- Container ---- */
.container {
    width: 100%;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-xl);
}

/* ---- Sections (SPA) ---- */
.section {
    display: none;
    min-height: 100dvh;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.section.active {
    display: block;
}

/* ---- Player Section: SEMPRE em foreground quando ativo ---- */
#section-player.active {
    display: block;
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 200000 !important;
    background: #000;
    overflow: hidden;
}

/* Esconder navegação E modais quando player está ativo */
#section-player.active ~ .mobile-bottom-nav,
body.player-active .mobile-bottom-nav,
body.player-active .navbar,
body.player-active .sidebar,
body.player-active .sidebar-overlay,
body.player-active #detailOverlay,
body.player-active .detail-overlay,
body.player-active .nav-dropdown,
body.player-active .nav-megadrop {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* SEGURANÇA MOBILE: Player SEMPRE cobre tudo em qualquer viewport */
@media (max-width: 768px) {
    #section-player.active {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important; /* Dynamic viewport height (iOS Safari) */
        z-index: 200000 !important;
        background: #000 !important;
        overflow: hidden !important;
    }

    /* Impedir scroll no body quando player ativo (mobile) */
    body.player-active {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
        height: 100% !important;
    }
}

/* ---- Toasts / Notificações ---- */
.toast-container {
    position: fixed;
    top: var(--spacing-xl);
    right: var(--spacing-xl);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.toast {
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    border-left: 4px solid var(--color-primary);
    color: var(--color-text);
    font-size: var(--font-size-sm);
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s var(--transition-spring);
    max-width: 360px;
}

.toast.success {
    border-left-color: #2ecc71;
}

.toast.error {
    border-left-color: #e74c3c;
}

.toast.warning {
    border-left-color: var(--color-accent);
}

/* ---- Loading Spinner ---- */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-text-muted);
    border-top-color: var(--color-primary);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ========================================
   LANDSCAPE BLOCKER — Obriga modo paisagem no celular
   ======================================== */

.landscape-blocker {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, #2a0808 0%, #000000 100%);
    z-index: 999999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    color: white;
}

.landscape-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 400px;
    animation: fadeIn 0.5s ease-out;
}

.rotate-icon {
    width: 80px;
    height: 80px;
    fill: #e50914;
    margin-bottom: 1.5rem;
    animation: rotatePhone 2s infinite ease-in-out;
}

.landscape-content h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    font-family: var(--font-display, inherit);
    letter-spacing: 1px;
}

.landscape-content p {
    font-size: 1.1rem;
    color: #ccc;
    line-height: 1.5;
}

@keyframes rotatePhone {
    0% {
        transform: rotate(0deg);
    }

    50% {
        transform: rotate(-90deg);
    }

    100% {
        transform: rotate(0deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Sidebar Overlay (mobile) ---- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 9998;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    cursor: pointer;
}
.sidebar-overlay.open {
    display: block;
}

/* ---- Hamburger Toggle Button ---- */
.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: rgba(255,255,255,0.85);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.sidebar-toggle:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}
.sidebar-toggle svg {
    display: block;
}

/* Mobile: o app funciona em qualquer orientação. */
@media screen and (max-width: 1024px) {
    .sidebar-toggle {
        display: flex;
    }
    body {
        padding-top: env(safe-area-inset-top, 0px);
        -webkit-overflow-scrolling: touch;
    }
}

/* Layout Netflix: sidebar desativada — ocultar o botão hamburger em TODOS os tamanhos */
.theme-layout-netflix .sidebar-toggle {
    display: none !important;
}

/* ====================================================
   LANDSCAPE BLOCKER — Ativo em celular modo PORTRAIT
   Exige que o usuário gire o aparelho para landscape
   ==================================================== */
@media screen and (max-width: 768px) and (orientation: portrait) {
    /* Mostrar blocker apenas quando NÃO está no player */
    body:not(.player-active) .landscape-blocker {
        display: flex !important;
    }
}

/* Suprimir blocker durante transição de saída do player (evita flicker do orientation unlock) */
body[data-exit-player] .landscape-blocker {
    display: none !important;
}
