/**
 * Enlace — Peticiones de Oración: Estilos Públicos Oficiales.
 *
 * Características:
 * - Aislamiento estricto bajo el namespace .enlace-peticiones-wrapper.
 * - Totalmente responsive (320px hasta 1440px+).
 * - Cumplimiento WCAG 2.1 AA (indicadores de foco de 3px, contraste >= 4.5:1).
 * - Prevención de zoom automático en Safari iOS (font-size: 16px en inputs).
 * - Touch targets cómodos (>= 44px).
 *
 * @package EnlacePeticiones
 */

.enlace-peticiones-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 20px 0;
    padding: 0 16px;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: #2d3748;
    box-sizing: border-box;
}

.enlace-peticiones-wrapper *,
.enlace-peticiones-wrapper input,
.enlace-peticiones-wrapper select,
.enlace-peticiones-wrapper textarea,
.enlace-peticiones-wrapper button,
.enlace-peticiones-wrapper label,
.enlace-peticiones-wrapper optgroup {
    box-sizing: border-box;
    font-family: inherit;
}

/* ==========================================================================
   Accesibilidad: Clases para Lectores de Pantalla (WCAG 2.1 AA)
   ========================================================================== */
.screen-reader-text,
.enlace-sr-status {
    border: 0 !important;
    clip: rect(1px, 1px, 1px, 1px) !important;
    -webkit-clip-path: inset(50%) !important;
    clip-path: inset(50%) !important;
    height: 1px !important;
    margin: -1px !important;
    overflow: hidden !important;
    padding: 0 !important;
    position: absolute !important;
    width: 1px !important;
    word-wrap: normal !important;
}

/* Encabezados y títulos */
.enlace-form-title {
    margin: 0 0 10px 0;
    font-size: 26px;
    font-weight: 700;
    color: #0b63ce;
    text-align: center;
    line-height: 1.3;
}

.enlace-form-subtitle {
    margin: 0 0 28px 0;
    font-size: 15px;
    color: #4a5568;
    text-align: center;
    line-height: 1.5;
}

/* Filas y distribución en rejilla */
.enlace-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-bottom: 18px;
    width: 100%;
}

.enlace-form-group {
    flex: 1 1 calc(50% - 9px);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.enlace-form-group.enlace-full-width {
    flex: 1 1 100%;
}

/* Etiquetas accesibles */
.enlace-label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #1a202c;
    line-height: 1.4;
}

.enlace-label .required {
    color: #e53e3e;
    margin-left: 2px;
}

/* Controles de entrada (Inputs, Selects, Textareas) */
.enlace-input,
.enlace-select,
.enlace-textarea {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    font-family: inherit;
    font-size: 16px; /* Evita zoom automático en Safari iOS */
    line-height: 1.5;
    color: #2d3748;
    background-color: #ffffff;
    border: 1.5px solid #cbd5e0;
    border-radius: 8px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    appearance: none;
    -webkit-appearance: none;
}

.enlace-input::placeholder,
.enlace-textarea::placeholder,
.enlace-combobox-input::placeholder {
    color: #718096;
    font-family: inherit;
    font-size: 15px;
    opacity: 1;
}

.enlace-select {
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%234A5568%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 10px auto;
    padding-right: 36px;
    cursor: pointer;
}

.enlace-textarea {
    min-height: 120px;
    resize: vertical;
}

/* Estados de Foco Accesible (WCAG 2.1 AA) */
.enlace-input:focus,
.enlace-select:focus,
.enlace-textarea:focus,
.enlace-combobox-input:focus {
    outline: none;
    border-color: #0b63ce;
    box-shadow: 0 0 0 3px rgba(11, 99, 206, 0.25);
}

/* Estado Inválido */
.enlace-input.is-invalid,
.enlace-select.is-invalid,
.enlace-textarea.is-invalid,
.enlace-combobox-input.is-invalid {
    border-color: #e53e3e;
    background-color: #fffaf0;
}

