/* Custom tweaks on top of Tailwind */
body {
    font-synthesis: none;
}
:root { font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }

/* FadeIn Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


.fade-section {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-section.visible {
    opacity: 1;
    transform: translateY(0);
}

video {
    pointer-events: none;
}

/* Carousel Asociados */
@keyframes scroll-left {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

.brands_list-wrapper {
    width: 100%;
    overflow: hidden;
}

.brands_list {
    display: flex;
    gap: 1rem;
    animation: scroll-left 50s linear infinite;
    width: max-content;
}

.brands_item-block {
    flex-shrink: 0;
    width: 11rem;
    height: 22rem;
    overflow: visible;
}

.brands_item-logo-wrap {
    position: relative;
    height: 16rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.brands_item-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brands_item-texts {
    padding: 0.75rem 0.25rem;
    min-height: 5rem;
}

.brands_item-name {
    font-weight: 600;
    font-size: 0.875rem;
    margin: 0 0 0.25rem 0;
}

.brands_item-desc {
    font-size: 0.7rem;
    color: #717171;
    margin: 0;
}

.brands_list:hover {
    animation-play-state: paused;
}

/* Carousel Navigation */
.brands_carousel-container {
    position: relative;
    padding: 0 2.5rem;
}

.brands_nav-btn {
    opacity: 0.7;
    transition: opacity 0.3s ease, transform 0.2s ease;
    top: 7rem;
}

.brands_nav-btn:hover {
    opacity: 1;
}

.brands_carousel-container:hover .brands_list {
    animation-play-state: paused;
}

/* Mobile responsive - botones sobre las fotos */
@media (max-width: 768px) {
    .brands_carousel-container {
        padding: 0;
    }
    
    .brands_nav-btn {
        opacity: 0.9;
        width: 2.5rem;
        height: 2.5rem;
        background: rgba(255, 255, 255, 0.95);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
        top: 6rem;
    }
    
    .brands_nav-prev {
        left: 0.5rem !important;
    }
    
    .brands_nav-next {
        right: 0.5rem !important;
    }
    
    .brands_item-block {
        width: 10rem;
        height: 21rem;
        overflow: visible;
    }
    
    .brands_item-logo-wrap {
        height: 15rem;
    }
}


/* Video Player Controls */
.video-container video {
    pointer-events: auto;
}

.control-overlay {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.control-overlay.playing {
    opacity: 0.3;
}

.control-overlay.playing:hover {
    opacity: 1;
}

.video-container:hover .control-overlay.playing {
    opacity: 1;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3.5rem;
    height: 3.5rem;
    background: #3b9eff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(59, 158, 255, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
    z-index: 40;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: #2b8aef;
    box-shadow: 0 6px 25px rgba(59, 158, 255, 0.5);
    transform: translateY(-2px);
}

.back-to-top.visible:hover {
    transform: translateY(-2px);
}

.back-to-top svg {
    width: 1.5rem;
    height: 1.5rem;
    color: white;
    stroke-width: 2.5;
}

@media (max-width: 768px) {
    .back-to-top {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 3rem;
        height: 3rem;
    }

    .back-to-top svg {
        width: 1.25rem;
        height: 1.25rem;
    }
}

/* Organigrama Corporativo */
#organigrama .org-card {
    position: relative;
    z-index: 1;
}

#organigrama .org-name {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#organigrama .org-cargo {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

#organigrama .org-connector-vertical {
    position: relative;
    z-index: 0;
}

/* Responsive ajustes para organigrama */
@media (max-width: 768px) {
    #organigrama .org-level-directores .flex {
        flex-direction: column;
        gap: 1.5rem;
    }

    #organigrama .org-level-especialistas .grid {
        gap: 1rem;
    }
}

/* Custom Scrollbar para modal */
.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Carousel Modal - Aspect ratio fix */
#terminalPortuariaModal #carouselSlide video,
#terminalPortuariaModal #carouselSlide img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#terminalPortuariaModal #carouselSlide {
    position: relative;
}

