/* ===================================================================== */
/*                           🏠 HOMEPAGE - INDEX                           */
/* ===================================================================== */

/* ===================================
   VARIÁVEIS DE COR - HOMEPAGE
   ================================== */
:root {
    --primary: #667eea;          /* Azul lógico */
    --secondary: #764ba2;        /* Roxo precisão */
    --accent: #f093fb;           /* Rosa suave */
    --light: #f8f9ff;            /* Fundo azul claro */
    --gradient: linear-gradient(135deg, #667eea, #764ba2);
}

/* ===================================
   LAYOUT PRINCIPAL
   ================================== */
.index-calculator-section {
    margin-bottom: 3rem;
}

.index-header {
    text-align: center;
    margin-bottom: 3rem;
}

.index-header h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--primary);
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.index-header p {
    font-size: 1.3rem;
    color: #5a6c7d;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
    font-weight: 500;
}

.index-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 3rem 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    overflow-x: hidden;
    max-width: 100%;
}

/* ===================================
   SEÇÃO POPULARES - CARDS MENORES
   ================================== */
.index-populares-section {
    margin-bottom: 4rem;
}

.index-populares-section h2 {
    color: #2c3e50;
    font-size: 2.2rem;
    margin-bottom: 2rem;
    text-align: center;
    border-bottom: 3px solid var(--primary);
    padding-bottom: 1rem;
    display: inline-block;
    width: 100%;
}

.index-populares-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* REDUZIDO de 300px */
    gap: 1.5rem; /* REDUZIDO de 2rem */
    margin-top: 2rem;
}

.index-calc-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
    border: 2px solid #e0e6ed;
    border-radius: 15px;
    padding: 1.5rem; /* REDUZIDO de 2rem */
    text-decoration: none;
    color: #2c3e50;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
    min-height: 200px; /* CONTROLA ALTURA MÍNIMA */
}

.index-calc-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.index-calc-card:hover {
    border-color: var(--primary);
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.2);
}

.index-calc-card:hover::before {
    opacity: 1;
}

.index-card-icon {
    font-size: 2.8rem; /* REDUZIDO de 3.5rem */
    margin-bottom: 0.8rem; /* REDUZIDO de 1rem */
    display: block;
}

.index-calc-card h3 {
    color: var(--primary);
    margin-bottom: 0.6rem; /* REDUZIDO de 0.8rem */
    font-size: 1.3rem; /* REDUZIDO de 1.4rem */
    font-weight: 600;
    line-height: 1.3;
}

.index-calc-card p {
    color: #5a6c7d;
    margin: 0 0 0.8rem 0; /* REDUZIDO margin-bottom */
    font-size: 0.95rem; /* REDUZIDO de 1rem */
    line-height: 1.4;
}

.index-calc-card .card-categoria {
    display: inline-block;
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary);
    padding: 0.25rem 0.7rem; /* REDUZIDO padding */
    border-radius: 15px;
    font-size: 0.75rem; /* REDUZIDO de 0.8rem */
    font-weight: 500;
    margin-top: 0.5rem; /* REDUZIDO de 1rem */
}

/* ===================================
   SEÇÕES DE CATEGORIAS - CARDS SIMPLES (3-4 POR LINHA)
   ================================== */
.index-categorias-section {
    margin-top: 3rem;
}

.index-categorias-section > h2 {
    color: #2c3e50;
    font-size: 2.2rem;
    margin-bottom: 3rem;
    text-align: center;
    border-bottom: 3px solid var(--primary);
    padding-bottom: 1rem;
}

/* GRID DE CATEGORIAS - 3-4 POR LINHA */
.index-categorias-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); /* 3-4 por linha */
    gap: 1.5rem;
    margin-top: 2rem;
}

.index-categoria-card-simples {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
    border: 2px solid #e0e6ed;
    border-radius: 15px;
    padding: 1.5rem;
    text-decoration: none;
    color: #2c3e50;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
    min-height: 180px;
}

