/* ================================================
   BEMFICA MACHADO - CATÁLOGO (3 NÍVEIS)
   Arquivo: catalogo.css
   Descrição: Estilos do sistema de catálogo
   ================================================ */

/* ========================================
   CONSTANTES E CONFIGURAÇÕES
   ======================================== */

:root {
    --header-height: 100px; /* Espaço reservado para header flutuante */
    --catalog-transition: 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ========================================
   BASE - TODOS OS NÍVEIS
   ======================================== */

.catalog-level {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: #000000;
    transform: scale(0.96) translateZ(0);
    opacity: 0;
    visibility: hidden;
    z-index: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    transition: all var(--catalog-transition);
}

.catalog-level.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateZ(0);
    z-index: 5;
}

/* ========================================
   NÍVEL 1: OVERVIEW (Sem Scroll)
   Classificação: Granito, Quartzito, Minerais
   ======================================== */

.catalog-overview {
    background: #000000;
    position: relative;
    height: 100vh;
    overflow: hidden; /* SEM SCROLL */
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
}

/* Header do Nível 1 - Título próximo à header para imponência */
.catalog-overview .page-header {
    margin-top: calc(var(--header-height) + 0rem); /* COLADO na linha da header */
    margin-bottom: 8rem; /* MUITO espaço para manter cards na mesma posição */
    text-align: center;
    padding: 0 2rem;
}

.catalog-overview .page-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.5rem, 4vw, 4rem);
    font-weight: 300;
    line-height: 1.2; /* Linha compacta para parecer imponente */
    color: var(--gold);
    margin: 0;
    letter-spacing: 0.02em;
}

.catalog-overview .page-subtitle {
    font-size: clamp(0.9rem, 1.5vw, 1.1rem);
    color: var(--text-muted);
    margin-top: 1rem;
    font-weight: 300;
    letter-spacing: 0.05em;
}

/* Grid de Cards - Ajustado para caber sem scroll */
.catalog-overview .catalog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    max-width: 1200px;
    width: 90%;
    padding: 0 2rem;
    margin-top: 2rem; /* Espaço extra entre título e cards */
}

/* Cards das Categorias */
.catalog-card {
    position: relative;
    height: 400px; /* Ajustado para caber na tela */
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.catalog-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: var(--gold);
    box-shadow: 0 20px 60px rgba(212, 175, 55, 0.3);
}

.catalog-card-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.6s ease;
}

.catalog-card:hover .catalog-card-bg {
    transform: scale(1.1);
}

.catalog-card-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.2) 0%,
        rgba(0, 0, 0, 0.7) 100%
    );
    transition: opacity 0.4s ease;
}

.catalog-card:hover .catalog-card-bg::before {
    opacity: 0.5;
}

.catalog-card-content {
    position: relative;
    z-index: 2;
    padding: 2rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    color: white;
}

.catalog-card-content h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    font-weight: 400;
    margin-bottom: 0.8rem;
    color: var(--gold);
}

.catalog-card-content p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 1.5rem;
}

.explore-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gold);
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    transition: all 0.3s ease;
}

.catalog-card:hover .explore-btn {
    gap: 1rem;
}

.explore-btn .arrow {
    transition: transform 0.3s ease;
}

.catalog-card:hover .explore-btn .arrow {
    transform: translateX(5px);
}

/* ========================================
   NÍVEL 2: CATEGORY (Com Scroll)
   Lista de produtos por categoria
   ======================================== */