.enlace-input.is-invalid:focus,
.enlace-select.is-invalid:focus,
.enlace-textarea.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.2);
}

.enlace-error-msg {
    display: none;
    font-size: 13px;
    color: #e53e3e;
    font-weight: 500;
    margin-top: 5px;
    line-height: 1.3;
}

/* Contador de caracteres */
.enlace-char-counter {
    text-align: right;
    font-size: 13px;
    color: #718096;
    margin-top: 4px;
}

.enlace-char-counter.is-over-limit {
    color: #e53e3e;
    font-weight: 700;
}

/* ==========================================================================
   Selector de Países Buscable (Combobox)
   ========================================================================== */
.enlace-combobox-wrapper {
    position: relative;
    width: 100%;
}

.enlace-combobox-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.enlace-combobox-input {
    padding-right: 40px;
}

.enlace-combobox-toggle {
    position: absolute;
    right: 2px;
    top: 2px;
    bottom: 2px;
    width: 40px;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #4a5568;
    border-radius: 0 6px 6px 0;
}

.enlace-arrow-icon {
    font-size: 14px;
    pointer-events: none;
}

.enlace-combobox-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 250px;
    overflow-y: auto;
    background: #ffffff;
    border: 1.5px solid #0b63ce;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    list-style: none;
    margin: 0;
    padding: 4px 0;
    -webkit-overflow-scrolling: touch;
}

.enlace-combobox-option {
    padding: 11px 16px;
    font-size: 15px;
    color: #2d3748;
    cursor: pointer;
    transition: background-color 0.1s;
    user-select: none;
    line-height: 1.35;
}

.enlace-combobox-option:hover,
.enlace-combobox-option.is-highlighted {
    background-color: #ebf8ff;
    color: #0b63ce;
}

.enlace-combobox-option.is-selected {
    font-weight: 700;
    background-color: #e2e8f0;
}

.enlace-combobox-option.enlace-no-results {
    color: #a0aec0;
    font-style: italic;
    cursor: default;
}

.enlace-hidden-native-select {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ==========================================================================
   Checkbox: Recordar mis datos
   ========================================================================== */
.enlace-remember-row {
    flex-direction: column;
    gap: 6px;
    margin-top: -6px;
    margin-bottom: 22px;
}

.enlace-checkbox-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.enlace-checkbox {
    width: 20px;
    height: 20px;
    margin: 0;
    cursor: pointer;
    accent-color: #0b63ce;
    flex-shrink: 0;
}

.enlace-checkbox-text {
    font-size: 15px;
    color: #2d3748;
    cursor: pointer;
    user-select: none;
    line-height: 1.4;
}

.enlace-privacy-note {
    margin: 6px 0 0 30px;
    font-size: 13px;
    color: #4a5568;
    line-height: 1.45;
}

.enlace-clear-data-wrap {
    margin: 8px 0 0 30px;
}

.enlace-clear-data-btn {
    background: transparent;
    border: none;
    color: #e53e3e;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    padding: 6px 0;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    transition: color 0.15s ease;
}

.enlace-clear-data-btn:hover {
    color: #9b2c2c;
}

.enlace-clear-data-btn:focus-visible {
    outline: 2px solid #e53e3e;
    outline-offset: 3px;
    border-radius: 4px;
}

/* ==========================================================================
   Botón Principal y Estados de Envío
   ========================================================================== */
.enlace-submit-row {
    justify-content: center;
    margin-top: 10px;
}

.enlace-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 52px;
    padding: 14px 44px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    background-color: #0b63ce;
    border: 2px solid #0b63ce;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.enlace-btn-primary:hover:not(:disabled) {
    background-color: #084c9e;
    border-color: #084c9e;
    box-shadow: 0 4px 12px rgba(11, 99, 206, 0.35);
}

.enlace-btn-primary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(11, 99, 206, 0.4);
}

.enlace-btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-spinner {
    display: inline-block;
    animation: enlace-spin 1s linear infinite;
    font-size: 18px;
}

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