.index-categoria-card-simples::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.index-categoria-card-simples:hover {
    border-color: var(--primary);
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.2);
}

.index-categoria-card-simples:hover::before {
    opacity: 1;
}

.categoria-card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.index-categoria-card-simples h4 {
    color: var(--primary);
    margin-bottom: 0.8rem;
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.3;
}

.index-categoria-card-simples p {
    color: #5a6c7d;
    margin: 0 0 1rem 0;
    font-size: 0.95rem;
    line-height: 1.4;
}

.categoria-count {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}

/* ===================================
   SISTEMA DE EXPANSÃO DE CATEGORIAS - CORRIGIDO
   ================================== */

/* Container do botão ver mais */
.ver-mais-container-index {
    text-align: center;
    margin: 2rem 0;
}

/* Botão ver mais/menos */
.ver-mais-btn-index {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.ver-mais-btn-index:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
}

.ver-mais-btn-index:active {
    transform: translateY(0);
}

/* Grid das categorias extras - CORRIGIDO: Estado inicial OCULTO */
.index-categorias-grid-extras {
    display: none; /* MUDOU: Começa oculto */
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
    opacity: 0; /* MUDOU: Começa invisível */
    max-height: 0; /* MUDOU: Altura zero inicial */
    overflow: hidden; /* MUDOU: Esconde overflow */
    transition: opacity 0.3s ease, max-height 0.3s ease;
}

/* Estado visível - NOVO */
.index-categorias-grid-extras.visible {
    display: grid;
    opacity: 1;
    max-height: 5000px; /* Altura suficiente para expandir */
}


/* ===================================
   ESTATÍSTICAS DO SITE
   ================================== */
.index-stats-section {
    margin-top: 3rem;
    text-align: center;
}

.index-stats-section h2 {
    color: #2c3e50;
    font-size: 2rem;
    margin-bottom: 2rem;
    border-bottom: 3px solid var(--accent);
    padding-bottom: 1rem;
    display: inline-block;
}

.index-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.index-stat-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); /* GRADIENTE FIXO */
    color: white;
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.index-stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    z-index: 0;
}

.index-stat-item:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.4);
}

