/* =======================================================
   FILMES.CSS — TheuZinho TV
   Design premium para a página de catálogo de filmes
   ======================================================= */

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
}

/* ── CONTAINER PRINCIPAL ─────────────────────────────── */
.filmes-page-container {
    padding-top: 60px;       /* Compensa o header fixo */
    min-height: 100vh;
    background: #090B13;
    color: white;
    width: 100%;
    max-width: 100%;
    margin: 0;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* ── HERO SECTION ────────────────────────────────────── */
.filmes-hero {
    padding: 30px 24px 20px;
    background: linear-gradient(180deg, rgba(59,130,246,0.12) 0%, transparent 100%);
    text-align: center;
    position: relative;
}

.filmes-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(59,130,246,0.15), transparent);
    pointer-events: none;
}

.filmes-hero h1 {
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    font-weight: 900;
    margin-bottom: 8px;
    letter-spacing: -1.5px;
    background: linear-gradient(135deg, #ffffff 30%, #3B82F6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.1;
}

.filmes-hero p {
    color: #94A3B8;
    font-size: 1.05rem;
    max-width: 560px;
    margin: 0 auto 28px;
}

/* ── BARRA DE BUSCA ──────────────────────────────────── */
.movie-search-bar {
    max-width: 580px;
    margin: 0 auto 20px;
    position: relative;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 100px;
    padding: 0 20px;
    height: 52px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.movie-search-bar:focus-within {
    background: rgba(59,130,246,0.08);
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15), 0 8px 24px rgba(0,0,0,0.3);
}

.movie-search-bar i {
    color: #475569;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.movie-search-bar input {
    background: none;
    border: none;
    color: white;
    width: 100%;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    outline: none;
}

.movie-search-bar input::placeholder { color: #475569; }

.clear-search-btn {
    background: none;
    border: none;
    color: #475569;
    cursor: pointer;
    font-size: 1rem;
    padding: 4px 6px;
    display: none;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, transform 0.2s;
    flex-shrink: 0;
}
.clear-search-btn:hover { color: #fff; transform: scale(1.2); }

/* ── CATEGORIAS ──────────────────────────────────────── */
.movie-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-width: 1400px;
    margin: 0 auto;
}

.cat-btn {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: #94A3B8;
    padding: 7px 18px;
    border-radius: 100px;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.cat-btn:hover {
    background: rgba(59,130,246,0.1);
    border-color: rgba(59,130,246,0.4);
    color: #fff;
}

.cat-btn.active {
    background: #3B82F6;
    border-color: #3B82F6;
    color: #fff;
    box-shadow: 0 4px 14px rgba(59,130,246,0.35);
}

/* ── GRID DE FILMES ──────────────────────────────────── */
.movies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
    padding: 20px 5%;
    max-width: 1600px;
    margin: 0 auto;
    box-sizing: border-box;
}

/* ── CARD DE FILME ───────────────────────────────────── */
.fcard {
    display: flex;
    flex-direction: column;
    gap: 10px;
    cursor: pointer;
    transition: transform 0.3s ease;
    outline: none;
    border-radius: 12px;
}

.fcard:hover { transform: translateY(-6px); }

.fcard:focus-visible {
    outline: 3px solid #3B82F6;
    outline-offset: 4px;
}

/* Poster */
.fcard-poster {
    aspect-ratio: 2/3;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    background: #161C2D;
    border: 1px solid rgba(255,255,255,0.06);
}

/* Shimmer enquanto carrega */
.fcard-shimmer {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        #161C2D 0%,
        #1e293b 50%,
        #161C2D 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    z-index: 1;
    border-radius: 12px;
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Imagem do poster */
.fcard-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.4s ease;
    position: relative;
    z-index: 2;
}
.fcard-img.loaded { opacity: 1; }

/* Placeholder quando o TMDB não tem poster */
.fcard-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #1a2744 0%, #0f1729 100%);
    border-radius: 12px;
    z-index: 2;
}

.fcard-placeholder i {
    font-size: 2rem;
    color: rgba(59, 130, 246, 0.4);
}

.fcard-placeholder span {
    font-size: 1.4rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.15);
    letter-spacing: 2px;
    text-transform: uppercase;
}


/* Overlay no hover */
.fcard-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(0,0,0,0.75) 0%,
        rgba(0,0,0,0.1) 50%,
        transparent 100%
    );
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 3;
}

.fcard:hover .fcard-overlay { opacity: 1; }

