/* home.css */

:root {
    --bg: #0f1115;
    --surface: #1a1d23;
    --card: #242830;
    --accent: #e63946;
    --accent-hover: #ff4d5a;
    --text-main: #f1f5f9;
    --text-dim: #94a3b8;
    --header-height: 70px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --yellow-donation: #FFD700;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    padding-top: var(--header-height);
    line-height: 1.6;
}

/* --- Reuso do Header (Global, não repetir aqui) --- */

/* --- Layout Principal --- */
.layout-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 60px; /* Espaço entre as seções */
}

/* --- Seção Principal: Destaque + Doadores --- */
.main-display {
    display: grid;
    grid-template-columns: 2fr 1fr; /* 2/3 para obra, 1/3 para doadores */
    gap: 40px;
    min-height: 500px;
    max-height: 600px;
    overflow: hidden; /* Garante que nada vaze */
    border-radius: 16px;
     /* Fundo para o caso de carregar sem imagem */
    box-shadow: 0 15px 40px rgba(0,0,0,0.3);
}

.featured-comic-area {
    position: relative;
    grid-column: 1 / 2;
    background: var(--surface);
    border-radius: 16px;
    overflow: hidden;
    display: flex; /* Para centralizar o conteúdo */
    align-items: flex-end; /* Conteúdo na parte inferior */
    color: #fff;
    padding: 40px;
}

.featured-comic-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.featured-comic-background img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.4) blur(3px); /* Escurece e borra o fundo */
    transform: scale(1.05);
}

.featured-comic-background .overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(15, 17, 21, 0.9) 0%, rgba(15, 17, 21, 0.6) 50%, transparent 100%);
}

.featured-comic-content {
    position: relative;
    z-index: 2;
    max-width: 80%; /* Limita a largura do texto */
}

.featured-comic-content .badge {
    background: var(--accent);
    color: #fff;
    padding: 6px 15px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 15px;
    display: inline-block;
}

.featured-comic-content h1 {
    font-size: 2.8rem;
    margin: 10px 0 15px;
    line-height: 1.1;
    font-weight: 800;
    text-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.featured-comic-content p {
    font-size: 1rem;
    color: var(--text-dim);
    margin-bottom: 25px;
    max-width: 90%;
}

.btn-read {
    background: var(--accent);
    color: #fff;
    padding: 15px 30px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    transition: var(--transition);
    display: inline-block;
}

.btn-read:hover {
    background: var(--accent-hover);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(230, 57, 70, 0.4);
}

.top-donors-area {
    grid-column: 2 / 3;
    background: var(--surface);
    border-radius: 16px;
    padding: 30px;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Empurra o botão de doação para baixo */
    border: 1px solid rgba(255,255,255,0.05);
}

.top-donors-area h2 {
    font-size: 1.3rem;
    color: var(--yellow-donation);
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.top-donors-area h2 .fas { color: var(--yellow-donation); font-size: 1.5rem; }


.donors-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1; /* Permite que a lista ocupe o espaço disponível */
}

.donor-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.95rem;
}
.donor-item:last-child { border-bottom: none; }

.donor-rank {
    font-weight: 800;
    color: var(--accent);
    width: 30px;
    text-align: center;
}

.donor-name {
    flex-grow: 1;
    margin-left: 10px;
    font-weight: 600;
    color: #fff;
}

.donor-amount {
    font-weight: 700;
    color: var(--yellow-donation);
    font-size: 0.9rem;
}

.btn-donate-full {
    display: block;
    width: 100%;
    text-align: center;
    background: var(--yellow-donation);
    color: var(--bg); /* Texto escuro no botão amarelo */
    padding: 12px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    margin-top: 30px;
    transition: var(--transition);
}
.btn-donate-full:hover {
    background: #FFEB3B;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 215, 0, 0.4);
}


/* --- Carrosséis de Obras (Shelf) --- */
.shelf {
    margin-bottom: 40px;
}

.shelf-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.shelf-header h2 {
    font-size: 1.8rem;
    margin: 0;
    color: var(--text-main);
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
}
.shelf-header h2 .fas { font-size: 1.4rem; color: var(--accent); }

.shelf-header .view-all {
    color: var(--text-dim);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
}
.shelf-header .view-all:hover { color: var(--accent); }

.carousel-wrapper {
    position: relative;
    overflow: hidden;
    padding: 0 40px; /* Espaço para os botões de navegação */
}

.carousel-track {
    display: flex;
    gap: 20px;
    overflow-x: scroll; /* Ativar rolagem horizontal */
    scroll-behavior: smooth; /* Rolagem suave */
    -webkit-overflow-scrolling: touch; /* Melhorar scroll em iOS */
    padding-bottom: 20px; /* Espaço para a barra de rolagem */
    scrollbar-width: thin; /* Estilizar scrollbar Firefox */
    scrollbar-color: var(--accent) transparent; /* Estilizar scrollbar Firefox */
}

/* Estilo para a scrollbar (Webkit browsers) */
.carousel-track::-webkit-scrollbar {
    height: 8px;
}

.carousel-track::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.carousel-track::-webkit-scrollbar-thumb {
    background-color: var(--accent);
    border-radius: 10px;
    border: 2px solid var(--surface);
}


/* Botões de navegação do carrossel */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(15, 17, 21, 0.8);
    border: none;
    color: #fff;
    font-size: 1.5rem;
    padding: 15px 10px;
    cursor: pointer;
    z-index: 10;
    border-radius: 8px;
    transition: var(--transition);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.carousel-btn:hover {
    background: var(--accent);
    transform: translateY(-50%) scale(1.05);
}

