:root {
    --header-color: #1a365d;
    --text-color: #333;
    --light-bg: #f8f9fa;
    --border-color: #e1e4e8;
    --accent-color: #2d5aa0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: white;
    color: var(--text-color);
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
    padding-top: 80px; /* ESPACIO PARA HEADER FIJO */
}

/* ===== ENCABEZADO RESPONSIVO ===== */
header {
    background-color: var(--header-color);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    height: auto;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    gap: 0.5rem;
}

/* LOGO MEJORADO - VERSIÓN COMPLETA */
.logo {
    font-size: 1.6rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

/* Versión abreviada para móvil */
.logo-short {
    display: none;
}

/* Botón hamburguesa para móvil */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    padding: 5px;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

/* Navegación desktop */
nav ul {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

nav ul li a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
    padding: 0.5rem 1.2rem;
    border-radius: 4px;
    border: 2px solid transparent;
    white-space: nowrap;
    font-size: 1.1rem;
}

nav ul li a:hover,
nav ul li a.active {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: #a3c2ff;
}

/* Contenido principal */
main {
    min-height: calc(100vh - 300px);
}

/* Secciones */
.section {
    display: none;
    padding: 3rem 0;
    animation: fadeIn 0.5s ease-in;
}

.section.active {
    display: block;
}

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

.section-title {
    text-align: center;
    margin-bottom: 3rem;
    color: var(--header-color);
    position: relative;
    padding-bottom: 0.5rem;
    font-size: 2.5rem;
}

.section-title::after {
    content: '';
    position: absolute;
    width: 100px;
    height: 4px;
    background-color: var(--accent-color);
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

/* Sección Inicio */
.about-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.about-text {
    font-size: 1.15rem;
}

.about-text p {
    margin-bottom: 1.8rem;
    line-height: 1.7;
}

.profile-img {
    width: 100%;
    max-width: 450px;
    border-radius: 10px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    justify-self: center;
    overflow: hidden;
    background-color: #f5f5f5;
    transition: transform 0.3s ease;
}

.profile-img:hover {
    transform: scale(1.02);
}

.profile-img img {
    width: 100%;
    height: auto;
    max-height: 450px;
    object-fit: cover;
    display: block;
    border-radius: 10px;
}

.highlight-box {
    background-color: var(--light-bg);
    border-left: 5px solid var(--accent-color);
    padding: 2rem;
    margin: 2.5rem 0;
    border-radius: 0 10px 10px 0;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

/* Sección Curriculum */
.cv-container {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    padding: 3rem;
    margin-bottom: 3rem;
    border: 1px solid var(--border-color);
}

.personal-info {
    text-align: center;
    margin-bottom: 3rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 2rem;
}

.name {
    font-size: 2.2rem;
    color: var(--header-color);
    margin-bottom: 0.8rem;
}

.contact-info {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2rem;
    margin-top: 1.5rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 1rem;
    padding: 0.5rem 1rem;
    background-color: var(--light-bg);
    border-radius: 6px;
}

.cv-section {
    margin-bottom: 2.5rem;
}

.cv-section h3 {
    color: var(--header-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid var(--border-color);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.cv-item {
    margin-bottom: 2rem;
    padding-left: 1.5rem;
    border-left: 4px solid transparent;
    transition: all 0.3s;
    padding: 1rem 1.5rem;
    border-radius: 8px;
}

.cv-item:hover {
    border-left-color: var(--accent-color);
    background-color: var(--light-bg);
    transform: translateX(10px);
}

.cv-item h4 {
    color: var(--accent-color);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.date {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
    display: inline-block;
    background-color: var(--light-bg);
    padding: 0.3rem 1rem;
    border-radius: 20px;
    font-weight: 500;
}

.skills-list {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.5rem;
}

.skill-tag {
    background-color: var(--light-bg);
    padding: 0.7rem 1.2rem;
    border-radius: 25px;
    font-size: 0.95rem;
    border-left: 4px solid var(--accent-color);
    transition: all 0.3s;
    font-weight: 500;
}

.skill-tag:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Sección Porfolio */
.portfolio-pdf-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2.5rem;
    margin-bottom: 3rem;
}

.portfolio-pdf-item {
    background-color: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    transition: all 0.4s ease;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.portfolio-pdf-item:hover {
    transform: translateY(-15px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.pdf-preview {
    width: 100%;
    height: 220px;
    background: linear-gradient(135deg, #e1e8f7 0%, #f0f3fa 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

.pdf-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.pdf-preview:hover img {
    transform: scale(1.05);
}

.pdf-content {
    padding: 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.pdf-content h3 {
    color: var(--header-color);
    margin-bottom: 1.2rem;
    font-size: 1.5rem;
    line-height: 1.4;
}

.pdf-description {
    margin-bottom: 1.5rem;
    flex: 1;
}

.pdf-description p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.pdf-description ul {
    padding-left: 1.5rem;
    margin: 0.8rem 0;
}

.pdf-description li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.pdf-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-bottom: 1.5rem;
}

.pdf-tag {
    background-color: var(--light-bg);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--accent-color);
    font-weight: 500;
}

/* Botones de acción */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 3rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    background-color: var(--accent-color);
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    min-height: 54px;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 4px 10px rgba(45, 90, 160, 0.2);
}

.btn:hover {
    background-color: #1a365d;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(45, 90, 160, 0.3);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--accent-color);
    color: var(--accent-color);
    box-shadow: none;
}

.btn-outline:hover {
    background-color: var(--accent-color);
    color: white;
    box-shadow: 0 8px 20px rgba(45, 90, 160, 0.3);
}

.btn-pdf {
    background-color: #d32f2f;
    box-shadow: 0 4px 10px rgba(211, 47, 47, 0.2);
}

.btn-pdf:hover {
    background-color: #b71c1c;
    box-shadow: 0 8px 20px rgba(211, 47, 47, 0.3);
}

/* Modal para PDFs */
.portfolio-pdf-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.portfolio-pdf-modal.active {
    display: flex;
}

.portfolio-pdf-modal-content {
    background-color: white;
    width: 95%;
    max-width: 1200px;
    height: 90vh;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.portfolio-pdf-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--light-bg);
}

.portfolio-pdf-modal-header h3 {
    margin: 0;
    color: var(--header-color);
    font-size: 1.4rem;
    flex: 1;
}

.portfolio-pdf-modal-body {
    flex: 1;
    padding: 1rem;
    overflow: hidden;
}

.pdf-iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 4px;
}

.pdf-loading {
    display: none;
    text-align: center;
    padding: 4rem;
}

.pdf-loading.active {
    display: block;
}

/* Footer */
footer {
    background-color: white;
    color: var(--text-color);
    padding: 3rem 0;
    text-align: center;
    margin-top: 4rem;
    border-top: 1px solid var(--border-color);
}

footer h3 {
    color: var(--header-color);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.footer-contact-info {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2rem;
    margin: 2rem 0;
}

.footer-contact-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--text-color);
    font-size: 1.1rem;
    padding: 0.8rem 1.5rem;
    background-color: var(--light-bg);
    border-radius: 8px;
    transition: transform 0.3s;
}

.footer-contact-item:hover {
    transform: translateY(-3px);
}

.footer-contact-item i {
    color: var(--accent-color);
    font-size: 1.2rem;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 2.5rem 0;
}

.social-links a {
    color: var(--accent-color);
    font-size: 2rem;
    transition: all 0.3s;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: var(--light-bg);
}

.social-links a:hover {
    color: white;
    background-color: var(--accent-color);
    transform: translateY(-5px);
}

footer p {
    margin-top: 2rem;
    color: #666;
    font-size: 0.95rem;
}

/* ===== RESPONSIVE PARA MÓVIL ===== */
@media screen and (max-width: 768px) {
    /* Ajustes generales */
    html {
        font-size: 14px;
    }
    
    body {
        padding-top: 60px; /* Menos espacio para header móvil */
    }
    
    .container {
        width: 95%;
        padding: 0 15px;
    }
    
    /* Encabezado móvil */
    header {
        padding: 0.8rem 0;
        height: 60px;
    }
    
    /* Logo en móvil */
    .logo {
        font-size: 1.1rem;
        max-width: 200px;
        font-weight: 600;
    }
    
    /* Mostrar versión abreviada en móvil muy pequeño */
    @media screen and (max-width: 380px) {
        .logo {
            display: none;
        }
        
        .logo-short {
            display: block;
            font-size: 1rem;
            font-weight: 600;
            white-space: nowrap;
            max-width: 150px;
        }
    }
    
    /* Mostrar botón hamburguesa en móvil */
    .menu-toggle {
        display: flex;
        order: 2;
    }
    
    /* Navegación móvil */
    nav {
        position: fixed;
        top: 60px;
        left: 0;
        width: 100%;
        background-color: var(--header-color);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 999;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        height: 0;
        overflow: hidden;
    }
    
    nav.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
        height: auto;
        padding: 1rem 0;
    }
    
    nav ul {
        flex-direction: column;
        width: 100%;
        padding: 0;
        margin: 0;
        gap: 0;
    }
    
    nav ul li {
        width: 100%;
        margin: 0;
    }
    
    nav ul li a {
        display: block;
        padding: 1.2rem 1.5rem;
        text-align: center;
        border-radius: 0;
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        width: 100%;
        font-size: 1.1rem;
    }
    
    nav ul li:last-child a {
        border-bottom: none;
    }
    
    nav ul li a:hover,
    nav ul li a.active {
        background-color: rgba(255, 255, 255, 0.15);
        border-left: 4px solid #a3c2ff;
    }
    
    /* Ajustar contenido principal para header móvil */
    main {
        margin-top: 0;
    }
    
    .section {
        padding: 2rem 0;
    }
    
    .section-title {
        font-size: 1.8rem;
        margin-bottom: 2rem;
    }
    
    .section-title::after {
        width: 80px;
    }
    
    /* Sección Inicio móvil */
    .about-container {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }
    
    .profile-img {
        order: -1;
        max-width: 300px;
        margin: 0 auto;
    }
    
    .about-text {
        font-size: 1.05rem;
    }
    
    .highlight-box {
        margin: 1.5rem 0;
        padding: 1.2rem;
    }
    
    /* Sección Curriculum móvil */
    .cv-container {
        padding: 1.5rem;
    }
    
    .name {
        font-size: 1.8rem;
    }
    
    .contact-info {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .contact-item {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
    
    .cv-section h3 {
        font-size: 1.3rem;
    }
    
    .cv-item {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .cv-item h4 {
        font-size: 1.1rem;
    }
    
    /* Sección Porfolio móvil */
    .portfolio-pdf-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .pdf-preview {
        height: 180px;
    }
    
    .pdf-content h3 {
        font-size: 1.3rem;
    }
    
    .pdf-content {
        padding: 1.5rem;
    }
    
    /* Botones móvil */
    .action-buttons {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        margin-top: 2rem;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
        padding: 1rem 1.5rem;
        font-size: 1rem;
        min-height: 50px;
    }
    
    /* Footer móvil */
    .footer-contact-info {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .footer-contact-item {
        width: 100%;
        max-width: 300px;
        justify-content: center;
        padding: 0.8rem;
    }
    
    .social-links a {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    /* Modal móvil */
    .portfolio-pdf-modal-content {
        width: 98%;
        height: 85vh;
    }
    
    .portfolio-pdf-modal-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1rem;
    }
    
    .portfolio-pdf-modal-header h3 {
        font-size: 1.1rem;
        line-height: 1.4;
    }
    
    .portfolio-pdf-modal-body {
        padding: 0;
    }
}

/* Ajustes para tablets */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .container {
        width: 92%;
    }
    
    .logo {
        max-width: 250px;
        font-size: 1.4rem;
    }
    
    .portfolio-pdf-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .about-container {
        gap: 3rem;
    }
}

/* Mejoras de accesibilidad y touch */
@media (hover: none) {
    .btn:hover {
        transform: none;
    }
    
    .btn-outline:hover {
        background-color: transparent;
        color: var(--accent-color);
    }
    
    .portfolio-pdf-item:hover {
        transform: none;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    }
    
    .cv-item:hover {
        transform: none;
        background-color: transparent;
    }
    
    .skill-tag:hover {
        transform: none;
        box-shadow: none;
    }
}

/* Prevenir zoom en inputs en iOS */
input, select, textarea {
    font-size: 16px !important;
}

/* Mejorar scrolling en iOS */
.section {
    -webkit-overflow-scrolling: touch;
}

/* Clase para mostrar mensajes de error */
.error-message {
    text-align: center;
    padding: 2rem;
    background-color: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: 8px;
    margin: 1rem 0;
    color: #c53030;
}
/* Estilos para botones de descarga - AÑADIR AL FINAL DEL ARCHIVO CSS */

.btn-download {
    background-color: #28a745;
    box-shadow: 0 4px 10px rgba(40, 167, 69, 0.2);
}

.btn-download:hover {
    background-color: #218838;
    box-shadow: 0 8px 20px rgba(40, 167, 69, 0.3);
}

.btn-success {
    background-color: #28a745 !important;
}

.btn-success:hover {
    background-color: #218838 !important;
}

/* Estilos específicos para los botones de acción en la sección CV */
.cv-action-buttons {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 3rem;
    flex-wrap: wrap;
}

@media screen and (max-width: 768px) {
    .cv-action-buttons {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .cv-action-buttons .btn {
        width: 100%;
        max-width: 300px;
    }
}