/* ============================================
   PARTICIPA.HTML - ESTILOS ESPECÍFICOS
   Diseño moderno, interactivo y responsive
   ============================================ */

/* === ANIMACIONES GLOBALES === */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(184, 0, 0, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(184, 0, 0, 0.6);
    }
}

/* === HERO SECTION === */
.hero-participa {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-participa h1 {
    animation: fadeInUp 1s ease-out;
}

.hero-participa p {
    animation: fadeInUp 1s ease-out 0.2s both;
}

/* === SECCIONES === */
.section-participa {
    padding: 4rem 0;
}

@media (min-width: 768px) {
    .section-participa {
        padding: 6rem 0;
    }
}

/* === IGUALAR ALTURA: PROCESO vs PREGUNTAS FRECUENTES === */
@media (min-width: 768px) {
    /* Asegurarnos de apuntar al grid que contiene ambas columnas */
    .container .grid.md\:grid-cols-2, [class*="md:grid-cols-2"] {
        align-items: stretch;
    }

    /* Convertir cada columna en un flex column para que podamos controlar crecimiento interno */
    .container .grid.md\:grid-cols-2 > div, [class*="md:grid-cols-2"] > div {
        display: flex;
        flex-direction: column;
        height: 100%;
    }

    /* Hacer que el bloque principal de pasos (space-y-6) crezca para ocupar el espacio disponible */
    .container .grid.md\:grid-cols-2 > div .space-y-6,
    .container .grid.md\:grid-cols-2 > div .space-y-4,
    [class*="md:grid-cols-2"] > div .space-y-6,
    [class*="md:grid-cols-2"] > div .space-y-4 {
        flex: 1 1 auto;
        min-height: 0; /* permitir que el flex child haga overflow interno si es necesario */
    }

    /* Pinchar el CTA adicional del bloque de proceso al fondo */
    .container .grid.md\:grid-cols-2 > div .mt-8,
    [class*="md:grid-cols-2"] > div .mt-8 {
        margin-top: auto;
    }

    /* Si las FAQs son muy altas, permitir scroll interno dentro de la columna para mantener la altura igual */
    .container .grid.md\:grid-cols-2 > div .space-y-4,
    [class*="md:grid-cols-2"] > div .space-y-4 {
        overflow: auto;
    }
}

/* Target específico: grid de Proceso vs FAQs usando clase añadida en el HTML */
@media (min-width: 768px) {
    .process-faq-grid {
        display: flex;
        gap: 3rem; /* similar to gap-12 */
        align-items: stretch;
    }

    .process-faq-grid > div {
        flex: 1 1 0;
        display: flex;
        flex-direction: column;
        min-height: 0; /* allow children with overflow to behave */
    }

    /* Make the main content area grow so both columns match height */
    .process-faq-grid > div > .mb-8 + .space-y-6,
    .process-faq-grid > div > .mb-8 + .space-y-4 {
        /* the .mb-8 (header) is a sibling before the block; we target the main blocks following header */
        flex: 1 1 auto;
        min-height: 0;
        overflow: auto;
    }

    /* Pin the left CTA at the bottom */
    .process-faq-grid > div .mt-8 {
        margin-top: auto;
    }

    /* Ensure inner FAQ list uses nice scroll if needed */
    .process-faq-grid > div .space-y-4 {
        max-height: 100%;
        overflow: auto;
    }
}

/* === TABS MEJORADOS === */
.tab-button {
    cursor: pointer;
    background: transparent;
    border: none;
    font-size: 1.125rem;
    font-weight: 700;
    padding: 1rem 2rem;
    color: #555555;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    outline: none;
}

.tab-button:hover {
    color: #B80000;
    background: rgba(184, 0, 0, 0.05);
}

.tab-button.active {
    color: #B80000;
}

.tab-button.active::after {
    animation: slideInLeft 0.3s ease-out;
}

/* === FORMULARIOS === */
.form-section {
    margin-bottom: 2rem;
}

.form-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.form-section h3 i {
    color: #B80000;
    font-size: 1.5rem;
}

/* Input Groups con animaciones */
.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #212121;
    margin-bottom: 0.5rem;
}

.input-group label span.required {
    color: #B80000;
    font-weight: 700;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border: 2px solid #E0E0E0;
    border-radius: 0.5rem;
    font-size: 1rem;
    color: #212121;
    background: white;
    transition: all 0.2s ease;
    outline: none;
}

.input-group input:focus,
.input-group select:focus {
    border-color: #B80000;
    box-shadow: 0 0 0 4px rgba(184, 0, 0, 0.1);
}

.input-group input:hover:not(:focus),
.input-group select:hover:not(:focus) {
    border-color: #E53935;
}

.input-group .relative {
    position: relative;
}

.input-group .relative i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #555555;
    pointer-events: none;
    transition: color 0.2s ease;
}

.input-group input:focus ~ i,
.input-group select:focus ~ i {
    color: #B80000;
}

/* Select personalizado */
.input-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23555555' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 12px;
    padding-right: 2.5rem;
}

/* === BOTONES === */
.btn-submit {
    position: relative;
    overflow: hidden;
    z-index: 1;
    cursor: pointer;
    border: none;
    outline: none;
}

