/* ====================================
   ESTILOS MODAL FORMULARIO DE CONTACTO
   ==================================== */

/* Modal overlay - fondo oscuro */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
    backdrop-filter: blur(4px);
    overscroll-behavior: contain;
}

.modal-overlay.show {
    display: flex;
    animation: fadeIn var(--transition-normal);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Modal de contacto específico */
.modal-contacto {
    width: 100%;
    max-width: 500px;
    background: linear-gradient(180deg, #ffffff, #fbfcfe);
    border-radius: 24px;
    box-shadow:
        0 28px 70px rgba(0, 0, 0, 0.24),
        0 10px 24px rgba(0, 0, 0, 0.12);
    animation: slideUp 0.3s ease-out;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid rgba(15, 23, 42, 0.08);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.15rem 1rem 0.95rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 24px 24px 0 0;
    position: relative;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.32rem;
    font-weight: 800;
    flex: 1;
    text-align: center;
}

.modal-contacto-heading {
    flex: 1;
    text-align: center;
    padding-right: 2.5rem;
}

.modal-contacto-kicker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.32rem;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.modal-contacto-sub {
    margin: 0.35rem auto 0;
    max-width: 32ch;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.84rem;
    line-height: 1.35;
}

.modal-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) rotate(90deg);
}

.modal-body {
    padding: 0.85rem 0.95rem 0.95rem;
}

.modal-contacto-trust {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.85rem;
    padding: 0.65rem 0.75rem;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.03), rgba(15, 23, 42, 0.015));
    border: 1px solid rgba(15, 23, 42, 0.06);
    color: var(--text-dark);
    font-size: 0.82rem;
    line-height: 1.4;
}

.modal-contacto-trust-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: rgba(15, 58, 125, 0.08);
    color: var(--primary);
    flex-shrink: 0;
}

.form-group {
    margin-bottom: 0.72rem;
}

.form-group label {
    display: block;
    font-weight: 700;
    margin-bottom: 0.28rem;
    color: var(--primary-dark);
    font-size: 0.88rem;
    line-height: 1.1;
}

.form-group input {
    width: 100%;
    min-height: 44px;
    padding: 0.64rem 0.8rem;
    border: 1.5px solid rgba(15, 23, 42, 0.12) !important;
    border-radius: 14px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all var(--transition-fast);
    box-sizing: border-box;
    text-transform: uppercase;
    background-color: white;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

/* Mejorar input type file */
.input-file {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    left: 0;
    top: 0;
}

/* Área de drag & drop */
.file-upload-area {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-md);
}

.file-upload-content {
    padding: 2.5rem 1.5rem;
    text-align: center;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.08) 0%, rgba(124, 58, 237, 0.03) 100%);
    border: 2px dashed var(--primary);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.file-upload-area:hover .file-upload-content {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.15) 0%, rgba(124, 58, 237, 0.08) 100%);
    border-color: var(--primary-dark);
    box-shadow: inset 0 0 12px rgba(124, 58, 237, 0.15);
    transform: scale(1.02);
}

.file-upload-area.drag-over .file-upload-content {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2) 0%, rgba(124, 58, 237, 0.12) 100%);
    border-color: var(--primary-dark);
    box-shadow: inset 0 0 16px rgba(124, 58, 237, 0.2), 0 0 20px rgba(124, 58, 237, 0.15);
    transform: scale(1.03);
}

.file-upload-icon {
    font-size: 2.5rem;
    color: var(--primary);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-8px);
    }
}

.file-upload-text {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.file-upload-main {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.4;
}

.file-upload-sub {
    display: block;
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
}

/* Estados del input file */
.input-file:focus + .file-upload-content {
    border-color: var(--primary-dark);
    box-shadow: inset 0 0 12px rgba(124, 58, 237, 0.15);
}

.form-group input:not(:placeholder-shown) {
    border-color: var(--primary) !important;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px rgba(15, 58, 125, 0.08);
}

.form-group select {
    width: 100%;
    min-height: 44px;
    padding: 0.64rem 2.2rem 0.64rem 0.8rem;
    border: 1.5px solid rgba(15, 23, 42, 0.12);
    border-radius: 14px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all var(--transition-fast);
    box-sizing: border-box;
    background: linear-gradient(white, white) padding-box,
                url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 14 14'%3E%3Cpath fill='%230F3A7D' d='M7 10L2 5h10z'/%3E%3C/svg%3E") no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    background-repeat: no-repeat;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* Mantener el select con borde consistente - NO usar :valid/:invalid */
/* para evitar colores de validación automática del navegador */

/* Sobrescribir cualquier estilo de validación del navegador */
.form-group select:invalid {
    border-color: var(--border-color) !important;
}

.form-group select:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(15, 58, 125, 0.05);
}

.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(15, 58, 125, 0.08);
    background: linear-gradient(white, white) padding-box,
                url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 14 14'%3E%3Cpath fill='%23082860' d='M7 10L2 5h10z'/%3E%3C/svg%3E") no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    background-repeat: no-repeat;
}