/* Botão play */
.fcard-play-btn {
    width: 52px;
    height: 52px;
    background: rgba(59,130,246,0.9);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0.7);
    transition: transform 0.3s ease, background 0.2s;
    backdrop-filter: blur(4px);
    padding-left: 4px; /* Centraliza o ícone play */
}

.fcard:hover .fcard-play-btn { transform: scale(1); }
.fcard-play-btn:hover { background: #2563eb; }

/* Badge de nota (rating) */
.fcard-rating {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(6px);
    padding: 4px 9px;
    border-radius: 8px;
    display: none;
    align-items: center;
    gap: 5px;
    z-index: 4;
    border: 1px solid rgba(255,255,255,0.08);
}

.fcard-rating i   { color: #FBBF24; font-size: 0.75rem; }
.fcard-rating-val { color: #fff; font-size: 0.8rem; font-weight: 700; }

/* Badge do ano */
.fcard-year {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(59,130,246,0.8);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    z-index: 4;
    backdrop-filter: blur(4px);
}

/* Botão Favoritar no Card */
.fcard-fav-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

.fcard-fav-btn:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.fcard-fav-btn.active {
    color: #FBBF24; /* Apenas o ícone fica amarelo */
}

.fcard-fav-btn i {
    font-size: 0.9rem;
    transition: transform 0.2s;
}

.fcard-fav-btn:active i {
    transform: scale(1.4);
}

/* Info abaixo do poster */
.fcard-info { padding: 0 2px; }

.fcard-title {
    font-size: 0.82rem;
    color: #CBD5E1;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s;
}
.fcard:hover .fcard-title { color: #fff; }

/* ── ESTADO DE LOADING ───────────────────────────────── */
.loading-filmes {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    gap: 16px;
    color: #475569;
    font-size: 0.9rem;
}

.spinner-filmes {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(59,130,246,0.15);
    border-top: 3px solid #3B82F6;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

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

/* ── ESTADO VAZIO ────────────────────────────────────── */
.filmes-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    gap: 16px;
    color: #334155;
}

.filmes-empty i   { font-size: 3rem; }
.filmes-empty p   { font-size: 1rem; text-align: center; }

/* ── BOTÃO CARREGAR MAIS ─────────────────────────────── */
.load-more-wrapper {
    display: none;
    justify-content: center;
    padding: 8px 24px 60px;
}

.btn-carregar-mais {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #1e3a5f, #1d4ed8);
    border: 1px solid rgba(59,130,246,0.4);
    color: #fff;
    padding: 14px 32px;
    border-radius: 100px;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 24px rgba(59,130,246,0.2);
}

.btn-carregar-mais i { font-size: 1.1rem; animation: bounce-down 1.8s ease-in-out infinite; }

@keyframes bounce-down {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(4px); }
}

.btn-carregar-mais:hover {
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    box-shadow: 0 8px 30px rgba(59,130,246,0.4);
    transform: translateY(-2px);
}

.remaining-badge {
    background: rgba(255,255,255,0.15);
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.78rem;
    font-weight: 700;
}

/* ── BACK TO TOP ─────────────────────────────────────── */
.back-to-top {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 44px;
    height: 44px;
    background: #3B82F6;
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.3s, transform 0.3s;
    box-shadow: 0 4px 16px rgba(59,130,246,0.4);
}
.back-to-top.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.back-to-top:hover { background: #2563eb; transform: translateY(-2px); }

/* ── RESPONSIVIDADE ──────────────────────────────────── */

/* TABLETS RETRATO (portrait ≤ 1024px) - FILMES */
@media (max-width: 1024px) and (orientation: portrait) {
    .movies-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 16px;
        padding: 24px 4%;
    }
}

/* SMART TV (960px) E TABLETS DEITADOS - FILMES */
@media (max-width: 1024px) and (orientation: landscape) {
    .movies-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 16px;
        padding: 24px 4%;
    }
}

@media (max-width: 768px) {
    .filmes-hero { padding: 32px 16px 24px; }
    .filmes-hero h1 { font-size: 2rem; }
    .filmes-hero p  { font-size: 0.9rem; }

    .movies-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 12px;
        padding: 20px 12px;
    }

    .fcard-play-btn { width: 44px; height: 44px; font-size: 1rem; }

    .btn-carregar-mais { padding: 12px 24px; font-size: 0.88rem; }

    .back-to-top { bottom: 16px; right: 16px; width: 40px; height: 40px; }
}

@media (max-width: 480px) {
    .movies-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        padding: 16px 10px;
    }
    .fcard-title { font-size: 0.75rem; }
}

@media (min-width: 1600px) {
    .movies-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        padding: 32px 8%;
    }
}