.btn-submit:active {
    transform: scale(0.98);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-submit:disabled:hover {
    transform: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Efecto ripple en botones */
.btn-submit::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-submit:hover::after {
    width: 300px;
    height: 300px;
}

/* === BENEFICIOS === */
.benefit-item {
    background: white;
    border: 2px solid #E0E0E0;
    border-radius: 1rem;
    padding: 2rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.benefit-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(184, 0, 0, 0.15);
    border-color: #B80000;
}

.benefit-icon {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    background: rgba(184, 0, 0, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.benefit-item:hover .benefit-icon {
    background: #B80000;
    transform: rotate(360deg) scale(1.1);
}

.benefit-item:hover .benefit-icon i {
    color: white !important;
}

/* === IGUALAR ALTURA DE TARJETAS AFILIADO / PERSONERO === */
/* Hacemos que cada columna sea un contenedor flex y que la tarjeta interna crezca para igualar alturas.
   Además empujamos el botón CTA hacia el fondo usando margin-top: auto. Se aplica en pantallas >=768px. */
@media (min-width: 768px) {
    /* Seleccionador robusto que busca el grid con la clase Tailwind md:grid-cols-2 */
    [class*="md:grid-cols-2"] > .group {
        display: flex;
        align-items: stretch;
    }

    [class*="md:grid-cols-2"] > .group > .relative {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    /* Empujar el botón CTA al fondo para que tarjetas tengan layout consistente */
    [class*="md:grid-cols-2"] > .group > .relative > button {
        margin-top: auto;
    }
}

/* === TESTIMONIOS === */
.testimonial-card {
    background: white;
    border: 2px solid #E0E0E0;
    border-radius: 1rem;
    padding: 2rem;
    transition: all 0.3s ease;
    height: 100%;
}

.testimonial-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    border-color: #B80000;
}

.testimonial-card .stars {
    display: flex;
    gap: 0.25rem;
}

.testimonial-card .stars i {
    color: #B80000;
    animation: pulse 2s ease-in-out infinite;
}

.testimonial-card .stars i:nth-child(2) {
    animation-delay: 0.1s;
}

.testimonial-card .stars i:nth-child(3) {
    animation-delay: 0.2s;
}

.testimonial-card .stars i:nth-child(4) {
    animation-delay: 0.3s;
}

.testimonial-card .stars i:nth-child(5) {
    animation-delay: 0.4s;
}

/* === REQUISITOS === */
.requirement-box {
    background: #f0fdf4;
    border: 2px solid #86efac;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.restriction-box {
    background: #fef2f2;
    border: 2px solid #fca5a5;
    border-radius: 0.75rem;
    padding: 1.5rem;
}

.restriction-box ul {
    list-style: none;
    padding: 0;
}

.restriction-box li {
    padding: 0.5rem 0;
    display: flex;
    align-items: flex-start;
}

.restriction-box li::before {
    content: '✗';
    color: #B80000;
    font-weight: bold;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

/* === MODALES === */
.modal {
    backdrop-filter: blur(5px);
}

.modal-content {
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(50px) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-content button {
    transition: all 0.2s ease;
}

.modal-content button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(184, 0, 0, 0.3);
}

/* === MENSAJES DE ERROR/ÉXITO === */
.message-box {
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    margin-top: 1rem;
    animation: fadeInUp 0.3s ease-out;
}

.message-box.success {
    background: #f0fdf4;
    border: 2px solid #86efac;
    color: #166534;
}

.message-box.error {
    background: #fef2f2;
    border: 2px solid #fca5a5;
    color: #991b1b;
}

/* === LOADING SPINNER === */
.spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* === CTA SECTION === */
.cta-section {
    background: linear-gradient(135deg, #B80000 0%, #440101 100%);
    position: relative;
    overflow: hidden;
}

.cta-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: patternMove 20s linear infinite;
}

@keyframes patternMove {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(50px, 50px);
    }
}

.cta-button {
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.cta-button:hover {
    transform: translateY(-4px) scale(1.05);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .hero-participa {
        min-height: 50vh;
        padding: 3rem 0;
    }
    
    .hero-participa h1 {
        font-size: 2rem;
    }
    
    .hero-participa p {
        font-size: 1.125rem;
    }
    
    .tab-button {
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }
    
    .form-card {
        padding: 1.5rem;
    }
    
    .benefit-item,
    .testimonial-card {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .hero-participa h1 {
        font-size: 1.75rem;
    }
    
    .hero-participa p {
        font-size: 1rem;
    }
    
    .input-group input,
    .input-group select {
        padding: 0.625rem 0.875rem 0.625rem 2.5rem;
        font-size: 0.9375rem;
    }
    
    .btn-submit {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
}

/* === ACCESIBILIDAD === */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* === FOCUS VISIBLE === */
.tab-button:focus-visible,
.input-group input:focus-visible,
.input-group select:focus-visible,
.btn-submit:focus-visible {
    outline: 3px solid #B80000;
    outline-offset: 2px;
}

/* === LOADING STATE === */
.form-loading {
    opacity: 0.6;
    pointer-events: none;
}

.form-loading .btn-submit {
    position: relative;
}

.form-loading .btn-submit::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* === HOVER EFFECTS PARA ICONOS === */
.input-group:hover .relative i {
    transform: translateY(-50%) scale(1.1);
}

/* === SMOOTH SCROLL === */
html {
    scroll-behavior: smooth;
}

/* === VALIDACIÓN DE CAMPOS === */
.input-group input:invalid:not(:focus):not(:placeholder-shown) {
    border-color: #ef4444;
}

.input-group input:valid:not(:focus):not(:placeholder-shown) {
    border-color: #22c55e;
}

.input-group input:invalid:not(:focus):not(:placeholder-shown) ~ .error-message {
    display: block;
    color: #ef4444;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* === TOOLTIPS === */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: #212121;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}