/* ==========================================================================
   Alertas Globales
   ========================================================================== */
.enlace-peticiones-alert {
    padding: 14px 18px;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.45;
    margin-bottom: 22px;
}

.enlace-alert-error {
    background-color: #fff5f5;
    color: #c53030;
    border: 1.5px solid #feb2b2;
}

.enlace-alert-warning {
    background-color: #fffaf0;
    color: #c05621;
    border: 1.5px solid #fbd38d;
}

.enlace-alert-info {
    background-color: #ebf8ff;
    color: #2b6cb0;
    border: 1.5px solid #bee3f8;
}

/* ==========================================================================
   Tarjeta de Éxito y Respuesta Pastoral
   ========================================================================== */
.enlace-success-card {
    text-align: center;
    padding: 36px 20px;
    border-radius: 12px;
    background: #f7fafc;
    border: 1.5px solid #e2e8f0;
}

.enlace-success-icon-wrap {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px auto;
    border-radius: 50%;
    background-color: #e6fffa;
    border: 2px solid #38b2ac;
    display: flex;
    align-items: center;
    justify-content: center;
}

.enlace-check-icon {
    color: #2c7a7b;
    font-size: 32px;
    font-weight: 700;
}

.enlace-success-title {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 700;
    color: #1a202c;
}

.enlace-success-subtitle {
    margin: 0 0 24px 0;
    font-size: 15px;
    color: #4a5568;
}

.enlace-pastoral-box {
    max-width: 620px;
    margin: 0 auto 30px auto;
    padding: 24px;
    background-color: #ffffff;
    border: 1.5px solid #bee3f8;
    border-left: 6px solid #0b63ce;
    border-radius: 8px;
    text-align: left;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.enlace-pastoral-text {
    font-size: 16px;
    line-height: 1.6;
    color: #2d3748;
    margin: 0 0 16px 0;
}

.enlace-pastoral-verse {
    font-size: 14px;
    font-style: italic;
    color: #4a5568;
    border: none;
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

.enlace-consecutive-actions {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
}

.enlace-consecutive-prompt {
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 16px;
}

.enlace-consecutive-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.enlace-btn-secondary {
    background-color: #0b63ce;
    font-family: inherit;
    font-size: 15px;
    padding: 12px 28px;
}

.enlace-btn-text {
    background: transparent;
    border: none;
    color: #718096;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    padding: 12px 20px;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.15s;
}

.enlace-btn-text:hover {
    color: #2d3748;
}

.enlace-consecutive-finished {
    font-size: 17px;
    font-weight: 600;
    color: #2c7a7b;
    margin: 16px 0 0 0;
}

.enlace-finish-box {
    margin-top: 20px;
    padding: 18px 24px;
    background-color: #f0fff4;
    border: 1.5px solid #9ae6b4;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.enlace-finish-text {
    margin: 0;
    color: #22543d;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;
}

/* ==========================================================================
   Responsividad y Adaptación Móvil (Breakpoints 320px - 1440px)
   ========================================================================== */
@media (max-width: 768px) {
    .enlace-peticiones-wrapper {
        padding: 0 16px;
        margin: 16px 0;
        border: none;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
    }

    .enlace-form-title {
        font-size: 22px;
    }

    .enlace-form-group {
        flex: 1 1 100%;
    }

    .enlace-btn-primary {
        width: 100%;
        max-width: 380px;
        padding: 14px 20px;
    }

    .enlace-consecutive-buttons {
        flex-direction: column;
        width: 100%;
    }

    .enlace-btn-secondary {
        width: 100%;
    }

    .enlace-privacy-note {
        margin-left: 0;
        margin-top: 4px;
    }
}

@media (max-width: 480px) {
    .enlace-peticiones-wrapper {
        padding: 0 12px;
    }

    .enlace-btn-primary {
        width: 100%;
        max-width: 100%;
    }
}
