/*
 * SEÇÃO DE CATEGORIAS - SAVAS
 * Layout responsivo: 2 por linha desktop, 1 por linha mobile
 */

/* ==================== SEÇÃO CATEGORIAS ==================== */

.categories-section {
    padding: var(--spacing-3xl) 0;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    position: relative;
}

.categories-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #28a745, transparent);
}

.section-subtitle {
    color: #6c757d;
    font-size: 1.1rem;
    margin-top: 10px;
    font-weight: 400;
}

/* ==================== GRID DE CATEGORIAS ==================== */

.categories-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 quadrados por linha no desktop */
    gap: 20px; /* Espaço entre os quadrados */
    margin-top: 50px;
    width: 100%;
}

/* ==================== ITEM DA CATEGORIA ==================== */

.category-item {
    position: relative;
    border-radius: 0; /* Quadrado perfeito - sem bordas arredondadas */
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    background: #ffffff;
}

.category-item:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.category-link {
    display: block;
    text-decoration: none;
    color: inherit;
    position: relative;
}

/* ==================== IMAGEM DA CATEGORIA (QUADRADO PERFEITO) ==================== */

.category-image {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%; /* Quadrado perfeito - altura = 100% da largura */
    overflow: hidden;
    background: linear-gradient(45deg, #f8f9fa, #e9ecef);
}

.category-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.6s ease;
    filter: brightness(0.9) contrast(1.1);
}

.category-item:hover .category-image img {
    transform: scale(1.1);
}

/* ==================== OVERLAY DA CATEGORIA ==================== */

.category-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.3) 0%,
        rgba(0, 0, 0, 0.5) 50%,
        rgba(0, 0, 0, 0.7) 100%
    );
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 2;
}

.category-item:hover .category-overlay {
    opacity: 1;
}

.category-content {
    text-align: center;
    color: white;
    transform: translateY(20px);
    transition: transform 0.4s ease;
}

.category-item:hover .category-content {
    transform: translateY(0);
}

.category-name {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.category-description {
    font-size: 1.1rem;
    margin-bottom: 20px;
    opacity: 0.9;
    font-weight: 400;
}

.category-btn {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    padding: 12px 30px;
    border-radius: 0; /* Quadrado - sem bordas arredondadas */
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    display: inline-block;
}

.category-btn:hover {
    background: #28a745;
    color: white;
    border-color: #28a745;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.4);
}

/* ==================== RESPONSIVIDADE ==================== */

/* Tablet Grande */
@media (max-width: 1200px) {
    .categories-grid {
        gap: 20px;
    }
    
    .category-item {
        border-radius: 0; /* Quadrado perfeito no tablet grande */
    }
    
    .category-name {
        font-size: 1.8rem;
    }
}

/* Tablet */
@media (max-width: 1024px) {
    .categories-section {
        padding: var(--spacing-2xl) 0;
    }
    
    .categories-grid {
        gap: 15px;
    }
    
    .category-item {
        border-radius: 0; /* Quadrado perfeito no tablet */
    }
    
    .category-name {
        font-size: 1.6rem;
    }
    
    .category-description {
        font-size: 1rem;
    }
}

/* Mobile - 1 quadrado por linha */
@media (max-width: 768px) {
    .categories-grid {
        grid-template-columns: 1fr; /* 1 quadrado por linha no mobile */
        gap: 20px;
        margin-top: 40px;
    }
    
    .category-item {
        border-radius: 0; /* Quadrado perfeito no mobile */
    }
    
    .category-name {
        font-size: 1.5rem;
    }
    
    .category-description {
        font-size: 0.95rem;
        margin-bottom: 15px;
    }
    
    .category-btn {
        padding: 10px 25px;
        font-size: 0.85rem;
        border-radius: 0; /* Botão quadrado no mobile */
    }
    
    .category-item:hover {
        transform: translateY(-5px) scale(1.01);
    }
}

/* Mobile Pequeno */
@media (max-width: 480px) {
    .categories-section {
        padding: var(--spacing-xl) 0;
    }
    
    .categories-grid {
        gap: 15px;
        margin-top: 30px;
    }
    
    .category-item {
        border-radius: 0; /* Garantir quadrado perfeito no mobile */
    }
    
    .category-name {
        font-size: 1.3rem;
    }
    
    .category-description {
        font-size: 0.9rem;
    }
    
    .category-btn {
        padding: 8px 20px;
        font-size: 0.8rem;
        border-radius: 0; /* Botão quadrado no mobile */
    }
}

/* ==================== ANIMAÇÕES ==================== */

@keyframes categorySlideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category-item {
    animation: categorySlideIn 0.6s ease-out;
}

.category-item:nth-child(1) { animation-delay: 0.1s; }
.category-item:nth-child(2) { animation-delay: 0.2s; }
.category-item:nth-child(3) { animation-delay: 0.3s; }
.category-item:nth-child(4) { animation-delay: 0.4s; }
.category-item:nth-child(5) { animation-delay: 0.5s; }
.category-item:nth-child(6) { animation-delay: 0.6s; }

/* ==================== LAZY LOADING ==================== */

.category-image img[loading="lazy"] {
    transition: opacity 0.3s ease;
}

.category-image img[loading="lazy"]:not([src]) {
    opacity: 0;
}

/* ==================== ESTADOS ESPECIAIS ==================== */

/* Categoria sem imagem */
.category-image:not(:has(img)) {
    background: linear-gradient(45deg, #f8f9fa, #e9ecef);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 1.5rem;
}

.category-image:not(:has(img))::after {
    content: '🏷️';
    font-size: 4rem;
    opacity: 0.3;
}

/* ==================== OTIMIZAÇÕES DE PERFORMANCE ==================== */

.category-item {
    will-change: transform;
}

.category-image img {
    will-change: transform;
}

.category-overlay {
    will-change: opacity;
}

.category-content {
    will-change: transform;
}

/* ==================== ACESSIBILIDADE ==================== */

.category-link:focus {
    outline: 3px solid #28a745;
    outline-offset: 2px;
}

.category-link:focus .category-overlay {
    opacity: 1;
}

.category-link:focus .category-content {
    transform: translateY(0);
}

/* ==================== PRINT STYLES ==================== */

@media print {
    .categories-section {
        background: white;
        box-shadow: none;
    }
    
    .category-overlay {
        opacity: 1;
        background: rgba(0, 0, 0, 0.1);
    }
    
    .category-item {
        break-inside: avoid;
    }
}
