/* ============================================
   MODAL DE CONTACTO
   ============================================ */

/* Contenedor principal del modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

/* Overlay oscuro de fondo */
.modal__overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    cursor: pointer;
}

/* Contenedor del contenido del modal */
.modal__container {
    position: relative;
    background: linear-gradient(135deg,
            rgba(18, 20, 28, 0.98) 0%,
            rgba(28, 31, 43, 0.95) 100%);
    border: 1px solid rgba(255, 215, 0, 0.15);
    border-radius: 1.5rem;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    max-width: 42rem;
    width: 100%;
    max-height: 90vh;
    /* Cambiado a flex column para sticky header/footer */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Importante para bordes redondeados */
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal[aria-hidden="false"] .modal__container {
    transform: scale(1) translateY(0);
}

/* Eliminamos estilos de scroll global del container */

/* Header del modal */
.modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 2rem 2rem 1rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal__title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: #E2E8F0;
    margin: 0;
    line-height: 1.3;
}

/* Botón de cerrar */
.modal__close {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    color: #94A3B8;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal__close:hover {
    background: rgba(255, 215, 0, 0.1);
    border-color: rgba(255, 215, 0, 0.3);
    color: #FFD700;
    transform: rotate(90deg);
}

.modal__close:focus-visible {
    outline: 2px solid #FFD700;
    outline-offset: 2px;
}

/* Body del modal (Scrollable) */
.modal__body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
    /* Ocupa el espacio disponible */

    /* Scrollbar personalizado solo aquí */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 215, 0, 0.3) rgba(255, 255, 255, 0.05);
}

.modal__body::-webkit-scrollbar {
    width: 8px;
}

.modal__body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.modal__body::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.3);
    border-radius: 1rem;
}

.modal__body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 215, 0, 0.5);
}

.modal__description {
    font-family: var(--font-paragraphs);
    font-size: 0.95rem;
    color: #94A3B8;
    margin: 0 0 2rem 0;
    line-height: 1.6;
}

/* Estilos del formulario dentro del modal */
.modal .form {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.modal .form__group {
    flex: 1 1 100%;
}

/* Campos en dos columnas en pantallas mayores */
@media (min-width: 640px) {
    .modal .form__group:not(.form__group--full) {
        flex: 1 1 calc(50% - 0.625rem);
    }
}

.modal .form__label {
    display: block;
    font-family: var(--font-paragraphs);
    font-size: 0.875rem;
    font-weight: 500;
    color: #E2E8F0;
    margin-bottom: 0.5rem;
}

.modal .form__input,
.modal .form__select,
.modal .form__textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    color: #E2E8F0;
    font-family: var(--font-paragraphs);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.modal .form__input:focus,
.modal .form__select:focus,
.modal .form__textarea:focus {
    outline: none;
    border-color: rgba(255, 215, 0, 0.5);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.1);
}

.modal .form__input::placeholder,
.modal .form__textarea::placeholder {
    color: #64748B;
}

.modal .form__textarea {
    resize: vertical;
    min-height: 120px;
}

/* Estado de error en campos */
.modal .form__input.error,
.modal .form__select.error,
.modal .form__textarea.error {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.05);
}

/* Checkbox de privacidad */
.modal .form__checkbox-label {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    font-family: var(--font-paragraphs);
    font-size: 0.875rem;
    color: #94A3B8;
    cursor: pointer;
}

.modal .form__checkbox-label input[type="checkbox"] {
    margin-top: 0.25rem;
    flex-shrink: 0;
}

/* Botón de envío */
.modal .button {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, #FFD700 0%, #FFC700 100%);
    color: #050609;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.modal .button:hover {
    background: linear-gradient(135deg, #FFC700 0%, #FFB700 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 215, 0, 0.4);
}

.modal .button:active {
    transform: translateY(0);
}

.modal .button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Mensajes de estado del formulario */
.modal #form-status {
    margin-top: 1rem;
    padding: 0.875rem 1rem;
    border-radius: 0.5rem;
    font-family: var(--font-paragraphs);
    font-size: 0.875rem;
    text-align: center;
    display: none;
}

.modal #form-status:not(:empty) {
    display: block;
}

.modal .form-status--success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #4ADE80;
}

.modal .form-status--error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #F87171;
}

.modal .form-status--loading {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #60A5FA;
}

/* Footer del modal (Fijo) */
.modal__footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(18, 20, 28, 0.98);
    /* Fondo sólido para cubrir scroll */
    z-index: 10;
}

.modal__footer-text {
    margin-top: 1rem;
    font-family: var(--font-paragraphs);
    font-size: 0.8rem;
    color: #64748B;
    text-align: center;
}

.modal__link {
    color: #FFD700;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.modal__link:hover {
    color: #FFC700;
}

/* Prevenir scroll del body cuando el modal está abierto */
body.modal-open {
    overflow: hidden;
}

/* Responsive */
@media (max-width: 640px) {
    .modal__header {
        padding: 1.5rem 1.5rem 1rem 1.5rem;
    }

    .modal__title {
        font-size: 1.25rem;
    }

    .modal__body {
        padding: 1.5rem;
    }

    .modal .form {
        gap: 1rem;
    }

    .modal__footer {
        padding: 1rem 1.5rem;
    }
}

/* Animaciones adicionales para entrada */
@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalSlideUp {
    from {
        transform: scale(0.9) translateY(20px);
    }

    to {
        transform: scale(1) translateY(0);
    }
}

/* Reducir animaciones si el usuario lo prefiere */
@media (prefers-reduced-motion: reduce) {

    .modal,
    .modal__container,
    .modal__close {
        transition: none;
    }

    .modal__close:hover {
        transform: none;
    }
}