/**
 * Formulario de Aportes PRODECO - Estilos de Frontend
 * Réplica idéntica del diseño de referencia con hojas verdes, campos limpios y modal interactiva.
 */

:root {
    --fa-primary: #164b32;
    --fa-primary-hover: #0f3624;
    --fa-radius: 16px;
    --fa-card-bg: #ffffff;
    --fa-border: #d1d5db;
    --fa-text-main: #111827;
    --fa-text-muted: #4b5563;
}

.fa-wrapper {
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
    position: relative;
}

.fa-wrapper *,
.fa-wrapper *::before,
.fa-wrapper *::after {
    box-sizing: border-box;
}

/* Alineaciones del contenedor */
.fa-align-left { text-align: left; }
.fa-align-center { text-align: center; }
.fa-align-right { text-align: right; }
.fa-align-justify .fa-trigger-btn { width: 100%; justify-content: center; }

/* =========================================================================
   BOTÓN DISPARADOR (TRIGGER)
   ========================================================================= */
.fa-trigger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 13px 26px;
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    background-color: var(--fa-primary);
    border: 2px solid var(--fa-primary);
    border-radius: 9999px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 14px rgba(22, 75, 50, 0.22);
}

.fa-trigger-btn:hover {
    background-color: var(--fa-primary-hover);
    border-color: var(--fa-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(22, 75, 50, 0.32);
}

.fa-trigger-btn:active {
    transform: translateY(0);
}

.fa-btn-style-solid {
    border-radius: 8px;
}

.fa-btn-style-outline {
    background-color: transparent;
    color: var(--fa-primary);
    border-color: var(--fa-primary);
    box-shadow: none;
}

.fa-btn-style-outline:hover {
    background-color: var(--fa-primary);
    color: #ffffff;
}

.fa-btn-icon svg {
    display: block;
}

/* Pastilla de Monto Recaudado junto al botón */
.fa-monto-recaudado-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: #ecfdf5;
    border: 1.5px solid #a7f3d0;
    border-radius: 9999px;
    padding: 8px 16px;
    margin-left: 12px;
    font-size: 14px;
    color: #065f46;
    vertical-align: middle;
}

.fa-monto-pill-icon {
    font-size: 15px;
}

.fa-monto-pill-prefix {
    font-weight: 500;
    color: #047857;
}

.fa-monto-pill-amount {
    font-weight: 800;
    color: #064e3b;
}

/* =========================================================================
   TARJETA DEL FORMULARIO (RÉPLICA DE LA IMAGEN)
   ========================================================================= */
.fa-card {
    background-color: var(--fa-card-bg);
    width: 100%;
    max-width: 480px;
    padding: 32px 30px;
    border-radius: var(--fa-radius, 16px);
    box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.12), 0 4px 12px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    text-align: left;
    margin: 0 auto;
}

/* CABECERA CON HOJAS VERDES */
.fa-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 22px;
}

.fa-header-icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.fa-leaves-svg {
    display: block;
}

.fa-header-content {
    flex-grow: 1;
}

.fa-title {
    margin: 0 0 6px 0;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--fa-text-main);
    letter-spacing: -0.015em;
}

.fa-desc {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.45;
    color: var(--fa-text-muted);
}

/* GRUPOS DE CAMPOS */
.fa-field-group {
    margin-bottom: 15px;
}

.fa-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--fa-text-main);
}

.fa-required {
    color: #dc2626;
    margin-left: 2px;
}

.fa-input,
.fa-textarea {
    width: 100%;
    border: 1px solid var(--fa-border);
    border-radius: 8px;
    padding: 11px 14px;
    font-size: 14px;
    color: var(--fa-text-main);
    background-color: #ffffff;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
}

.fa-input::placeholder,
.fa-textarea::placeholder {
    color: #9ca3af;
    opacity: 1;
}

.fa-input:focus,
.fa-textarea:focus {
    border-color: var(--fa-primary);
    box-shadow: 0 0 0 3px rgba(22, 75, 50, 0.12);
}

.fa-input.has-error,
.fa-textarea.has-error {
    border-color: #dc2626;
    background-color: #fef2f2;
}

.fa-field-error {
    display: none;
    font-size: 12px;
    color: #dc2626;
    margin-top: 4px;
}

.fa-textarea {
    resize: vertical;
    min-height: 90px;
    line-height: 1.45;
}

