/* Estilos para modales personalizados */
:root {
    --modal-bg: rgba(25, 25, 35, 0.95);
    --modal-border: rgba(139, 92, 246, 0.2);
    --modal-shadow: rgba(0, 0, 0, 0.5);
    --accent-color: #8b5cf6;
    --accent-gradient: linear-gradient(90deg, #63e 0%, #8b5cf6 100%);
    --text-color: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --error-color: #ff6b6b;
    --success-color: #20c997;
    --input-bg: rgba(255, 255, 255, 0.05);
    --input-border: rgba(255, 255, 255, 0.1);
    --input-focus-border: rgba(139, 92, 246, 0.5);
}

/* Impedir scroll cuando el modal está abierto */
body.no-scroll {
    overflow: hidden;
}

/* Estilos base del modal - ajustando z-index para asegurar visibilidad */
.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

.custom-modal.active {
    visibility: visible;
    pointer-events: auto;
}

.custom-modal.visible {
    opacity: 1;
}

.custom-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.custom-modal-container {
    position: relative;
    width: 90%;
    max-width: 900px;
    background: var(--modal-bg);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px var(--modal-shadow);
    border: 1px solid var(--modal-border);
    display: flex;
    flex-direction: column;
    transform: translateY(30px) scale(0.95);
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1), 
                opacity 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

.custom-modal.visible .custom-modal-container {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Encabezado del modal */
.custom-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(30, 30, 40, 0.5);
}

.custom-modal-controls {
    display: flex;
    gap: 8px;
}

.modal-control {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.modal-control.red { background-color: #ff5f56; }
.modal-control.yellow { background-color: #ffbd2e; }
.modal-control.green { background-color: #27c93f; }

.custom-modal-container:hover .modal-control {
    transform: scale(1.1);
}

.modal-title {
    color: var(--accent-color);
    font-size: 1.3rem;
    margin: 0;
    font-weight: 600;
    flex-grow: 1;
    text-align: center;
}

.custom-modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.custom-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    transform: rotate(90deg);
}

/* Cuerpo del modal */
.custom-modal-body {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    max-height: 70vh;
}

/* Pie del modal */
.custom-modal-footer {
    padding: 1rem 2rem;
    display: flex;
    justify-content: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(30, 30, 40, 0.3);
}

/* Estilos específicos para el modal del CV */
.pdf-container {
    height: 70vh;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative; /* Para posicionar los controles de zoom */
}

/* Nuevos estilos para el visor de CV con imágenes */
.cv-image-container {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(30, 30, 40, 0.4);
    border: 1px solid rgba(139, 92, 246, 0.15);
    transition: all 0.3s ease;
}

.cv-image-container.zoom-active .cv-pages {
    cursor: grab;
}

.cv-image-container.zoom-active .cv-pages:active {
    cursor: grabbing;
}

/* Controles de zoom - Rediseño mejorado */
.zoom-controls {
    position: static;
    margin-top: 0.8rem; /* Reducido de 1rem a 0.8rem para acercar al visor */
    background: rgba(25, 25, 35, 0.85);
    border-radius: 30px;
    padding: 8px 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 10;
    transition: all 0.3s ease;
    border: 1px solid rgba(139, 92, 246, 0.2);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.zoom-controls:hover {
    background: rgba(30, 30, 40, 0.95);
    border-color: rgba(139, 92, 246, 0.4);
}

.zoom-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.zoom-btn:hover:not(:disabled) {
    background: var(--accent-gradient);
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

.zoom-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.zoom-level {
    color: white;
    font-size: 14px;
    font-family: 'Consolas', monospace;
    min-width: 56px;
    text-align: center;
    font-weight: 500;
}

/* Mejora de la presentación del visor de imágenes */
.cv-pages {
    width: 90%;
    height: calc(100% - 60px); /* Reducir altura para dejar espacio a los controles */
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 0; /* Eliminar margen inferior */
}

/* Modificación del contenedor de navegación para la nueva estructura */
.cv-navigation {
    display: flex;
    flex-direction: column; /* Cambio a columna para separar imagen y controles */
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: relative;
    gap: 0; /* Eliminar gap entre elementos */
}

.cv-navigation-controls {
    width: 100%;
    height: calc(100% - 52px); /* Altura ajustada para dejar espacio exacto para los controles */
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Botones de navegación - Estética mejorada */
.nav-btn {
    position: absolute;
    background: rgba(30, 30, 40, 0.7);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2;
    border: 1px solid rgba(139, 92, 246, 0.2);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.prev-btn {
    left: 20px;
}

.next-btn {
    right: 20px;
}

.nav-btn:hover:not(:disabled) {
    background: var(--accent-gradient);
    transform: scale(1.1);
    border-color: transparent;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(30, 30, 40, 0.4);
}

/* Mejora de la presentación del visor de imágenes */
.cv-pages {
    width: 90%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.cv-page {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    opacity: 0;
    visibility: hidden;
    position: absolute;
    transition: opacity 0.4s ease, visibility 0.4s ease, transform 0.4s ease;
    transform-origin: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.cv-page.active {
    opacity: 1;
    visibility: visible;
}

/* Mejora para la indicación de página */
.page-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-family: 'Consolas', monospace;
    background: rgba(30, 30, 40, 0.7);
    padding: 0.3rem 0.9rem;
    border-radius: 20px;
    margin-right: auto;
    margin-left: 1rem;
    border: 1px solid rgba(139, 92, 246, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#currentPage, #totalPages {
    font-weight: 500;
    color: white;
    margin: 0 2px;
}

#currentPage {
    color: var(--accent-color);
}

.pdf-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Mejora del botón de descarga */
.cv-download-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    background: linear-gradient(145deg, #663399, #8b5cf6);
    color: white;
    text-decoration: none;
    padding: 0.8rem 2rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 4px 20px rgba(102, 51, 238, 0.3);
}

.cv-download-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 51, 238, 0.5);
    color: white;
    background: linear-gradient(145deg, #8b5cf6, #663399);
}


.cv-download-btn i {
    margin-right: 8px;
}

/* Estilos específicos para el modal de contacto */
.contact-modal-container {
    max-width: 700px;
}

.typing-effect {
    color: #6a9955; /* Color verde de comentarios de código */
    font-family: 'Consolas', monospace;
    position: relative;
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    margin-bottom: 1.5rem;
    border-right: 2px solid var(--accent-color);
    animation: typing 4s steps(40) 1s 1 normal both, 
               blink-caret 1s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--accent-color); }
}

/* Formulario personalizado */
.custom-form {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.custom-form-group {
    position: relative;
}

.custom-form-group.full-width {
    grid-column: span 2;
}

.input-wrapper {
    position: relative;
}

.input-wrapper input,
.input-wrapper textarea {
    width: 100%;
    background: var(--input-bg);
    border: none;
    border-bottom: 1px solid var(--input-border);
    color: var(--text-color);
    padding: 1rem 0.5rem 0.5rem;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    border-radius: 4px 4px 0 0;
}

.input-wrapper textarea {
    resize: none;
    min-height: 120px;
}

.input-wrapper label {
    position: absolute;
    left: 0.5rem;
    top: 0.7rem;
    font-size: 1rem;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    pointer-events: none;
}

.input-wrapper.active label {
    top: 0.2rem;
    font-size: 0.7rem;
    color: var(--accent-color);
}

.input-wrapper .line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-gradient);
    transition: width 0.3s ease;
}

.input-wrapper input:focus ~ .line,
.input-wrapper textarea:focus ~ .line,
.input-wrapper.active .line {
    width: 100%;
}

.input-wrapper.error input,
.input-wrapper.error textarea {
    border-bottom-color: var(--error-color);
}

.input-wrapper.error .line {
    background: var(--error-color);
}

.custom-form-group .error-message {
    color: var(--error-color);
    font-size: 0.75rem;
    margin-top: 0.5rem;
    min-height: 18px;
}

/* Botones del formulario */
.form-buttons {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.custom-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-width: 180px;
}

.custom-submit-btn:hover {
    box-shadow: 0 8px 20px rgba(102, 51, 238, 0.3);
    transform: translateY(-3px);
}

.custom-submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: transform 0.6s ease;
    transform: skewX(-15deg);
}

.custom-submit-btn:hover::before {
    transform: translateX(200%) skewX(-15deg);
}

.custom-submit-btn .btn-icon {
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.3s ease;
}

.custom-submit-btn:hover .btn-icon {
    opacity: 1;
    transform: translateX(0);
}

.custom-submit-btn.loading {
    background: linear-gradient(90deg, #63e 0%, #63e 100%);
    pointer-events: none;
}

.custom-submit-btn.loading .btn-icon {
    opacity: 0;
}

/* Mensajes de respuesta del formulario */
.form-response {
    margin-top: 2rem;
}

.form-response .success-message,
.form-response .error-message-box {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
}

.form-response .success-message {
    background: rgba(32, 201, 151, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(32, 201, 151, 0.3);
}

.form-response .error-message-box {
    background: rgba(255, 107, 107, 0.1);
    color: var(--error-color);
    border: 1px solid rgba(255, 107, 107, 0.3);
}

.form-response i {
    font-size: 1.2rem;
}

/* Asegurando que los botones sean cliqueables */
#cvBtn, #contactBtn, .custom-modal-close {
    cursor: pointer;
}

/* Adaptaciones móviles */
@media (max-width: 768px) {
    .custom-modal-container {
        width: 95%;
        max-height: 90vh;
    }

    .custom-modal-body {
        padding: 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .custom-form-group.full-width {
        grid-column: span 1;
    }
    
    .typing-effect {
        font-size: 0.9rem;
        white-space: normal;
        border-right: none;
        animation: none;
    }
    
    .custom-modal-header {
        padding: 0.8rem 1rem;
    }
    
    .zoom-controls {
        padding: 6px 12px;
        gap: 8px;
        margin-top: 0.6rem; /* Reducido para móviles */
    }
    
    .zoom-btn {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }
    
    .zoom-level {
        font-size: 12px;
        min-width: 48px;
    }
    
    .nav-btn {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }
    
    .prev-btn {
        left: 10px;
    }
    
    .next-btn {
        right: 10px;
    }
    
    .cv-navigation-controls {
        height: calc(100% - 46px); /* Ajustado para móviles */
    }
}