.form-group select option {
    padding: 0.75rem;
    background: white;
    color: var(--text-dark);
    font-weight: 500;
    line-height: 1.6;
    min-height: 2rem;
}

@media (max-width: 768px) {
    .form-group select {
        padding: 0.7rem 2.2rem 0.7rem 0.75rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 640px) {
    .form-group select {
        padding: 0.65rem 2rem 0.65rem 0.7rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .form-group select {
        padding: 0.6rem 2rem 0.6rem 0.65rem;
        font-size: 0.8rem;
    }
}

.form-group input::placeholder {
    color: var(--text-light);
}

.form-error {
    display: block;
    color: var(--danger);
    font-size: 0.78rem;
    margin-top: 0.18rem;
    font-weight: 600;
    min-height: 0.85rem;
}

.modal-footer-contacto {
    display: flex;
    gap: 0.65rem;
    padding: 0.85rem 0.95rem 0.95rem;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    background: linear-gradient(180deg, rgba(248,250,252,0.98), rgba(255,255,255,0.98));
    border-radius: 0 0 24px 24px;
    justify-content: flex-end;
    flex-direction: row;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.modal-footer-contacto .btn {
    flex: 1 1 0;
    min-width: 0;
    width: 0;
    padding: 0.78rem 1rem;
    font-weight: 700;
    font-size: 0.92rem;
    transition: all 0.3s ease;
    border-radius: 14px;
    min-height: 46px;
}

.modal-footer-contacto .btn-outline {
    order: 1;
    background: rgba(15, 23, 42, 0.03);
    color: var(--primary-dark);
    border: 1.5px solid rgba(15, 58, 125, 0.16) !important;
    font-weight: 700;
}

.modal-footer-contacto .btn-outline:hover {
    background: rgba(15, 58, 125, 0.08);
    color: var(--primary-dark);
    box-shadow: 0 6px 14px rgba(15, 58, 125, 0.12);
    transform: translateY(-2px);
}

.modal-footer-contacto .btn-primary,
.modal-footer-contacto .btn-continuar {
    order: 2;
    transition: all var(--transition-normal);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(15, 58, 125, 0.2);
}

#btnCancelarContacto {
    order: 1 !important;
}

#btnContinuarContacto {
    order: 2 !important;
}

.modal-footer-contacto .btn-continuar {
    animation: contactoContinueBuzz 3.2s ease-in-out infinite;
}

.modal-footer-contacto .btn-continuar span[aria-hidden="true"] {
    display: inline-block;
    animation: contactoContinueArrowBuzz 3.2s ease-in-out infinite;
}

.modal-footer-contacto .btn-primary::before,
.modal-footer-contacto .btn-continuar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.modal-footer-contacto .btn-primary:hover,
.modal-footer-contacto .btn-continuar:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 26px rgba(15, 58, 125, 0.28);
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}

.modal-footer-contacto .btn-primary:hover::before,
.modal-footer-contacto .btn-continuar:hover::before {
    left: 100%;
}

.modal-footer-contacto .btn-primary:active,
.modal-footer-contacto .btn-continuar:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25);
}

@keyframes contactoContinueBuzz {
    0%, 70%, 100% {
        box-shadow: 0 10px 20px rgba(15, 58, 125, 0.2);
        transform: translateX(0) scale(1);
    }
    74% {
        transform: translateX(-2px) scale(1.01);
    }
    78% {
        box-shadow: 0 14px 26px rgba(15, 58, 125, 0.26);
        transform: translateX(2px) scale(1.018);
    }
    82% {
        transform: translateX(-2px) scale(1.01);
    }
    86% {
        box-shadow: 0 13px 24px rgba(15, 58, 125, 0.24);
        transform: translateX(2px) scale(1.014);
    }
    90% {
        transform: translateX(0) scale(1);
    }
}

