/* ===== RESET Y ESTILOS BASE ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    font-family: 'Work Sans', sans-serif;
}

/* ===== VARIABLES CSS ===== */
:root {
    --color-azul: #003366;
    --color-turquesa: #00a79d;
    --color-dorado: #f0e68c;
    --color-gris: #f4f4f4;
    --color-blanco: #ffffff;
    --color-negro: #333;
    --color-texto: #555;
    --color-turquesa-light: rgba(0, 167, 157, 0.1);
    --color-gris-medio: #e0e0e0;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --transition: all 0.3s ease;
    
    --header-height: 80px;
    --header-height-mobile: 60px;
}

/* ===== HERO SECTION ===== */
.projects-hero {
    padding: clamp(4rem, 7vw, 6rem) 0;
    background: linear-gradient(rgba(0, 51, 102, 0.9), rgba(0, 51, 102, 0.85)), 
                url('../images/graficos/hero.png') center/cover;
    color: var(--color-blanco);
}

.projects-hero-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.tagline {
    font-size: 1.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-turquesa);
    margin-bottom: 1rem;
}

.projects-hero-title {
    font-size: clamp(1.8rem, 5vw, 3rem);
    font-weight: 800;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.projects-hero-subtitle {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    font-weight: 400;
    line-height: 1.6;
    opacity: 0.9;
    margin-bottom: 2rem;
}

/* ===== PROJECTS GRID SECTION ===== */
.projects-grid-section {
    padding: clamp(4rem, 7vw, 6rem) 0;
    background-color: var(--color-gris);
}

.container {
    width: min(90%, 1280px);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.project-card {
    background: var(--color-blanco);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
}

.project-card:hover .project-image img {
    transform: scale(1.05);
}

.project-image {
    height: 200px;
    overflow: hidden;
    position: relative;
}

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

.project-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 51, 102, 0.8) 100%);
    display: flex;
    align-items: flex-end;
    padding: 1.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.project-card:hover .project-overlay {
    opacity: 1;
}

.project-view-text {
    color: var(--color-blanco);
    font-weight: 600;
    font-size: 0.9rem;
}

.project-info {
    padding: 1.5rem;
}

.project-title {
    font-size: 1.25rem;
    color: var(--color-azul);
    margin-bottom: 0.75rem;
    font-weight: 700;
    line-height: 1.3;
}

.project-description {
    color: var(--color-texto);
    font-size: 0.9rem;
    line-height: 1.5;
    opacity: 0.8;
}

/* ===== CARRUSELES SECTION ===== */
.projects-carousels-section {
    padding: 2rem 0;
    background-color: #f8f9fa;
}

.projects-carousels-section .container {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    max-width: 1200px;
}

/* Contenedor de cada carrusel de PowerPoint */
.ppt-carousel-container {
    position: relative;
    width: 100%;
    height: 700px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 2rem;
}

/* Visor de PowerPoint */
.ppt-viewer {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.ppt-slide {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: opacity 0.3s ease;
}

.ppt-slide.loading {
    opacity: 0.7;
}

/* Controles de navegación */
.carousel-control {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 20;
    transition: all 0.3s;
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
}

.carousel-control:hover:not(:disabled) {
    background-color: #0e2e3f;
    color: white;
    transform: translateY(-50%) scale(1.1);
}

.carousel-control:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: translateY(-50%);
}

.carousel-control:disabled:hover {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
}

.carousel-control.prev {
    left: 20px;
}

.carousel-control.next {
    right: 20px;
}

/* Barra de estado */
.carousel-status {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 1rem;
    z-index: 20;
    font-weight: 500;
}

/* Indicadores de diapositivas */
.carousel-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 20;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 15px;
    border-radius: 30px;
    max-width: 90%;
    overflow-x: auto;
    scrollbar-width: none;
}

.carousel-indicators::-webkit-scrollbar {
    display: none;
}

.carousel-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
}

.carousel-indicator.active {
    background-color: white;
    transform: scale(1.2);
}

.carousel-indicator:hover {
    background-color: rgba(255, 255, 255, 0.8);
    transform: scale(1.1);
}