.index-stat-number {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.index-stat-label {
    font-size: 1.1rem;
    font-weight: 500;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

/* ===================================
   CARDS EDUCACIONAIS - FORMATAÇÃO CORRETA (PRESSÃO ARTERIAL)
   ================================== */

/* Cards dinâmicos específicos para ADS */
.calc-explanation,
.explanation {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid var(--secondary);
    border-radius: 15px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.8s ease;
}

.calc-explanation h3,
.explanation h3 {
    color: var(--primary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 3px solid var(--light);
    padding-bottom: 0.8rem;
    font-size: 1.5rem;
}

.calc-explanation h4,
.explanation h4 {
    color: var(--secondary);
    margin: 1.5rem 0 1rem 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.calc-explanation p,
.explanation p {
    color: #4a5568;
    line-height: 1.6;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.calc-legal,
.legal-explanation {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.03) 0%, rgba(255, 255, 255, 0.95) 100%);
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 15px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.8s ease;
}

.calc-legal h3,
.legal-explanation h3 {
    color: var(--secondary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 3px solid rgba(118, 75, 162, 0.1);
    padding-bottom: 0.8rem;
    font-size: 1.5rem;
}

.calc-legal h4,
.legal-explanation h4 {
    color: var(--primary);
    margin: 1.5rem 0 1rem 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.calc-legal p,
.legal-explanation p {
    color: #4a5568;
    line-height: 1.6;
    margin-bottom: 1rem;
    font-size: 1rem;
}

/* DADOS FORNECIDOS - DENTRO DO CARD EXPLANATION */
.dados-fornecidos {
    background: linear-gradient(135deg, var(--light), rgba(102, 126, 234, 0.08));
    border-radius: 12px;
    padding: 1.8rem;
    margin: 1.5rem 0;
    border: 2px solid rgba(102, 126, 234, 0.15);
    border-left: 5px solid var(--primary);
    box-shadow: inset 0 2px 8px rgba(102, 126, 234, 0.05);
}

.dados-fornecidos p {
    margin: 0.8rem 0;
    color: var(--primary);
    font-weight: 600;
    font-size: 1.05rem;
    padding: 0.3rem 0;
    border-bottom: 1px dotted rgba(102, 126, 234, 0.2);
    display: block;
}

.dados-fornecidos p:last-child {
    border-bottom: none;
}

.dados-fornecidos strong {
    color: var(--secondary);
    font-weight: 700;
}

/* Referenciar classes do base.css para formatação correta */
.index-educational-content .content-block {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 2.5rem 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
}

.index-educational-content .content-block h2 {
    color: #2c3e50;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid var(--primary);
    display: inline-block;
}

.index-educational-content .examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.index-educational-content .example-item {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.index-educational-content .example-item:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
}

.index-educational-content .example-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.index-educational-content .example-item h4 {
    color: #2c3e50;
    margin-bottom: 0.8rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.index-educational-content .example-item p {
    color: #6c757d;
    margin: 0;
    font-size: 1rem;
    line-height: 1.5;
}

.index-educational-content .steps-list {
    display: grid;
    gap: 1.5rem;
    margin-top: 2rem;
}

.index-educational-content .step-item {
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.index-educational-content .step-item:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.1);
}

.index-educational-content .step-item h4 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.index-educational-content .step-item p {
    color: #5a6c7d;
    margin: 0;
    line-height: 1.6;
}

.index-educational-content .applications-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.index-educational-content .application-item {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.index-educational-content .application-item:hover {
    border-color: var(--secondary);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(118, 75, 162, 0.15);
}

.index-educational-content .application-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
}

.index-educational-content .application-item h4 {
    color: #2c3e50;
    margin-bottom: 0.8rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.index-educational-content .application-item p {
    color: #6c757d;
    margin: 0;
    font-size: 1rem;
    line-height: 1.5;
}

/* ===================================
   RESPONSIVIDADE
   ================================== */

/* Tablet */
@media (max-width: 1024px) {
    .index-container {
        padding: 2rem 1.5rem;
    }
    
    .index-header h1 {
        font-size: 2.5rem;
    }
    
    .index-header p {
        font-size: 1.2rem;
    }
    
    .index-populares-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); /* REDUZIDO */
        gap: 1.2rem; /* REDUZIDO */
    }
    
    .index-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile */
@media (max-width: 768px) {
    .index-container {
        padding: 1.5rem 1rem;
    }
    
    .index-header {
        margin-bottom: 2rem;
    }
    
    .index-header h1 {
        font-size: 2.2rem;
    }
    
    .index-header p {
        font-size: 1.1rem;
    }
    
    .index-populares-section h2 {
        font-size: 1.8rem;
    }
    
    .index-populares-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* OTIMIZADO MOBILE */
        gap: 1rem;
    }
    
    .index-calc-card {
        padding: 1.2rem; /* REDUZIDO para mobile */
        min-height: 180px; /* REDUZIDO para mobile */
    }
    
    .index-card-icon {
        font-size: 2.5rem; /* REDUZIDO */
    }
    
    /* CATEGORIAS SIMPLES MOBILE */
    .index-categorias-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* 2 por linha mobile */
        gap: 1rem;
    }
    
    .index-categorias-grid-extras {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* 2 por linha mobile */
        gap: 1rem;
    }
    
    .index-categoria-card-simples {
        padding: 1.2rem;
        min-height: 160px;
    }
    
    .categoria-card-icon {
        font-size: 2.5rem;
    }
    
    .ver-mais-btn-index {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .index-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .index-stat-item {
        padding: 1.5rem;
    }
    
    .index-stat-number {
        font-size: 2.5rem;
    }
    
    /* Prevenir overflow horizontal */
    .index-calculator-section,
    .index-educational-content {
        overflow-x: hidden;
    }
}

/* Mobile pequeno */
@media (max-width: 480px) {
    .index-populares-grid {
        grid-template-columns: 1fr; /* UMA COLUNA EM MOBILE PEQUENO */
    }
    
    /* CATEGORIAS SIMPLES - MOBILE PEQUENO */
    .index-categorias-grid {
        grid-template-columns: 1fr; /* 1 por linha em mobile muito pequeno */
        gap: 0.8rem;
    }
    
    .index-categorias-grid-extras {
        grid-template-columns: 1fr; /* 1 por linha em mobile muito pequeno */
        gap: 0.8rem;
    }
    
    .index-categoria-card-simples {
        padding: 1rem;
        min-height: 140px;
    }
    
    .categoria-card-icon {
        font-size: 2rem;
    }
    
    .categoria-count {
        font-size: 0.75rem;
        padding: 0.3rem 0.8rem;
    }
    
    .ver-mais-btn-index {
        padding: 0.7rem 1.2rem;
        font-size: 0.85rem;
    }
    
    .index-stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ===================================
   LOADING STATES
   ================================== */
.index-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    color: var(--primary);
    font-size: 1.1rem;
}

.index-loading::before {
    content: '⏳';
    margin-right: 0.5rem;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===================================
   ANIMAÇÕES DE ENTRADA
   ================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.index-calc-card {
    animation: fadeInUp 0.5s ease-out;
}

.index-categoria-block {
    animation: fadeInLeft 0.6s ease-out;
}

.index-stat-item {
    animation: fadeInUp 0.7s ease-out;
}

/* Delays progressivos para efeito cascata */
.index-calc-card:nth-child(1) { animation-delay: 0.1s; }
.index-calc-card:nth-child(2) { animation-delay: 0.2s; }
.index-calc-card:nth-child(3) { animation-delay: 0.3s; }
.index-calc-card:nth-child(4) { animation-delay: 0.4s; }
.index-calc-card:nth-child(5) { animation-delay: 0.5s; }
.index-calc-card:nth-child(6) { animation-delay: 0.6s; }
.index-calc-card:nth-child(7) { animation-delay: 0.7s; }
.index-calc-card:nth-child(8) { animation-delay: 0.8s; }

.index-categoria-block:nth-child(1) { animation-delay: 0.2s; }
.index-categoria-block:nth-child(2) { animation-delay: 0.4s; }
.index-categoria-block:nth-child(3) { animation-delay: 0.6s; }
.index-categoria-block:nth-child(4) { animation-delay: 0.8s; }
.index-categoria-block:nth-child(5) { animation-delay: 1.0s; }
.index-categoria-block:nth-child(6) { animation-delay: 1.2s; }

.index-stat-item:nth-child(1) { animation-delay: 0.3s; }
.index-stat-item:nth-child(2) { animation-delay: 0.5s; }
.index-stat-item:nth-child(3) { animation-delay: 0.7s; }
.index-stat-item:nth-child(4) { animation-delay: 0.9s; }

/* ===================================
   HOVER EFFECTS ESPECIAIS
   ================================== */
.index-calc-card:hover .index-card-icon {
    animation: bounce 0.6s ease;
}

@keyframes bounce {
    0%, 20%, 60%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    80% {
        transform: translateY(-5px);
    }
}

/* ===================================
   OTIMIZAÇÕES PARA PERFORMANCE
   ================================== */
.index-calc-card,
.index-categoria-block {
    will-change: transform;
}

.index-stat-item {
    will-change: transform, box-shadow;
}

/* Reduz complexidade de animações em dispositivos lentos */
@media (prefers-reduced-motion: reduce) {
    .index-calc-card,
    .index-categoria-block,
    .index-stat-item {
        animation: none;
    }
    
    .index-calc-card:hover,
    .index-categoria-block:hover,
    .index-stat-item:hover {
        transform: none;
    }
}