.carousel-btn.prev { left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.carousel-btn.next { right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }


/* --- Cards de Obra (Reuso do Search) --- */
/* Este estilo deve ser o mesmo usado em search.css para consistência */
.work-card {
    position: relative;
    display: block; /* Para o link cobrir todo o card */
    width: 180px; /* Largura fixa para os cards no carrossel */
    flex-shrink: 0; /* Impede que os cards encolham */
    background: var(--card);
    border-radius: 12px;
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid rgba(255,255,255,0.05);
    text-decoration: none;
    color: var(--text-main); /* Garante cor do texto */
}

.work-card:hover {
    transform: translateY(-10px);
    border-color: var(--accent);
    box-shadow: 0 15px 30px rgba(0,0,0,0.5);
}

.vote-badge, .pages-badge {
    position: absolute;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 800;
    font-size: 0.7rem;
    color: white;
    z-index: 10;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

.vote-badge { top: 12px; right: 12px; }
.pages-badge { 
    top: 12px; 
    left: 12px; 
    background: rgba(15, 17, 21, 0.7); 
    backdrop-filter: blur(8px); 
    border: 1px solid rgba(255,255,255,0.1);
}

.work-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 2/3;
    overflow: hidden;
}

.work-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block; /* Remove espaço extra abaixo da imagem */
    transition: transform 0.5s ease;
}

.work-card:hover .work-thumb img { transform: scale(1.1); }

.work-info-overlay {
    padding: 15px;
    background: linear-gradient(to top, rgba(15, 17, 21, 1) 0%, rgba(15, 17, 21, 0.8) 50%, transparent 100%);
    position: absolute;
    bottom: 0;
    width: 100%;
    box-sizing: border-box;
}

.work-info-overlay h4 {
    margin: 0 0 5px 0;
    color: #fff;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.work-stats-row {
    color: var(--text-dim);
    font-size: 0.75rem;
    display: flex;
    justify-content: space-between;
}


/* --- Esqueleto de Carregamento (Skeleton Loaders) --- */
.skeleton {
    background-color: #333; /* Cor base do esqueleto */
    background-image: linear-gradient(90deg, #333 0px, #444 40px, #333 80px);
    background-size: 600px;
    animation: skeleton-loading 1.5s infinite linear;
}

.featured-comic-area .skeleton {
    height: 100%;
    width: 100%;
    background-color: #242830; /* Fundo mais escuro para o destaque */
}
.featured-comic-content .skeleton { /* Placeholder para texto dentro do destaque */
    height: 1.2em;
    margin-bottom: 10px;
    border-radius: 4px;
}
.featured-comic-content h1.skeleton { width: 80%; height: 3em; }
.featured-comic-content p.skeleton { width: 90%; height: 2em; }
.featured-comic-content .btn-read.skeleton { width: 150px; height: 50px; border-radius: 8px;}


.donor-item.skeleton .donor-name,
.donor-item.skeleton .donor-amount {
    background-color: #444;
    height: 1em;
    border-radius: 4px;
}
.donor-item.skeleton .donor-name { width: 70%; }
.donor-item.skeleton .donor-amount { width: 20%; }
.donor-item.skeleton .donor-rank { background-color: transparent; } /* Não aplicar ao rank */


.work-card.skeleton {
    min-width: 180px; /* Garante que o esqueleto tenha o tamanho do card */
    height: 350px; /* Altura aproximada do card completo */
    border-radius: 12px;
}

/* Estilos para o Ranking Manual */
.rank-badge {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    font-weight: 800;
    font-size: 0.8rem;
    margin-right: 12px;
}

/* Cores dos Medalhistas */
.rank-1 .rank-badge { 
    background: #FFD700; 
    color: #000; 
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}
.rank-1 .donor-name { color: #FFD700; font-size: 1.1rem; }

.rank-2 .rank-badge { 
    background: #C0C0C0; 
    color: #000; 
}

.rank-3 .rank-badge { 
    background: #CD7F32; 
    color: #000; 
}

.donor-item {
    transition: var(--transition);
    padding: 15px 10px;
    border-radius: 8px;
}

.donor-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.donation-cta {
    text-align: center;
    margin-top: 20px;
}

.donation-cta p {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 10px;
}

@keyframes skeleton-loading {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}


/* ==========================================================================
   HOME MOBILE (DESTAQUE + MURAL)
   ========================================================================== */
@media (max-width: 968px) {
    /* Mata o Grid e usa Flex Column */
    .main-display {
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
        max-height: none !important;
        gap: 20px !important;
        padding: 10px !important;
        margin-top: 10px !important;
    }

    /* Banner Principal */
    .featured-comic-area {
        width: 100% !important;
        height: 320px !important; /* Altura definida para não achatar */
        min-height: 320px !important;
        border-radius: 12px !important;
        overflow: hidden !important;
    }

    /* Placar Mural de Honra */
    .top-donors-area {
        width: 100% !important;
        height: auto !important;
        padding: 20px !important;
        border: 1px solid rgba(255,255,255,0.05) !important;
        background: #121212 !important;
        border-radius: 12px !important;
    }

    /* Carrosséis (Prateleiras) */
    .carousel-track {
        gap: 15px !important;
        padding-bottom: 10px !important;
    }
    
    .work-card {
        min-width: 140px !important; /* Cards menores para caber mais no mobile */
    }
}

@media (max-width: 600px) {
    .featured-comic-area {
        padding: 15px;
        height: 300px;
    }
    .featured-comic-content h1 {
        font-size: 1.8rem;
    }
    .btn-read {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
    .shelf-header h2 {
        font-size: 1.3rem;
    }
    .carousel-wrapper {
        padding: 0 10px;
    }
    .carousel-btn {
        font-size: 1rem;
        padding: 8px 5px;
    }
}