/* Carousel Video Player - Enable interactions */
#terminalPortuariaModal #carouselSlide video {
    pointer-events: auto;
    cursor: pointer;
}

/* Video progress bar styling */
#progressContainer {
    position: relative;
}

#progressContainer:hover #progressBar {
    height: 0.5rem;
}

#progressContainer:hover {
    height: 0.5rem;
}

/* Volume slider custom styling */
#volumeSlider {
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0.8) var(--volume-percent, 100%), rgba(255,255,255,0.3) var(--volume-percent, 100%), rgba(255,255,255,0.3) 100%);
}

#volumeSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#volumeSlider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#volumeSlider::-moz-range-track {
    background: rgba(255,255,255,0.3);
    height: 4px;
    border-radius: 2px;
}

/* Video controls animation */
#videoControls {
    transition: opacity 0.3s ease;
}

/* Carousel indicators responsive */
#terminalPortuariaModal .carousel-indicator {
    min-width: 0.5rem;
}

@media (min-width: 640px) {
    #terminalPortuariaModal .carousel-indicator {
        min-width: 0.625rem;
    }
}

/* Mobile responsive for video controls */
@media (max-width: 640px) {
    #videoControls {
        padding: 0.75rem;
        padding-top: 2rem;
    }

    #videoControls .flex.items-center.gap-2 button {
        padding: 0.375rem;
    }

    #videoControls .flex.items-center.gap-2 button svg {
        width: 1rem;
        height: 1rem;
    }

    #playPauseBtn svg {
        width: 1.25rem !important;
        height: 1.25rem !important;
    }

    #volumeSlider {
        width: 3rem;
    }

    #currentTime, #duration {
        font-size: 0.7rem;
    }
}

/* ==========================================
   PORTAFOLIO SECTION
   ========================================== */

/* Category Filter Buttons */
.portafolio-filter {
    transition: all 0.2s ease;
}

.portafolio-filter:hover {
    transform: translateY(-1px);
}

.portafolio-filter.active {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Portafolio Card */
.portafolio-card {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Align card contents across grid columns using subgrid */
@media (min-width: 768px) {
    .portafolio-grid {
        grid-auto-rows: auto;
        row-gap: 0 !important;
    }
    .portafolio-card {
        display: grid;
        grid-row: span 4;
        grid-template-rows: subgrid;
        row-gap: 0;
        padding-bottom: 2.5rem;
    }
    .portafolio-card .portafolio-card-header {
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        padding-bottom: 0.5rem;
    }
    .portafolio-card .portafolio-carousel {
        align-self: start;
    }
    .portafolio-card .carousel-dots {
        padding-top: 0.5rem;
    }
    .portafolio-card > p:last-child {
        padding-top: 0.75rem;
    }
}

.portafolio-card.hidden {
    display: none;
}

/* Portafolio Carousel */
.portafolio-carousel {
    position: relative;
}

.portafolio-carousel .carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.portafolio-carousel .carousel-slide.active {
    position: relative;
}

.portafolio-carousel .carousel-slide img,
.portafolio-carousel .carousel-slide video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Carousel Navigation */
.portafolio-carousel .carousel-prev,
.portafolio-carousel .carousel-next {
    z-index: 10;
}

/* Carousel Dots */
.carousel-dots .carousel-dot {
    transition: all 0.2s ease;
}

.carousel-dots .carousel-dot:hover {
    transform: scale(1.2);
}

/* Video Controls in Portafolio */
.portafolio-carousel .video-controls {
    z-index: 5;
}

.portafolio-carousel video {
    pointer-events: auto;
    cursor: pointer;
}

/* Volume slider for portafolio */
.portafolio-carousel .video-volume {
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.3);
}

.portafolio-carousel .video-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
}

