/**
 * Grup Municipal Carousel Styles
 * Adapted from Elementor carousel structure with GSAP animation support
 * 
 * @package BComu_Transparencia
 * @since 1.0.0
 */

/* Main carousel container */
.bcomu-carousel-regidors {
    width: 100%;
    height: 500px;
    display: flex;
    align-items: center;
    overflow: hidden;
    position: relative;
    background: transparent;
    margin-top: -80px;
    margin-bottom: -30px;
}

/* Carousel container with infinite scroll */
.bcomu-carousel-regidors .carousel-container {
    width: max-content;
    white-space: nowrap;
    display: flex;
    gap: 1vw;
    padding: 0 1vw 0 0;
    user-select: none;
    cursor: grab;
    will-change: transform;
}

.bcomu-carousel-regidors .carousel-container:active {
    cursor: grabbing;
}

/* Individual regidor card */
.bcomu-carousel-regidors .regidor-card {
    width: 350px;
    height: 400px;
    max-width: 350px;
    max-height: 400px;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    will-change: transform;
    flex-shrink: 0;
}

/* Regidor container with background image */
.bcomu-carousel-regidors .regidor-container {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    transition: background-color 0.3s ease;
}

.bcomu-carousel-regidors .regidor-container:hover {
    background-color: rgba(232, 65, 44, 0.9);
    background-blend-mode: overlay;
}

/* Content area */
.bcomu-carousel-regidors .regidor-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    z-index: 2;
}