/* BOTÓN ENVIAR VERDE */
.fa-submit-group {
    margin-top: 20px;
}

.fa-submit-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 24px;
    background-color: var(--fa-primary);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.fa-submit-btn:hover {
    background-color: var(--fa-primary-hover);
}

.fa-submit-arrow {
    display: inline-block;
    font-size: 18px;
    font-weight: 700;
    transition: transform 0.2s ease;
}

.fa-submit-btn:hover .fa-submit-arrow {
    transform: translateX(4px);
}

.fa-submit-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: fa-spin 0.7s infinite linear;
}

.fa-form.is-submitting .fa-submit-spinner {
    display: inline-block;
}

.fa-form.is-submitting .fa-submit-arrow {
    display: none;
}

.fa-form.is-submitting .fa-submit-btn {
    opacity: 0.85;
    pointer-events: none;
}

@keyframes fa-spin {
    to { transform: rotate(360deg); }
}

/* MENSAJES DE RESPUESTA (ÉXITO / ERROR) */
.fa-feedback-msg {
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 13.5px;
    line-height: 1.45;
    margin-bottom: 14px;
}

.fa-feedback-success {
    background-color: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.fa-feedback-error {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

/* =========================================================================
   PANTALLA DE ÉXITO TRAS ENVÍO (REEMPLAZO DEL FORMULARIO)
   ========================================================================= */
.fa-success-view {
    text-align: center;
    padding: 24px 12px 12px 12px;
    animation: fa-fade-scale 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fa-fade-scale {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.fa-success-icon-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 14px;
}

.fa-success-badge-icon svg {
    display: block;
    filter: drop-shadow(0 4px 10px rgba(16, 185, 129, 0.2));
}

.fa-success-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--fa-primary, #164b32);
    margin: 0 0 10px 0;
    line-height: 1.25;
}

.fa-success-message {
    background-color: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    border-radius: 10px;
    padding: 14px 18px;
    font-size: 14px;
    line-height: 1.5;
    margin: 0 auto 22px auto;
    max-width: 420px;
    text-align: center;
}

.fa-success-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 8px;
}

.fa-btn-exit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    background-color: var(--fa-primary, #164b32);
    color: #ffffff;
    border: 2px solid var(--fa-primary, #164b32);
    border-radius: 9999px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 14px rgba(22, 75, 50, 0.22);
}

.fa-btn-exit:hover {
    background-color: var(--fa-primary-hover, #0f3624);
    border-color: var(--fa-primary-hover, #0f3624);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(22, 75, 50, 0.32);
}

.fa-btn-exit:active {
    transform: translateY(0);
}

.fa-btn-exit-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.fa-btn-exit-icon svg {
    display: block;
    transition: transform 0.2s ease;
}

.fa-btn-exit:hover .fa-btn-exit-icon svg {
    transform: translateX(-3px);
}

/* =========================================================================
   COMPORTAMIENTO MODAL
   ========================================================================= */
.fa-modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.fa-modal-container.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.fa-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    cursor: pointer;
}

.fa-modal-container .fa-card {
    transform: scale(0.95) translateY(12px);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 90vh;
    overflow-y: auto;
}

.fa-modal-container.is-open .fa-card {
    transform: scale(1) translateY(0);
}

.fa-modal-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 34px;
    height: 34px;
    background: transparent;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s ease;
    z-index: 10;
}

.fa-modal-close-btn:hover {
    background-color: #f3f4f6;
    color: #111827;
}

/* =========================================================================
   COMPORTAMIENTO INLINE (EN VENTANA / EMBEBIDO)
   ========================================================================= */
.fa-inline-mode .fa-trigger-btn {
    display: none;
}

.fa-inline-mode .fa-modal-container {
    position: static;
    width: 100%;
    height: auto;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    padding: 0;
}

.fa-inline-mode .fa-modal-overlay {
    display: none;
}

.fa-inline-mode .fa-modal-close-btn {
    display: none;
}

.fa-inline-mode .fa-card {
    transform: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
}

/* =========================================================================
   RESPONSIVE DESIGN (DESKTOP, TABLET, MOVIL SEGÚN ELECCIÓN)
   ========================================================================= */
@media (min-width: 1025px) {
    .fa-disp-d-inline.fa-wrapper {
        display: block;
    }
    .fa-disp-d-inline .fa-trigger-btn {
        display: none;
    }
    .fa-disp-d-inline .fa-modal-container {
        position: static;
        width: 100%;
        height: auto;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        padding: 0;
    }
    .fa-disp-d-inline .fa-modal-overlay,
    .fa-disp-d-inline .fa-modal-close-btn {
        display: none;
    }
    .fa-disp-d-inline .fa-card {
        transform: none;
        box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    .fa-disp-t-inline.fa-wrapper {
        display: block;
    }
    .fa-disp-t-inline .fa-trigger-btn {
        display: none;
    }
    .fa-disp-t-inline .fa-modal-container {
        position: static;
        width: 100%;
        height: auto;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        padding: 0;
    }
    .fa-disp-t-inline .fa-modal-overlay,
    .fa-disp-t-inline .fa-modal-close-btn {
        display: none;
    }
    .fa-disp-t-inline .fa-card {
        transform: none;
        box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    }
}

@media (max-width: 767px) {
    .fa-disp-m-inline.fa-wrapper {
        display: block;
    }
    .fa-disp-m-inline .fa-trigger-btn {
        display: none;
    }
    .fa-disp-m-inline .fa-modal-container {
        position: static;
        width: 100%;
        height: auto;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        padding: 0;
    }
    .fa-disp-m-inline .fa-modal-overlay,
    .fa-disp-m-inline .fa-modal-close-btn {
        display: none;
    }
    .fa-disp-m-inline .fa-card {
        transform: none;
        box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    }

    .fa-card {
        padding: 24px 20px;
    }

    .fa-title {
        font-size: 21px;
    }
}

/* =========================================================================
   WIDGET: META & ACUMULADO DE DONACIÓN (PRODECO)
   ========================================================================= */
.fa-meta-acumulado-widget {
    box-sizing: border-box;
    width: 100%;
    position: relative;
    font-family: inherit;
    transition: all 0.25s ease;
}

.fa-meta-acumulado-widget *,
.fa-meta-acumulado-widget *::before,
.fa-meta-acumulado-widget *::after {
    box-sizing: border-box;
}

/* Cabecera: Meta | Acumulado */
.fa-meta-acumulado-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 12px;
}

.fa-meta-block {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
}

.fa-meta-label,
.fa-acumulado-label {
    font-size: 15px;
    font-weight: 600;
    color: #4b5563;
}

.fa-meta-val {
    font-size: 19px;
    font-weight: 800;
    color: #1f2937;
}

.fa-acumulado-label {
    color: #047857;
}

.fa-acumulado-val {
    font-size: 20px;
    font-weight: 800;
    color: #065f46;
}

/* Separador (|) */
.fa-meta-sep {
    font-size: 20px;
    font-weight: 300;
    color: #94a3b8;
    line-height: 1;
    user-select: none;
}

/* Layout: Tarjetas (cards) */
.fa-layout-cards .fa-meta-acumulado-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 12px;
    align-items: center;
}

.fa-layout-cards .fa-meta-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 18px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    text-align: center;
}