.portafolio-carousel .video-volume::-moz-range-thumb {
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Responsive adjustments for portafolio */
@media (max-width: 768px) {
    .portafolio-grid {
        gap: 2rem;
    }

    .portafolio-carousel .video-controls {
        padding: 0.5rem;
    }

    .portafolio-carousel .video-controls .video-volume {
        width: 2.5rem;
    }

    .portafolio-carousel .video-time {
        font-size: 0.65rem;
    }
}


/* ==========================================
   YOUTUBE PLAYER CUSTOMIZATION
   ========================================== */

/* Ocultar logo de YouTube y watermark */
.portafolio-youtube-player iframe,
.proyecto-video-container iframe {
    pointer-events: none;
}

/* Contenedor de YouTube para controles personalizados */
.portafolio-youtube-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
}

.portafolio-youtube-poster {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2;
    cursor: pointer;
}

.portafolio-youtube-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.portafolio-youtube-player iframe {
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: none;
}

.portafolio-play-overlay {
    z-index: 3;
    transition: opacity 0.3s ease;
}

/* Ocultar elementos de branding de YouTube via CSS */
.portafolio-youtube-player .ytp-chrome-top,
.portafolio-youtube-player .ytp-watermark,
.portafolio-youtube-player .ytp-youtube-button,
.portafolio-youtube-player .ytp-title,
.portafolio-youtube-player .ytp-show-cards-title,
.portafolio-youtube-player .ytp-endscreen-content,
.portafolio-youtube-player .ytp-ce-element {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Proyectos section - videos locales */
.proyecto-video-container {
    position: relative;
    overflow: hidden;
}

.proyecto-video-container video {
    pointer-events: auto;
}

.proyecto-play-overlay {
    z-index: 5;
    transition: opacity 0.3s ease;
}

.proyecto-controls {
    z-index: 10;
}

/* Video wrapper en portafolio */
.portafolio-video-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
}

/* Controles de video sobre YouTube */
.portafolio-video-wrapper .video-controls {
    z-index: 10;
    pointer-events: auto;
}


/* Barra de progreso de video en portafolio */
.video-progress-container {
    position: relative;
    cursor: pointer;
}

.video-progress-container:hover .video-progress-bar {
    height: 0.5rem;
}

.video-progress-container:hover {
    height: 0.5rem;
}

.video-progress-bar {
    transition: width 0.1s linear;
}

.video-progress-handle {
    transition: opacity 0.2s ease;
}


/* ==========================================
   FULLSCREEN VIDEO CONTROLS
   ========================================== */

/* Estilos para el botón de salir de fullscreen */
.video-exit-fullscreen {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Mostrar botón de salir cuando está en fullscreen */
.portafolio-video-wrapper:fullscreen .video-exit-fullscreen,
.portafolio-video-wrapper:-webkit-full-screen .video-exit-fullscreen,
.portafolio-video-wrapper:-moz-full-screen .video-exit-fullscreen {
    display: flex !important;
    opacity: 1;
}

/* Controles siempre visibles en fullscreen */
.portafolio-video-wrapper:fullscreen .video-controls,
.portafolio-video-wrapper:-webkit-full-screen .video-controls,
.portafolio-video-wrapper:-moz-full-screen .video-controls {
    opacity: 1 !important;
}

/* Hover en fullscreen para mostrar controles */
.portafolio-video-wrapper:fullscreen:hover .video-controls,
.portafolio-video-wrapper:-webkit-full-screen:hover .video-controls,
.portafolio-video-wrapper:-moz-full-screen:hover .video-controls {
    opacity: 1;
}

/* Estilos para fullscreen en el wrapper */
.portafolio-video-wrapper:fullscreen,
.portafolio-video-wrapper:-webkit-full-screen,
.portafolio-video-wrapper:-moz-full-screen {
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.portafolio-video-wrapper:fullscreen video,
.portafolio-video-wrapper:-webkit-full-screen video,
.portafolio-video-wrapper:-moz-full-screen video {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

/* Clase para controles en modo fullscreen */
.fullscreen-controls {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 100 !important;
}
