/* ========================================
   BASE STYLES - Reset + Globais
   ======================================== */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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: 100vh;
}

/* ---- Forçar Tela Deitada (Paisagem / TV) no MBL ---- */
@media screen and (max-width: 899px) and (orientation: portrait) {

    html,
    body {
        overflow-x: hidden;
    }

    body {
        transform: rotate(-90deg);
        transform-origin: top left;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100vh;
        height: 100vw;
        overflow-y: auto;
        /* Permite rolar o conteudo verticalmente (no eixo que virou horizontal) */
    }

    /* A modal e o player podem precisar referenciar a viewport invertida */
    .detail-overlay,
    .player-container {
        width: 100vh !important;
        height: 100vw !important;
    }
}

/* ---- 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;
}

/* ---- 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: 100vh;
}

.section.active {
    display: block;
}

/* ---- 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;
    }
}