.catalog-category {
    background: #000000;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding-top: 0; /* Header gerencia seu próprio espaçamento */
    padding-left: 3rem;
    padding-right: 3rem;
    padding-bottom: 4rem;
    gap: 0;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ========================================
   HEADER ESCURO NO NÍVEL 2 (Category com scroll)
   Igual ao Contato - header transparente vira escura
   ======================================== */

/* Quando Nível 2 (Category) está ativo, header fica escuro */
body.catalog-level-2 header {
    background: linear-gradient(180deg,
        rgba(0, 0, 0, 1) 0%,
        rgba(0, 0, 0, 0.98) 70%,
        rgba(0, 0, 0, 0.95) 85%,
        rgba(0, 0, 0, 0.7) 100%) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
}

/* Overlay adicional abaixo da header para fade effect */
body.catalog-level-2 header::after {
    content: '';
    position: absolute;
    bottom: -30px;
    left: 0;
    width: 100%;
    height: 30px;
    background: linear-gradient(180deg,
        rgba(0, 0, 0, 0.6) 0%,
        rgba(0, 0, 0, 0.3) 50%,
        transparent 100%);
    pointer-events: none;
    z-index: -1;
}

/* TAMBÉM para Nível 3 (Product Detail) */
body.catalog-level-3 header {
    background: linear-gradient(180deg,
        rgba(0, 0, 0, 1) 0%,
        rgba(0, 0, 0, 0.98) 70%,
        rgba(0, 0, 0, 0.95) 85%,
        rgba(0, 0, 0, 0.7) 100%) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
}

body.catalog-level-3 header::after {
    content: '';
    position: absolute;
    bottom: -30px;
    left: 0;
    width: 100%;
    height: 30px;
    background: linear-gradient(180deg,
        rgba(0, 0, 0, 0.6) 0%,
        rgba(0, 0, 0, 0.3) 50%,
        transparent 100%);
    pointer-events: none;
    z-index: -1;
}

/* Seta de Voltar */
.back-arrow-minimal {
    position: fixed;
    top: calc(var(--header-height) + 0.5rem); /* Próximo à header, consistente */
    left: 2rem;
    font-size: 2rem;
    color: var(--gold);
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(26, 26, 26, 0.8);
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.back-arrow-minimal:hover {
    transform: translateX(-5px);
    background: rgba(212, 175, 55, 0.2);
    border-color: var(--gold);
}

/* Header da Categoria */
.category-page-header {
    text-align: center;
    margin-top: calc(var(--header-height) + 0.5rem); /* COLADO próximo à header */
    margin-bottom: 3rem; /* Espaço até os produtos */
    padding: 0 2rem;
}

.category-page-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.5rem, 4vw, 3.5rem);
    font-weight: 300;
    color: var(--gold);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.category-page-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 300;
    line-height: 1.6;
}

/* Grid de Produtos */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2.5rem;
    width: 100%;
    max-width: 1400px;
    padding-bottom: 2rem;
}

/* ========================================
   NÍVEL 3: PRODUCT DETAIL (Sem Scroll)
   Detalhes imersivos do produto
   ======================================== */

.catalog-level.catalog-product {
    background: #0a0a0a;
    position: fixed; /* Fixed para imersão total */
    display: block;
    padding: 0;
    padding-top: var(--header-height); /* LINHA INVISÍVEL */
    justify-content: unset;
    align-items: unset;
    overflow: hidden; /* SEM SCROLL */
}

.catalog-level.catalog-product.active {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    height: 100vh !important;
    width: 100vw !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 10;
    overflow: hidden !important;
}

/* Botão de Fechar */
.product-close-btn {
    position: fixed;
    top: calc(var(--header-height) + 0.5rem); /* Próximo à header, consistente */
    right: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(26, 26, 26, 0.9);
    border: 1px solid rgba(212, 175, 55, 0.3);
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 11;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
}

.catalog-level.catalog-product.active .product-close-btn {
    opacity: 1;
    visibility: visible;
}

.product-close-btn:hover {
    background: rgba(212, 175, 55, 0.2);
    border-color: var(--gold);
    transform: rotate(90deg);
}

/* Lados do Produto */
.product-image-side {
    height: 100vh;
    overflow: hidden;
    background: #000;
    padding-top: var(--header-height);
}

.product-info-side {
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    background: #0a0a0a;
    padding: calc(var(--header-height) + 1rem) 3rem 3rem 3rem; /* Mais próximo à header */
}

/* ========================================
   MEDIA QUERIES - RESPONSIVIDADE
   ======================================== */

