/**
 * Syngenta - Grade de Alternância
 * Estilos para o efeito de Expanding Cards
 * 
 * @author Anderson Narciso - Baita Site
 * @link https://baitasite.com.br
 */

/* ========================================
   CONTAINER PRINCIPAL
   ======================================== */
.sga-container {
    display: flex;
    width: 100%;
    height: var(--sga-altura, 500px);
    gap: var(--sga-gap, 20px);
    overflow: hidden;
    position: relative;
}

/* ========================================
   CARDS - ESTILO BASE
   ======================================== */
.sga-card {
    position: relative;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    border-radius: 12px;
    cursor: pointer;

    /* Transição suave - O efeito principal! */
    transition: flex 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ========================================
   ESTADOS DE HOVER - A MÁGICA ACONTECE AQUI
   ======================================== */

/* Quando passar o mouse no container, todos os cards encolhem */
.sga-container:hover .sga-card {
    flex: 0.6;
}

/* O card que recebe o hover expande */
.sga-container .sga-card:hover {
    flex: 2;
}

/* ========================================
   ELEMENTOR - Integração
   ======================================== */

/* Faz o conteúdo do Elementor preencher todo o card */
.sga-card>.elementor,
.sga-card>.elementor .elementor-inner,
.sga-card>.elementor .elementor-section-wrap,
.sga-card .elementor-section,
.sga-card .elementor-section .elementor-container,
.sga-card .elementor-section .elementor-column-wrap,
.sga-card .elementor-section .elementor-widget-wrap,
.sga-card .elementor-column {
    height: 100% !important;
    min-height: 100% !important;
}

.sga-card .elementor-section {
    margin: 0 !important;
    padding: 0 !important;
}

.sga-card .elementor-container {
    max-width: 100% !important;
}

/* Garante que o background do Elementor ocupe todo o espaço */
.sga-card .elementor-section::before,
.sga-card .elementor-section>.elementor-background-overlay {
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
}

/* Zoom suave na imagem de fundo do Elementor no hover */
.sga-card:hover .elementor-section::before {
    transform: scale(1.05);
}

.sga-card:hover .elementor-section>.elementor-background-overlay {
    transform: scale(1.05);
}

/* ========================================
   CORREÇÃO DE LAYOUT INTERNO - TOTAL RESET
   ======================================== */

/* Força o container do Elementor a empilhar os widgets verticalmente */
.sga-card .elementor-column-wrap,
.sga-card .elementor-widget-wrap {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-end !important;
    /* Garante que fiquem na parte de baixo */
    height: 100% !important;
    padding: 30px !important;
    /* Espaçamento interno padrão */
}

/* Garante que nenhum widget seja absoluto ou tenha altura forçada */
.sga-card .elementor-widget {
    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    height: auto !important;
    width: 100% !important;
    margin-bottom: 15px !important;
    flex: none !important;
}

/* Aplica a LARGURA FIXA sugerida para o texto descritivo */
.sga-card .elementor-widget-text-editor {
    width: 350px !important;
    max-width: 100% !important;
    margin-bottom: 25px !important;
    display: block !important;
    white-space: normal !important;
    overflow-wrap: break-word !important;
}

/* Botão sem margem inferior pois é o último */
.sga-card .elementor-widget-button {
    margin-bottom: 0 !important;
    width: fit-content !important;
    clear: both !important;
}

/* Reset de containers internos */
.sga-card .elementor-widget-container {
    height: auto !important;
    min-height: unset !important;
}

/* Mobile: garante que o texto não "vaze" se a tela for menor que 350px */
@media screen and (max-width: 480px) {
    .sga-card .elementor-widget-text-editor {
        width: 100% !important;
    }

    .sga-card .elementor-column-wrap,
    .sga-card .elementor-widget-wrap {
        padding: 20px !important;
    }
}

/* ========================================
   RESPONSIVO - TABLET
   ======================================== */
@media screen and (max-width: 1024px) {
    .sga-container {
        height: auto !important;
        min-height: unset !important;
    }

    .sga-card {
        min-height: 400px;
    }
}

/* ========================================
   RESPONSIVO - MOBILE
   ======================================== */
@media screen and (max-width: 768px) {
    .sga-container {
        flex-direction: column;
        height: auto !important;
        min-height: unset !important;
        gap: 15px;
    }

    .sga-card {
        min-height: 280px;
        flex: none !important;
    }

    /* Garante que o texto ocupe a largura total no mobile */
    .sga-card .elementor-widget-text-editor {
        max-width: 100% !important;
    }

    /* No mobile, remove o efeito de expandir/contrair */
    .sga-container:hover .sga-card,
    .sga-container .sga-card:hover {
        flex: none !important;
    }
}

/* ========================================
   ACESSIBILIDADE
   ======================================== */
.sga-card:focus-visible {
    outline: 3px solid #f7c600;
    outline-offset: 3px;
}

/* Reduz movimento para usuários que preferem */
@media (prefers-reduced-motion: reduce) {

    .sga-card,
    .sga-card .elementor-section::before,
    .sga-card .elementor-section>.elementor-background-overlay {
        transition: none !important;
    }
}