.fa-layout-cards .fa-block-acumulado {
    background: #ecfdf5;
    border-color: #a7f3d0;
}

/* Layout: Apilado (stacked) */
.fa-layout-stacked .fa-meta-acumulado-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.fa-layout-stacked .fa-meta-sep {
    display: none;
}

/* Barra de Progreso */
.fa-progress-wrap {
    width: 100%;
    height: 12px;
    background-color: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    position: relative;
    margin: 14px 0 12px 0;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

.fa-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
    border-radius: 999px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

/* Mensaje de Porcentaje */
.fa-porcentaje-mensaje {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14.5px;
    font-weight: 600;
    color: #065f46;
    line-height: 1.4;
    margin-top: 6px;
}

.fa-porcentaje-icon {
    font-size: 16px;
    flex-shrink: 0;
}

/* Estado cuando se alcanza la meta */
.fa-meta-alcanzada .fa-progress-bar {
    background: linear-gradient(90deg, #059669 0%, #164b32 100%);
}

.fa-meta-alcanzada .fa-porcentaje-mensaje {
    color: #164b32;
}

@media (max-width: 640px) {
    .fa-meta-acumulado-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    .fa-meta-sep {
        display: none;
    }
    .fa-layout-cards .fa-meta-acumulado-header {
        grid-template-columns: 1fr;
    }
}