@media (max-width: 1024px) {
    .catalog-overview .catalog-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    .catalog-card {
        height: 350px;
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 80px;
        --catalog-transition: 0.3s ease-out; /* MOBILE: Transições mais rápidas */
    }

    /* Página do catálogo ocupa 100% em mobile */
    #catalogo {
        width: 100% !important;
        max-width: 100vw !important;
        left: 0 !important;
        right: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Nível 1: COM scroll em mobile (igual desktop) */
    .catalog-level.catalog-overview {
        height: auto !important;
        min-height: 100vh !important;
        overflow-y: auto !important; /* COM SCROLL - mobile precisa de scroll */
        overflow-x: hidden;
        padding: calc(var(--header-height) + 1.5rem) 0 0 0 !important; /* Padding-bottom removido */
        width: 100% !important;
        max-width: 100vw !important;
        left: 0 !important;
        right: 0 !important;
        margin: 0 !important;
    }

    /* Performance: Simplificar transições em mobile */
    .catalog-level {
        transition: opacity 0.3s ease-out, visibility 0.3s ease-out;
        transform: none !important; /* Remove scale/transform pesados */
    }

    .catalog-overview .page-header {
        margin-top: 0;
        margin-bottom: 2rem;
        padding: 0 1.5rem;
        width: 100%;
        max-width: 100%;
        text-align: center;
    }

    .catalog-overview .page-title {
        font-size: 2.5rem;
        line-height: 1.2;
    }

    .catalog-overview .page-subtitle {
        font-size: 0.9rem;
        line-height: 1.6;
    }

    .catalog-overview .catalog-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
        padding: 0 1.5rem 1.5rem 1.5rem; /* Apenas 1.5rem no final */
    }

    .catalog-card {
        height: 320px;
        width: 100%;
    }

    /* Nível 2: Category - Ocupa 100% com scroll próprio */
    .catalog-level.catalog-category {
        width: 100% !important;
        max-width: 100vw !important;
        left: 0 !important;
        right: 0 !important;
        padding: calc(var(--header-height) + 1.5rem) 0 3rem 0 !important;
        margin: 0 !important;
        height: auto !important;
        min-height: 100vh !important;
        overflow-y: auto !important;
        overflow-x: hidden;
    }

    .catalog-category {
        padding-left: 0; /* Removido - pai já controla */
        padding-right: 0; /* Removido - pai já controla */
        padding-top: 0;
        width: 100%;
        max-width: 100%;
    }

    .category-page-header {
        padding: 0 1.5rem;
        width: 100%;
        max-width: 100%;
        margin-top: 0;
        padding-top: 4rem; /* Espaço para back arrow (1rem topo + 40px botão + margem) */
    }

    .products-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        width: 100%;
        max-width: 100%;
        padding: 0;
        margin: 0 1.5rem;
    }

    .product-card {
        width: 100%;
        max-width: 100%;
    }

    /* Nível 3: Product Detail - Ocupa 100% */
    .catalog-level.catalog-product {
        width: 100% !important;
        max-width: 100vw !important;
        left: 0 !important;
        right: 0 !important;
        padding: 0 !important;
        padding-top: var(--header-height) !important;
        margin: 0 !important;
    }

    .catalog-level.catalog-product.active {
        display: grid !important; /* CRITICAL: Grid precisa ser declarado */
        grid-template-columns: 1fr !important;
        grid-template-rows: 50vh 50vh;
        width: 100% !important;
        max-width: 100vw !important;
        padding-top: var(--header-height) !important;
    }

    .product-image-side {
        width: 100%;
        max-width: 100%;
        padding-top: 0;
    }

    .product-info-side {
        padding: 2rem 1.5rem;
        width: 100%;
        max-width: 100%;
    }

    /* Back arrow em mobile */
    .back-arrow-minimal {
        left: 1rem;
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
        top: 1rem; /* Mais próximo ao topo, acima do título */
        z-index: 999; /* Garantir que fique acima do conteúdo */
    }

    .product-close-btn {
        right: 1rem;
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    :root {
        --header-height: 70px;
    }

    .catalog-overview .page-title {
        font-size: 2rem;
    }

    .catalog-card {
        height: 250px;
    }

    .back-arrow-minimal {
        width: 40px;
        height: 40px;
        left: 1rem;
    }

    .product-close-btn {
        width: 40px;
        height: 40px;
        right: 1rem;
    }
}