/**
 * FUNDIVEL - Estilos Frontend para Formularios de Encuestas
 * Integrado con el tema Fundivel (Montserrat + Open Sans, paleta institucional)
 */

/* === Contenedor principal === */
.fundivel-encuesta-form {
    max-width: 720px;
    margin: 30px auto;
    font-family: 'Open Sans', sans-serif;
}

.fundivel-encuesta-form .encuesta-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(27, 94, 32, 0.1);
}

.fundivel-encuesta-form .encuesta-header h2 {
    font-family: 'Montserrat', sans-serif;
    color: var(--color-primary, #1B5E20);
    font-size: clamp(1.4rem, 3vw, 1.8rem);
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.3;
}

.fundivel-encuesta-form .encuesta-description {
    color: var(--color-text-light, #666);
    font-size: 14px;
    line-height: 1.6;
}

/* === Módulos / Fieldsets === */
.fundivel-modulo {
    background: var(--color-bg-light, #F8F9FA);
    border: 1px solid var(--color-border, #E0E0E0);
    border-radius: var(--radius-lg, 16px);
    padding: 25px;
    margin-bottom: 24px;
}

.fundivel-modulo legend {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 16px;
    color: var(--color-primary, #1B5E20);
    padding: 0 10px;
}

/* === Campos === */
.fundivel-campo {
    margin-bottom: 20px;
}

.fundivel-campo:last-child {
    margin-bottom: 0;
}

.fundivel-campo > label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text, #333);
    margin-bottom: 10px;
    line-height: 1.4;
}

/* === Inputs de texto y select === */
.fundivel-input,
.fundivel-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border, #E0E0E0);
    border-radius: var(--radius, 8px);
    font-size: 14px;
    font-family: 'Open Sans', sans-serif;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.fundivel-input:focus,
.fundivel-select:focus {
    outline: none;
    border-color: var(--color-primary, #1B5E20);
    box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.1);
}

/* === Input con prefijo/sufijo === */
.fundivel-input-group {
    display: flex;
    align-items: center;
    gap: 0;
}

.fundivel-input-group .fundivel-input {
    border-radius: 0;
    flex: 1;
}

.fundivel-input-prefix,
.fundivel-input-suffix {
    padding: 10px 12px;
    background: var(--color-bg-light, #F8F9FA);
    border: 1px solid var(--color-border, #E0E0E0);
    font-size: 13px;
    color: var(--color-text-light, #666);
    white-space: nowrap;
    font-family: 'Open Sans', sans-serif;
}

.fundivel-input-prefix {
    border-radius: var(--radius, 8px) 0 0 var(--radius, 8px);
    border-right: none;
}

.fundivel-input-suffix {
    border-radius: 0 var(--radius, 8px) var(--radius, 8px) 0;
    border-left: none;
}

/* === Campo hint === */
.fundivel-campo-hint {
    font-size: 12px;
    color: var(--color-text-muted, #999);
    margin-top: 4px;
    font-style: italic;
}

/* === Fila de campos (2 columnas) === */
.fundivel-campo-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.fundivel-campo-half {
    flex: 1;
}

/* === Botón geolocalización === */
.fundivel-btn-geolocate {
    background: rgba(27, 94, 32, 0.08);
    border: 1px solid rgba(27, 94, 32, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-family: 'Open Sans', sans-serif;
    color: var(--color-primary, #1B5E20);
    cursor: pointer;
    transition: all 0.3s ease;
}

.fundivel-btn-geolocate:hover {
    background: rgba(27, 94, 32, 0.15);
    border-color: var(--color-primary, #1B5E20);
}

/* === Escala numérica (1-5) === */
.fundivel-escala {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.escala-label-left,
.escala-label-right {
    font-size: 11px;
    color: var(--color-text-muted, #999);
    min-width: 70px;
}

.escala-label-left { text-align: right; }
.escala-label-right { text-align: left; }

.escala-opcion {
    cursor: pointer;
}

.escala-opcion input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.escala-numero {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--color-border, #E0E0E0);
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 16px;
    color: var(--color-text-light, #666);
    transition: all 0.3s ease;
}

.escala-opcion input[type="radio"]:checked + .escala-numero {
    background: var(--color-primary, #1B5E20);
    color: #fff;
    border-color: var(--color-primary, #1B5E20);
    transform: scale(1.1);
}

.escala-opcion input[type="radio"]:focus + .escala-numero {
    box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.3);
}

.escala-opcion:hover .escala-numero {
    border-color: var(--color-primary-light, #2E7D32);
    color: var(--color-primary, #1B5E20);
}

/* === Opciones radio simples === */
.fundivel-opciones {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.fundivel-opciones label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--color-border, #E0E0E0);
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s ease;
}

.fundivel-opciones label:hover {
    border-color: var(--color-primary, #1B5E20);
    background: rgba(27, 94, 32, 0.05);
}

.fundivel-opciones label:has(input:checked) {
    background: var(--color-primary, #1B5E20);
    color: #fff;
    border-color: var(--color-primary, #1B5E20);
}

/* === Opciones verticales === */
.fundivel-opciones-vertical {
    flex-direction: column;
}

.fundivel-opciones-vertical label {
    border-radius: var(--radius, 8px);
}

/* === Checkboxes === */
.fundivel-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.fundivel-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid var(--color-border, #E0E0E0);
    border-radius: var(--radius, 8px);
    cursor: pointer;
    transition: all 0.3s ease;
}

.fundivel-checkbox-item:hover {
    border-color: var(--color-primary, #1B5E20);
    background: rgba(27, 94, 32, 0.05);
}

.fundivel-checkbox-item:has(input:checked) {
    border-color: var(--color-primary, #1B5E20);
    background: rgba(27, 94, 32, 0.08);
}

.fundivel-checkbox-item span {
    font-size: 14px;
}

/* === Escala Likert === */
.fundivel-likert {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.likert-opcion {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border: 1px solid var(--color-border, #E0E0E0);
    border-radius: var(--radius, 8px);
    cursor: pointer;
    transition: all 0.3s ease;
}

.likert-opcion:hover {
    border-color: var(--color-primary, #1B5E20);
    background: rgba(27, 94, 32, 0.03);
}

.likert-opcion:has(input:checked) {
    border-color: var(--color-primary, #1B5E20);
    background: rgba(27, 94, 32, 0.08);
}

.likert-opcion span {
    font-size: 14px;
}

/* === Estrellas === */
.fundivel-estrellas {
    display: flex;
    gap: 4px;
    direction: rtl;
    justify-content: flex-end;
}

.estrella-opcion {
    cursor: pointer;
}

.estrella-opcion input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.estrella {
    font-size: 32px;
    color: var(--color-border, #E0E0E0);
    transition: color 0.2s ease;
}

.estrella-opcion input[type="radio"]:checked ~ .estrella,
.estrella-opcion:hover .estrella,
.estrella-opcion:hover ~ .estrella-opcion .estrella {
    color: var(--color-secondary, #FFC107);
}

.estrella-opcion input[type="radio"]:focus + .estrella {
    text-shadow: 0 0 8px rgba(255, 193, 7, 0.5);
}

/* === Cards de opciones (Due Diligence) === */
.fundivel-opciones-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.fundivel-card-option {
    cursor: pointer;
}

.fundivel-card-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.fundivel-card-option .card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px 15px;
    border: 2px solid var(--color-border, #E0E0E0);
    border-radius: var(--radius-lg, 16px);
    transition: all 0.3s ease;
}

.fundivel-card-option:hover .card-content {
    border-color: var(--color-primary-light, #2E7D32);
    background: rgba(27, 94, 32, 0.03);
}

.fundivel-card-option input:checked + .card-content {
    border-color: var(--color-primary, #1B5E20);
    background: rgba(27, 94, 32, 0.08);
    box-shadow: 0 4px 12px rgba(27, 94, 32, 0.15);
}

.card-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.card-label {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text, #333);
    margin-bottom: 4px;
}

.card-desc {
    font-size: 11px;
    color: var(--color-text-muted, #999);
}

/* === Escala de 10 puntos === */
.fundivel-escala-10 {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.fundivel-escala-10 .escala-opcion .escala-numero {
    width: 34px;
    height: 34px;
    font-size: 13px;
}

/* === NPS (Net Promoter Score) === */
.fundivel-nps {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    margin: 15px 0 10px;
}

.nps-opcion {
    cursor: pointer;
}

.nps-opcion input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.nps-numero {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: var(--radius, 8px);
    border: 2px solid var(--color-border, #E0E0E0);
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 16px;
    transition: all 0.3s ease;
}

.nps-detractor .nps-numero { color: #c62828; }
.nps-pasivo .nps-numero { color: #f57c00; }
.nps-promotor .nps-numero { color: var(--color-primary, #1B5E20); }

.nps-detractor:hover .nps-numero { border-color: #c62828; background: #ffebee; }
.nps-pasivo:hover .nps-numero { border-color: #f57c00; background: #fff3e0; }
.nps-promotor:hover .nps-numero { border-color: var(--color-primary, #1B5E20); background: rgba(27, 94, 32, 0.05); }

.nps-opcion input:checked + .nps-numero {
    transform: scale(1.15);
    color: #fff;
}

.nps-detractor input:checked + .nps-numero { background: #c62828; border-color: #c62828; }
.nps-pasivo input:checked + .nps-numero { background: #f57c00; border-color: #f57c00; }
.nps-promotor input:checked + .nps-numero { background: var(--color-primary, #1B5E20); border-color: var(--color-primary, #1B5E20); }

.nps-opcion input:focus + .nps-numero {
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.fundivel-nps-legend {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    padding: 0 5px;
}

.nps-legend-detractor { color: #c62828; }
.nps-legend-pasivo { color: #f57c00; }
.nps-legend-promotor { color: var(--color-primary, #1B5E20); }

/* === CAPEX Indicator === */
.fundivel-capex-indicator {
    margin-top: 6px;
    font-size: 13px;
    font-weight: 500;
}

/* === Textarea === */
.fundivel-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--color-border, #E0E0E0);
    border-radius: var(--radius, 8px);
    font-size: 14px;
    font-family: 'Open Sans', sans-serif;
    resize: vertical;
    transition: border-color 0.3s ease;
}

.fundivel-textarea:focus {
    outline: none;
    border-color: var(--color-primary, #1B5E20);
    box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.1);
}

/* === Botón Submit === */
.fundivel-form-actions {
    text-align: center;
    margin-top: 30px;
}

.fundivel-btn-submit {
    background: var(--color-primary, #1B5E20);
    color: #fff;
    border: 2px solid var(--color-primary, #1B5E20);
    padding: 0.85rem 2.5rem;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius, 8px);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(27, 94, 32, 0.2);
}

.fundivel-btn-submit:hover {
    background: var(--color-primary-dark, #0D3B12);
    border-color: var(--color-primary-dark, #0D3B12);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(27, 94, 32, 0.3);
}

.fundivel-btn-submit:active {
    transform: translateY(0);
}

.fundivel-btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* === Mensajes === */
.fundivel-form-message {
    margin-top: 15px;
    font-size: 14px;
    padding: 12px 16px;
    border-radius: var(--radius, 8px);
    display: none;
}

.fundivel-form-message.success {
    display: block;
    background: rgba(27, 94, 32, 0.08);
    color: var(--color-primary, #1B5E20);
    border: 1px solid rgba(27, 94, 32, 0.2);
}

.fundivel-form-message.error {
    display: block;
    background: #fbe9e7;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

/* === Error de campo === */
.fundivel-campo.has-error label {
    color: #c62828;
}

.fundivel-campo.has-error .escala-numero {
    border-color: #ef9a9a;
}

/* === Responsive === */
@media (max-width: 768px) {
    .fundivel-encuesta-form {
        margin: 15px;
    }

    .fundivel-modulo {
        padding: 18px;
        border-radius: var(--radius, 8px);
    }

    .fundivel-escala,
    .fundivel-escala-10 {
        justify-content: center;
    }

    .escala-label-left,
    .escala-label-right {
        display: block;
        width: 100%;
        text-align: center;
    }

    .fundivel-opciones {
        flex-direction: column;
    }

    .fundivel-estrellas {
        justify-content: center;
        direction: ltr;
    }

    .fundivel-campo-row {
        flex-direction: column;
        gap: 0;
    }

    .fundivel-nps {
        gap: 4px;
    }

    .nps-numero {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }

    .fundivel-opciones-cards {
        grid-template-columns: 1fr;
    }

    .fundivel-checkboxes {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .fundivel-encuesta-form .encuesta-header h2 {
        font-size: 1.25rem;
    }

    .escala-numero {
        width: 34px;
        height: 34px;
        font-size: 14px;
    }

    .fundivel-btn-submit {
        width: 100%;
        padding: 1rem;
    }
}