/* Prevención de selección de texto y descargas */
.ppt-carousel-container {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Efectos de carga */
.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0e2e3f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 15;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Estilos para indicadores con muchas diapositivas */
.carousel-indicators.many-slides {
    max-width: 80%;
    padding: 6px 10px !important;
    gap: 4px !important;
}

.carousel-indicators.many-slides .carousel-indicator {
    width: 6px !important;
    height: 6px !important;
    min-width: 6px;
    min-height: 6px;
}

.carousel-indicators.medium-slides {
    max-width: 85%;
    padding: 8px 12px !important;
    gap: 6px !important;
}

.carousel-indicators.medium-slides .carousel-indicator {
    width: 8px !important;
    height: 8px !important;
    min-width: 8px;
    min-height: 8px;
}

/* Indicador "X más" para presentaciones muy largas */
.carousel-more-indicator {
    color: rgba(255, 255, 255, 0.7);
    font-size: 10px;
    margin-left: 8px;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    cursor: help;
    font-weight: bold;
}

/* Efecto hover para indicadores pequeños */
.carousel-indicators.many-slides .carousel-indicator:hover,
.carousel-indicators.medium-slides .carousel-indicator:hover {
    transform: scale(1.3) !important;
}

/* Asegurar que los indicadores activos sean visibles */
.carousel-indicators.many-slides .carousel-indicator.active,
.carousel-indicators.medium-slides .carousel-indicator.active {
    transform: scale(1.4);
    background-color: white;
}

/* Scroll personalizado para contenedores con muchos indicadores */
.carousel-indicators {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.carousel-indicators::-webkit-scrollbar {
    height: 4px;
}

.carousel-indicators::-webkit-scrollbar-track {
    background: transparent;
}

.carousel-indicators::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.carousel-indicators::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

/* ===== MODAL PARA PDF ===== */
.pdf-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    overflow: auto;
}

.pdf-modal-content {
    position: relative;
    background-color: var(--color-blanco);
    margin: 2% auto;
    padding: 0;
    width: 90%;
    max-width: 1000px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: modalFadeIn 0.3s;
    height: 90vh;
    display: flex;
    flex-direction: column;
}

@keyframes modalFadeIn {
    from {opacity: 0; transform: translateY(-50px);}
    to {opacity: 1; transform: translateY(0);}
}

.pdf-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background-color: var(--color-azul);
    color: var(--color-blanco);
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
}

.pdf-modal-title {
    font-weight: 600;
    font-size: 1.2rem;
}

.pdf-modal-close {
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.pdf-modal-close:hover {
    color: var(--color-turquesa);
}

.pdf-modal-body {
    flex: 1;
    padding: 0;
}

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

.pdf-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background-color: var(--color-gris);
    border-bottom-left-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
}

.pdf-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-azul);
    color: var(--color-blanco);
    font-weight: 600;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 0.9rem;
    gap: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.pdf-nav-btn:hover {
    background: #002b55;
}

.pdf-page-info {
    font-size: 0.9rem;
    color: var(--color-texto);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
    .projects-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: var(--header-height-mobile);
    }
    
    nav {
        padding: 0 1rem;
    }
    
    .nav-links {
        display: none;
    }
    
    #mobile-menu-button {
        display: block;
    }
    
    .projects-grid {
        grid-template-columns: repeat(auto-fill, minmax(100%, 1fr));
        gap: 1rem;
    }
    
    .pdf-modal-content {
        width: 95%;
        margin: 5% auto;
        height: 85vh;
    }
    
    .pdf-modal-footer {
        flex-direction: column;
        gap: 1rem;
    }
    
    .ppt-carousel-container {
        height: 500px;
        margin-bottom: 1.5rem;
    }
    
    .carousel-control {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .carousel-status {
        top: 15px;
        font-size: 0.9rem;
        padding: 6px 12px;
    }
    
    .carousel-indicators {
        bottom: 15px;
        padding: 8px 12px;
    }
    
    .projects-carousels-section .container {
        gap: 2rem;
    }
    
    /* Ajustes para móviles en indicadores */
    .carousel-indicators.many-slides {
        max-width: 90%;
        padding: 5px 8px !important;
        gap: 3px !important;
    }
    
    .carousel-indicators.many-slides .carousel-indicator {
        width: 5px !important;
        height: 5px !important;
    }
    
    .carousel-indicators.medium-slides {
        max-width: 90%;
        padding: 6px 10px !important;
        gap: 4px !important;
    }
    
    .carousel-indicators.medium-slides .carousel-indicator {
        width: 6px !important;
        height: 6px !important;
    }
    
    .carousel-more-indicator {
        font-size: 9px;
        margin-left: 6px;
        padding: 1px 4px;
    }
}

@media (max-width: 480px) {
    .projects-hero {
        padding: 3rem 0;
        margin-top: var(--header-height);
    }
    
    .projects-grid-section {
        padding: 3rem 0;
    }
    
    .project-image {
        height: 180px;
    }
    
    .project-info {
        padding: 1rem;
    }
    
    .ppt-carousel-container {
        height: 400px;
    }
    
    .carousel-control {
        width: 35px;
        height: 35px;
    }
    
    .carousel-status {
        font-size: 0.8rem;
        padding: 5px 10px;
    }
    
    .carousel-indicators {
        bottom: 10px;
        padding: 6px 10px;
    }
    
    .carousel-indicator {
        width: 8px;
        height: 8px;
    }
    
    .carousel-indicators.many-slides {
        max-width: 95%;
    }
    
    .carousel-indicators.medium-slides {
        max-width: 95%;
    }
    
    .carousel-more-indicator {
        font-size: 8px;
    }
}