@keyframes contactoContinueArrowBuzz {
    0%, 70%, 100% {
        transform: translateX(0);
        opacity: 0.94;
    }
    78%, 86% {
        transform: translateX(4px);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .modal-contacto {
        max-width: 95vw;
        max-height: 90vh;
    }
    
    .modal-header {
        padding: 1rem 0.9rem 0.85rem;
    }

    .modal-header h2 {
        font-size: 1.15rem;
    }

    .modal-body {
        padding: 0.82rem 0.9rem 0.9rem;
    }

    .form-group {
        margin-bottom: 0.68rem;
    }

    .modal-footer-contacto {
        flex-direction: row;
        gap: 0.6rem;
        padding: 0.8rem 0.9rem 0.9rem;
    }

    .modal-footer-contacto .btn {
        flex: 1;
    }
}

@media (max-width: 640px) {
    .modal-overlay {
        padding: 0.55rem;
    }

    .modal-contacto {
        max-width: 100%;
        max-height: calc(100vh - 1.1rem);
        border-radius: 18px;
        display: flex;
        flex-direction: column;
    }

    .modal-header {
        padding: 0.78rem 0.78rem 0.68rem;
    }

    .modal-header h2 {
        font-size: 0.98rem;
    }

    .modal-contacto-sub {
        font-size: 0.74rem;
        line-height: 1.3;
    }

    .modal-body {
        padding: 0.62rem 0.72rem 0.7rem;
        overflow-y: auto;
        flex: 1 1 auto;
    }

    .form-group {
        margin-bottom: 0.5rem;
    }
    
    .form-group label {
        font-size: 0.8rem;
        margin-bottom: 0.22rem;
    }
    
    .form-group input,
    .form-group textarea {
        min-height: 40px;
        font-size: 0.88rem;
        padding: 0.58rem 0.7rem;
    }

    .modal-footer-contacto {
        position: sticky;
        bottom: 0;
        z-index: 3;
        flex-direction: row;
        gap: 0.55rem;
        padding: 0.64rem 0.72rem 0.72rem;
        margin-top: auto;
        border-radius: 0 0 18px 18px;
        backdrop-filter: blur(8px);
    }

    .modal-footer-contacto .btn {
        flex: 1 1 0;
        width: 0;
        max-width: none;
        padding: 0.68rem 0.85rem;
        font-size: 0.84rem;
        min-height: 42px;
    }

    .modal-contacto-trust {
        gap: 0.55rem;
        margin-bottom: 0.68rem;
        padding: 0.56rem 0.62rem;
        font-size: 0.76rem;
    }

    .modal-contacto-trust-icon {
        width: 28px;
        height: 28px;
    }

    .form-error {
        font-size: 0.72rem;
        min-height: 0.72rem;
        margin-top: 0.12rem;
    }
}

@media (max-width: 480px) {
    .modal-header {
        padding: 0.72rem 0.72rem 0.62rem;
    }

    .modal-header h2 {
        font-size: 0.92rem;
    }

    .modal-contacto-kicker {
        font-size: 0.64rem;
    }
    
    .modal-close {
        font-size: 1.5rem;
        width: 35px;
        height: 35px;
        right: 0.75rem;
    }

    .modal-body {
        padding: 0.58rem 0.66rem 0.64rem;
    }

    .modal-contacto-trust {
        gap: 0.48rem;
        padding: 0.5rem 0.58rem;
        font-size: 0.73rem;
    }

    .form-group {
        margin-bottom: 0.42rem;
    }
    
    .form-group label {
        font-size: 0.76rem;
    }
    
    .form-group input,
    .form-group textarea {
        min-height: 38px;
        font-size: 0.84rem;
        padding: 0.52rem 0.62rem;
    }

    .modal-footer-contacto {
        padding: 0.58rem 0.66rem 0.64rem;
        gap: 0.45rem;
    }

    .modal-footer-contacto .btn {
        padding: 0.62rem 0.72rem;
        font-size: 0.8rem;
        min-height: 40px;
    }
}
