/* ========== MAIN LAYOUT ========== */
.main-content {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 30px;
    align-items: start;
}

/* ========== SIDEBAR ========== */
.sidebar {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    position: sticky;
    top: 120px;
    max-height: calc(100vh - 140px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 20px 20px 10px 20px;
    background: white;
    border-bottom: 1px solid #efefef;
}

.sidebar-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #262626;
    margin: 0;
}

.tags-list {
    padding: 10px 20px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-footer {
    padding: 15px 20px 20px 20px;
    background: white;
    border-top: 1px solid #efefef;
}

/* ========== TAGS ========== */
.tag-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #f5f5f5;
    border-radius: 8px;
    text-decoration: none;
    color: #262626;
    font-size: 14px;
    transition: all 0.2s;
    word-break: break-word;
    gap: 10px;
}

.tag-item:hover {
    background: #0095f6;
    color: white;
    transform: translateX(3px);
}

.tag-item.active {
    background: #0095f6;
    color: white;
    font-weight: 500;
}

.tag-name {
    font-weight: 500;
    flex: 1;
    white-space: normal;
    line-height: 1.4;
}

.tags-stats {
    color: #8e8e8e;
    font-size: 13px;
    text-align: center;
}

/* ========== GALLERY ========== */
.gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
}

.gallery-item {
    position: relative;
    aspect-ratio: 1;
    cursor: pointer;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    transition: transform 0.2s;
    background-color: #f0f0f0;
}

.gallery-item:hover {
    transform: scale(1.02);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.carousel-slide.video-slide {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
    transform: none !important;
    object-fit: unset !important;
    overflow: hidden;
    margin: 0 !important;
    /* Let the wrapper own the touch gestures for swipe (handleTouch* on the
       wrapper). Without this, iOS Safari intercepts horizontal touches for
       page scrolling and the swipe never fires on a video slide. */
    touch-action: pan-y;
}

.carousel-slide.video-slide iframe {
    width: 100% !important;
    height: 100% !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    border: none !important;
    display: block;
    min-width: 0;
    min-height: 0;
}

/* Mobile: video-active carousel stays in normal flow.
   The iframe itself will be positioned via JS (position:fixed) to bypass iOS compositing offset. */
@media (max-width: 1024px) {
    .carousel-container.video-active {
        display: block !important;
    }
}

/* Mobile: full-width modal + iOS video fixes */
@media (max-width: 1024px) {
    .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        height: 100% !important;
        border-radius: 0 !important;
        top: 0;
        left: 0;
        /* Disable animation on mobile — transform in modalFade creates compositing layer that breaks iOS iframes */
        animation: none !important;
    }
    .modal-carousel {
        /* overflow NOT hidden here — must stay visible for image pinch-zoom */
    }
    .carousel-container {
        /* overflow NOT hidden here — must stay visible for image pinch-zoom */
    }
    .carousel-slide.video-slide {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        transform: none !important;
        max-width: none !important;
        max-height: none !important;
        object-fit: unset !important;
    }
    .carousel-slide.video-slide iframe {
        width: 100% !important;
        height: 100% !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        border: none !important;
        margin: 0 !important;
        padding: 0 !important;
        display: block;
        box-sizing: border-box;
    }
}


.video-thumb-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    z-index: 1;
}

.video-thumb-img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    z-index: 0;
}

.video-play-icon {
    position: relative;
    z-index: 2;
    opacity: 0.9;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
}

.video-play-icon svg {
    width: 64px;
    height: 64px;
}

.video-indicator {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.65);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    z-index: 2;
}

/* ========== RESULTS INFO ========== */
.results-info {
    margin-bottom: 20px;
    color: #8e8e8e;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}