/**
 * Estilos para el formulario de afiliación
 */

.mairena-formulario-afiliacion {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.mairena-form-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e3f2fd;
}

.mairena-form-header h2 {
    color: #1976d2;
    font-size: 28px;
    font-weight: 600;
    margin: 0 0 10px 0;
}

.mairena-form-header p {
    color: #666;
    font-size: 16px;
    line-height: 1.5;
    margin: 0;
}

.mairena-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.mairena-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .mairena-form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

.mairena-form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.mairena-form-group label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.mairena-form-group input,
.mairena-form-group select,
.mairena-form-group textarea {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: #fff;
}

.mairena-form-group input:focus,
.mairena-form-group select:focus,
.mairena-form-group textarea:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.mairena-form-group input:invalid {
    border-color: #f44336;
}

.mairena-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.mairena-help {
    font-size: 12px;
    color: #666;
    font-style: italic;
}

.mairena-error {
    color: #f44336;
    font-size: 12px;
    font-weight: 500;
    margin-top: 5px;
    display: none;
}

.mairena-error.show {
    display: block;
}

.mairena-checkbox-group {
    margin: 10px 0;
}

.mairena-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.4;
}

.mairena-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.mairena-checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    position: relative;
    flex-shrink: 0;
    transition: all 0.3s ease;
    background: #fff;
}

.mairena-checkbox input[type="checkbox"]:checked + .mairena-checkmark {
    background: #1976d2;
    border-color: #1976d2;
}

.mairena-checkbox input[type="checkbox"]:checked + .mairena-checkmark::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.mairena-checkbox a {
    color: #1976d2;
    text-decoration: none;
}

.mairena-checkbox a:hover {
    text-decoration: underline;
}

/* Consent long text alignment */
.mairena-checkbox-consent {
    align-items: flex-start;
}
.mairena-consent-text {
    display: inline-block;
    margin-left: 8px;
    max-width: 680px;
    line-height: 1.5;
}

/* RGPD details box */
.mairena-checkbox-rgpd {
    align-items: center;
}
.mairena-rgpd-details {
    margin-top: 6px;
}
.mairena-rgpd-details summary {
    cursor: pointer;
    color: #1976d2;
    font-weight: 600;
}
.mairena-rgpd-box {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px 12px;
    margin-top: 8px;
    color: #333;
    font-size: 14px;
    line-height: 1.5;
}

/* Accesibilidad: mostrar foco cuando el checkbox (invisible) recibe foco */
.mairena-checkbox input[type="checkbox"]:focus + .mairena-checkmark {
    outline: 2px solid #1976d2;
    outline-offset: 2px;
}

.mairena-form-actions {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.mairena-info-note {
    background: #fff8e1;
    border: 1px solid #ffe0b2;
    color: #8d6e63;
    padding: 12px 15px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.4;
}

.mairena-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 30px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    min-width: 200px;
    position: relative;
    overflow: hidden;
}

.mairena-btn-primary {
    background: linear-gradient(135deg, #1976d2, #1565c0);
    color: white;
    box-shadow: 0 4px 15px rgba(25, 118, 210, 0.3);
}

.mairena-btn-primary:hover {
    background: linear-gradient(135deg, #1565c0, #0d47a1);
    box-shadow: 0 6px 20px rgba(25, 118, 210, 0.4);
    transform: translateY(-2px);
}

.mairena-btn-primary:active {
    transform: translateY(0);
}

.mairena-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.mairena-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: mairena-spin 1s linear infinite;
}

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

.mairena-form-messages {
    margin-top: 20px;
}

.mairena-success,
.mairena-error {
    padding: 15px 20px;
    border-radius: 6px;
    font-weight: 500;
    text-align: center;
}

.mairena-success {
    background: #e8f5e8;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.mairena-error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

/* Estados de validación */
.mairena-form-group.error input,
.mairena-form-group.error select,
.mairena-form-group.error textarea {
    border-color: #f44336;
    box-shadow: 0 0 0 3px rgba(244, 67, 54, 0.1);
}

.mairena-form-group.success input,
.mairena-form-group.success select,
.mairena-form-group.success textarea {
    border-color: #4caf50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

/* Responsive */
@media (max-width: 480px) {
    .mairena-formulario-afiliacion {
        margin: 10px;
        padding: 15px;
    }
    
    .mairena-form-header h2 {
        font-size: 24px;
    }
    
    .mairena-btn {
        width: 100%;
        min-width: auto;
    }
}

/* Animaciones */
.mairena-formulario-afiliacion {
    animation: mairena-fadeIn 0.5s ease-out;
}

@keyframes mairena-fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mejoras de accesibilidad */
.mairena-form-group input:focus,
.mairena-form-group select:focus,
.mairena-form-group textarea:focus {
    outline: 2px solid #1976d2;
    outline-offset: 2px;
}

.mairena-checkbox:focus-within .mairena-checkmark {
    outline: 2px solid #1976d2;
    outline-offset: 2px;
}

/* Estilos para campos requeridos */
.mairena-form-group label::after {
    content: '';
}

.mairena-form-group label[for]:has(+ input[required])::after,
.mairena-form-group label[for]:has(+ select[required])::after,
.mairena-form-group label[for]:has(+ textarea[required])::after {
    content: ' *';
    color: #f44336;
    font-weight: bold;
}