/* Regidor title styling */
.bcomu-carousel-regidors .regidor-title {
    font-family: "Raveo Display", sans-serif;
    font-size: 35px;
    font-weight: 400;
    line-height: 1;
    letter-spacing: -1px;
    color: white;
    text-align: right;
    margin: 0 0 10px 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.bcomu-carousel-regidors .regidor-title b {
    font-weight: 700;
}

/* Regidor carrec styling - below the title */
.bcomu-carousel-regidors .regidor-carrec {
    font-family: 'Raveo Display', sans-serif;
    font-size: 0.8rem;
    font-weight: 400;
    color: white;
    text-align: right;
    margin: 5px 0 10px 0;
    opacity: 0.9;
    letter-spacing: -0.2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    position: absolute;
    top: 30px;
    right: 0;
}

/* Biography/quote text - Hidden by default, shown on hover */
.bcomu-carousel-regidors .regidor-biografia {
    flex: 1;
    margin: 10px 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: .8rem;
}

.bcomu-carousel-regidors .regidor-container:hover .regidor-biografia {
    opacity: 1;
    visibility: visible;
}

.bcomu-carousel-regidors .regidor-biografia p {
    font-family: "Raveo Display", sans-serif;
    font-size: 19px;
    font-weight: 400;
    line-height: 1.15;
    color: white;
    margin: 0;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    letter-spacing: -0.5px;
}

/* Social media icons */
.bcomu-carousel-regidors .regidor-social {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin: 0;
    z-index: 10;
    position: absolute;
    bottom: 20px;
    right: 20px;
    opacity: 1 !important;
    visibility: visible !important;
}

.bcomu-carousel-regidors .regidor-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.bcomu-carousel-regidors .regidor-social a:hover {
    transform: scale(1.1);
}

.bcomu-carousel-regidors .regidor-social img {
    width: 24px;
    height: 24px;
    filter: brightness(0) invert(1);
    opacity: 1;
    visibility: visible;
    display: block;
}


.bcomu-carousel-regidors .regidor-social i {
    font-size: 20px;
    color: #ce0037;
}

/* More info button */
.bcomu-carousel-regidors .regidor-more-info {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 5;
}

.bcomu-carousel-regidors .regidor-popup-trigger {
    font-family: "Geist Mono", monospace;
    font-size: 15px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: -1px;
    word-spacing: -4px;
    color: white;
    text-decoration: none;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 12px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    text-shadow: none;
}

.bcomu-carousel-regidors .regidor-popup-trigger:hover {
    background: rgba(0, 0, 0, 0.5);
    color: white;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .bcomu-carousel-regidors .regidor-card {
        width: 280px;
        height: 280px;
        max-width: 280px;
        max-height: 280px;
    }

    .bcomu-carousel-regidors .regidor-title {
        font-size: 28px;
    }

    .bcomu-carousel-regidors .regidor-biografia p {
        font-size: 16px;
    }

    .bcomu-carousel-regidors .regidor-container {
        padding: 15px;
    }

    .bcomu-carousel-regidors .regidor-more-info {
        bottom: 15px;
        left: 15px;
    }
    
    .bcomu-carousel-regidors .regidor-social {
        bottom: 15px;
        right: 15px;
    }

    .bcomu-carousel-regidors .regidor-popup-trigger {
        font-size: 13px;
        padding: 6px 10px;
    }
}

@media (max-width: 480px) {
    .bcomu-carousel-regidors .regidor-card {
        width: 350px;
        height: 350px;
        max-width: 350px;
        max-height: 350px;
    }

    .bcomu-carousel-regidors .regidor-title {
        font-size: 24px;
        text-align: left;
    }

    .bcomu-carousel-regidors .regidor-biografia p {
        font-size: 14px;
        line-height: 1.2;
    }

    .bcomu-carousel-regidors .regidor-social {
        justify-content: flex-start;
    }
}

/* Performance optimizations */
.bcomu-carousel-regidors .regidor-card img {
    pointer-events: none;
}

/* Smooth transitions for GSAP animations */
.bcomu-carousel-regidors .regidor-card {
    transform-origin: center center;
}

/* Custom cursor when dragging */
.bcomu-carousel-regidors .carousel-container {
    touch-action: none;
}

/* Hide scrollbars */
.bcomu-carousel-regidors {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.bcomu-carousel-regidors::-webkit-scrollbar {
    display: none;
}

/* Popup Styles */
.regidor-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

/* Only apply dark background for non-fullscreen popups */
.regidor-popup-overlay:not(.regidor-popup-fullscreen-overlay) {
    background: rgba(0, 0, 0, 0.9);
}

.regidor-popup-overlay.regidor-popup-fullscreen-overlay {
    background: none;
}

.regidor-popup-content {
    background: white;
    border-radius: 12px;
    max-width: 95vw;
    max-height: 95vh;
    width: 1200px;
    height: 90vh;
    position: relative;
    overflow: hidden;
    animation: popupFadeIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

/* Fullscreen popup variant */
.regidor-popup-content.regidor-popup-fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.regidor-popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent !important;
    color: #000;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
    opacity: 0.7;
}

.regidor-popup-close:hover {
    background: transparent !important;
    opacity: 1;
}

.regidor-popup-content-container {
    flex: 1;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    background: white;
    border-radius: 0 0 12px 12px;
    padding: 0;
}

/* Fullscreen container */
.regidor-popup-fullscreen .regidor-popup-content-container {
    border-radius: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    overflow: hidden !important;
}

/* Fullscreen overlay adjustments */
.regidor-popup-overlay.regidor-popup-fullscreen-overlay {
    padding: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
}

/* Reset some styles within the popup content */
.regidor-popup-content-container * {
    box-sizing: border-box;
}

.regidor-popup-content-container img {
    max-width: 100%;
    height: auto;
}

/* Ensure Elementor content works well in popup */
.regidor-popup-content-container .elementor-section {
    width: 100% !important;
}

.regidor-popup-content-container .elementor-container {
    max-width: 100% !important;
    margin: 0 !important;
}

/* Fullscreen Elementor content */
.regidor-popup-fullscreen .elementor {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
}

.regidor-popup-fullscreen .elementor .e-con-full {
    background: transparent;
    width: 100%;
    height: auto;
    display: flex;
    align-content: stretch;
}

.regidor-popup-fullscreen .elementor .elementor-element-1e8b72d {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Hide any fixed/sticky elements that might interfere */
.regidor-popup-content-container .elementor-sticky,
.regidor-popup-content-container [data-elementor-device-mode],
.regidor-popup-content-container .elementor-motion-effects-element {
    position: relative !important;
    transform: none !important;
}

.regidor-popup-loading {
    background: white;
    padding: 40px;
    border-radius: 12px;
    font-family: "Raveo Display", sans-serif;
    font-size: 18px;
    color: #333;
}

/* Responsive popup */
@media (max-width: 768px) {
    .regidor-popup-content {
        width: 98vw;
        height: 95vh;
        max-width: 98vw;
        max-height: 95vh;
    }

    .regidor-popup-overlay {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .regidor-popup-overlay {
        padding: 5px;
    }

    .regidor-popup-content {
        width: 99vw;
        height: 98vh;
        max-width: 99vw;
        max-height: 98vh;
        border-radius: 8px;
    }

    .regidor-popup-content-container {
        border-radius: 0 0 8px 8px;
    }

    .regidor-popup-close {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
}