/* ══════════════════════════════════════════════════════════════════
   Aprovainilla – Formulario de Ingreso de Miembros
   Hoja de estilos responsiva
══════════════════════════════════════════════════════════════════ */

/* Variables */
:root {
    --afi-verde:       #2E7D32;
    --afi-verde-claro: #4CAF50;
    --afi-verde-bg:    #E8F5E9;
    --afi-rojo:        #C62828;
    --afi-rojo-bg:     #FFEBEE;
    --afi-azul:        #1565C0;
    --afi-gris:        #546E7A;
    --afi-gris-claro:  #ECEFF1;
    --afi-borde:       #B0BEC5;
    --afi-radio:       6px;
    --afi-sombra:      0 2px 12px rgba(0,0,0,.10);
}

/* Contenedor principal */
.afi-wrapper {
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 15px;
    color: #263238;
    max-width: 900px;
    margin: 24px auto;
    padding: 0 12px;
}

/* Título */
.afi-titulo {
    text-align: center;
    color: var(--afi-verde);
    font-size: 1.5rem;
    margin-bottom: 28px;
    padding-bottom: 12px;
    border-bottom: 3px solid var(--afi-verde-claro);
}

/* ── Alertas ── */
.afi-alert {
    padding: 14px 18px;
    border-radius: var(--afi-radio);
    margin-bottom: 22px;
    font-size: 14px;
    line-height: 1.6;
}
.afi-alert-success {
    background: var(--afi-verde-bg);
    border-left: 5px solid var(--afi-verde);
    color: #1B5E20;
}
.afi-alert-error {
    background: var(--afi-rojo-bg);
    border-left: 5px solid var(--afi-rojo);
    color: var(--afi-rojo);
}
.afi-alert ul {
    margin: 8px 0 0 18px;
    padding: 0;
}

/* ── Fieldsets ── */
.afi-fieldset {
    border: 1px solid var(--afi-borde);
    border-radius: var(--afi-radio);
    padding: 20px 22px;
    margin-bottom: 24px;
    box-shadow: var(--afi-sombra);
    background: #fff;
}
.afi-fieldset legend {
    font-weight: 700;
    font-size: 1rem;
    color: var(--afi-verde);
    padding: 0 10px;
    background: #fff;
    border-radius: 4px;
}

/* ── Grilla de campos ── */
.afi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px 24px;
}
@media (max-width: 640px) {
    .afi-grid {
        grid-template-columns: 1fr;
    }
}
.afi-campo-full {
    grid-column: 1 / -1;
}

/* ── Campos individuales ── */
.afi-campo {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.afi-campo label {
    font-weight: 600;
    font-size: 13.5px;
    color: #37474F;
}
.afi-campo .req {
    color: var(--afi-rojo);
}

/* Inputs, selects, textareas */
.afi-wrapper input[type="text"],
.afi-wrapper input[type="email"],
.afi-wrapper input[type="tel"],
.afi-wrapper input[type="number"],
.afi-wrapper input[type="date"],
.afi-wrapper select,
.afi-wrapper textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--afi-borde);
    border-radius: var(--afi-radio);
    font-size: 14px;
    font-family: inherit;
    color: #263238;
    background: #FAFAFA;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}
.afi-wrapper select {
    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='%23546E7A' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}
.afi-wrapper input:focus,
.afi-wrapper select:focus,
.afi-wrapper textarea:focus {
    outline: none;
    border-color: var(--afi-verde-claro);
    box-shadow: 0 0 0 3px rgba(76,175,80,.18);
    background: #fff;
}
.afi-wrapper textarea {
    resize: vertical;
    min-height: 80px;
}
.afi-wrapper select:disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* Estados de validación */
.afi-wrapper input.afi-valid,
.afi-wrapper select.afi-valid,
.afi-wrapper textarea.afi-valid {
    border-color: var(--afi-verde-claro);
}
.afi-wrapper input.afi-invalid,
.afi-wrapper select.afi-invalid,
.afi-wrapper textarea.afi-invalid {
    border-color: var(--afi-rojo);
    background: #FFF8F8;
}

/* Mensajes de error inline */
.afi-error {
    font-size: 12px;
    color: var(--afi-rojo);
    min-height: 16px;
    line-height: 1.3;
}

/* ── Checkbox de aceptación ── */
.afi-acepto {
    margin: 8px 0 20px;
}
.afi-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
}
.afi-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 2px;
    accent-color: var(--afi-verde);
    cursor: pointer;
}

/* ── Botón de envío ── */
.afi-submit-wrap {
    text-align: center;
    margin-top: 10px;
    padding-bottom: 20px;
}
.afi-btn-submit {
    background: var(--afi-verde);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 14px 44px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: .4px;
    transition: background .2s, transform .1s, box-shadow .2s;
    box-shadow: 0 4px 14px rgba(46,125,50,.30);
}
.afi-btn-submit:hover:not(:disabled) {
    background: #1B5E20;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(46,125,50,.38);
}
.afi-btn-submit:active:not(:disabled) {
    transform: translateY(0);
}
.afi-btn-submit:disabled {
    background: #90A4AE;
    cursor: not-allowed;
    box-shadow: none;
}

/* ── Combo Área + Unidad ── */
.afi-area-wrap {
    display: flex;
    gap: 8px;
}
.afi-area-wrap input[type="number"] {
    flex: 1 1 60%;
}
.afi-area-wrap select {
    flex: 1 1 40%;
}

/* ── Selects geográficos en espera (visualmente atenuados pero se envían al POST) ── */
.afi-exito-wrap {
    text-align: center;
    padding: 40px 20px;
}
.afi-exito-hint {
    margin-top: 18px;
    font-size: 15px;
    color: #555;
    animation: afi-pulso 1.6s ease-in-out infinite;
}
@keyframes afi-pulso {
    0%, 100% { opacity: 1; }
    50%       { opacity: .4; }
}
.afi-btn-continuar {
    display: inline-block;
    margin-top: 10px;
    padding: 14px 32px;
    background: #2e7d32;
    color: #fff !important;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    text-decoration: none;
    transition: background .2s;
}
.afi-btn-continuar:hover {
    background: #1b5e20;
    color: #fff !important;
}

.afi-wrapper select.afi-geo-pending {
    opacity: .55;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Modo oscuro (básico) ── */
@media (prefers-color-scheme: dark) {
    .afi-fieldset { background: #1E272C; border-color: #455A64; }
    .afi-fieldset legend { background: #1E272C; color: #81C784; }
    .afi-wrapper input[type="text"],
    .afi-wrapper input[type="email"],
    .afi-wrapper input[type="tel"],
    .afi-wrapper input[type="number"],
    .afi-wrapper input[type="date"],
    .afi-wrapper select,
    .afi-wrapper textarea {
        background: #263238;
        color: #ECEFF1;
        border-color: #546E7A;
    }
    .afi-wrapper { color: #ECEFF1; }
    .afi-campo label { color: #B0BEC5; }
}
