/* ══════════════════════════════════════════════════════════
   Inline Photo Slideshow
   Ground rules:
   - Never wider than the card content area
   - Fixed-height stage so images can never push the card taller
   - Image is absolutely positioned & object-fit:cover inside
     the fixed rectangle (like Google image panels)
   - Clicking opens full-size in the lightbox
   ══════════════════════════════════════════════════════════ */

.tkd-photo-gallery {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: hidden !important;
    border-radius: 8px;
    box-sizing: border-box;
}

/* ── Stage: fixed rectangle, never grows ── */
.tkd-gallery-stage {
    position: relative;
    width: 100%;
    height: 340px;
    background: #111;
    border-radius: 8px 8px 0 0;
    overflow: hidden !important;
}

.tkd-gallery-main {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.tkd-gallery-active-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: opacity 0.35s ease;
    user-select: none;
    -webkit-user-drag: none;
}

.tkd-gallery-active-img.fade-out {
    opacity: 0;
}

/* ── Prev / Next arrows ── */
.tkd-gallery-prev,
.tkd-gallery-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    border: none;
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.25s, background 0.25s;
}

.tkd-gallery-stage:hover .tkd-gallery-prev,
.tkd-gallery-stage:hover .tkd-gallery-next {
    opacity: 1;
}

.tkd-gallery-prev:hover,
.tkd-gallery-next:hover {
    background: rgba(0, 0, 0, 0.75);
}

.tkd-gallery-prev { left: 10px; }
.tkd-gallery-next { right: 10px; }

/* ── Thumbnail strip ── */
.tkd-gallery-thumbs {
    display: flex;
    gap: 6px;
    padding: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    max-height: 65px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 0 0 8px 8px;
    scrollbar-width: thin;
    box-sizing: border-box;
}

.tkd-gallery-thumb {
    width: 60px;
    height: 45px;
    min-width: 60px;
    min-height: 45px;
    max-width: 60px;
    max-height: 45px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.5;
    border: 2px solid transparent;
    transition: opacity 0.2s, border-color 0.2s;
    flex-shrink: 0;
    box-sizing: border-box;
}

.tkd-gallery-thumb:hover {
    opacity: 0.8;
}

.tkd-gallery-thumb.active {
    opacity: 1;
    border-color: #2563eb;
}

/* ── Slide counter overlay ── */
.tkd-gallery-counter {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 12px;
    pointer-events: none;
    z-index: 4;
    letter-spacing: 0.5px;
}

/* ── Lightbox Overlay ── */
.tkd-lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.tkd-lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

.tkd-lightbox-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* ── Close button ── */
.tkd-lb-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    z-index: 10;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.tkd-lb-close:hover { opacity: 1; }

/* ── Prev / Next ── */
.tkd-lb-prev,
.tkd-lb-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 42px;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 6px;
    z-index: 10;
    opacity: 0.6;
    transition: opacity 0.2s, background 0.2s;
}

.tkd-lb-prev:hover,
.tkd-lb-next:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

.tkd-lb-prev { left: 12px; }
.tkd-lb-next { right: 12px; }

/* ── Main image ── */
.tkd-lb-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: calc(100vh - 140px);
    width: 100%;
}

.tkd-lb-img {
    max-width: 90%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    user-select: none;
}

/* ── Counter ── */
.tkd-lb-counter {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    margin-top: 12px;
}

/* ── Thumbnails ── */
.tkd-lb-thumbs {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    overflow-x: auto;
    max-width: 90%;
    padding: 4px 0;
}

.tkd-lb-thumb {
    width: 56px;
    height: 42px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.5;
    border: 2px solid transparent;
    transition: opacity 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

.tkd-lb-thumb:hover { opacity: 0.8; }

.tkd-lb-thumb.active {
    opacity: 1;
    border-color: #2563eb;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .tkd-gallery-stage {
        height: 240px;
    }

    .tkd-gallery-prev,
    .tkd-gallery-next {
        width: 34px;
        height: 34px;
        font-size: 20px;
        opacity: 0.7;
    }

    .tkd-gallery-thumb {
        width: 48px;
        height: 36px;
        min-width: 48px;
        min-height: 36px;
        max-width: 48px;
        max-height: 36px;
    }

    .tkd-gallery-thumbs {
        max-height: 56px;
    }

    .tkd-lb-prev,
    .tkd-lb-next {
        font-size: 28px;
        padding: 6px 12px;
    }

    .tkd-lb-prev { left: 4px; }
    .tkd-lb-next { right: 4px; }

    .tkd-lb-thumb {
        width: 44px;
        height: 33px;
    }
}

@media (max-width: 480px) {
    .tkd-gallery-stage {
        height: 200px;
    }

    .tkd-gallery-thumb {
        width: 40px;
        height: 30px;
        min-width: 40px;
        min-height: 30px;
        max-width: 40px;
        max-height: 30px;
    }

    .tkd-gallery-thumbs {
        gap: 4px;
        padding: 6px 4px;
        max-height: 50px;
    }
}

/* ══════════════════════════════════════════════════════════
   Overflow containment for the gallery's parent card
   Uses high-specificity selectors to beat the
   overflow:visible!important rules in turnkeydir-public/bundle.
   ══════════════════════════════════════════════════════════ */
.glass-card-wrapper:has(.tkd-photo-gallery) .glass-card-top,
.glass-card-wrapper:has(.tkd-photo-gallery) .glass-card-content,
.glass-card-wrapper:has(.tkd-photo-gallery) .glass-section-content,
.glass-card-wrapper.compact-card:has(.tkd-photo-gallery) .glass-card-top,
.glass-card-wrapper.compact-card:has(.tkd-photo-gallery) .glass-card-content,
.glass-card-wrapper.compact-card:has(.tkd-photo-gallery) .glass-section-content {
    overflow: hidden !important;
    max-width: 100% !important;
}

/* ── Video Container (fallback; primary rules are inline in single-listing.php) ── */
.tkd-video-container {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 0 0 8px 8px;
    background: #000;
}

.tkd-video-container iframe,
.tkd-video-container video {
    display: block;
    width: 100% !important;
    height: 100% !important;
    border: none;
}

/* ── CTA Banner Card (color-dependent accent styles are inline in single-listing.php) ── */
.tkd-cta-card {
    width: 100%;
    box-sizing: border-box;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: adBannerFadeIn 0.6s ease-out forwards;
}
.tkd-cta-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.tkd-cta-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 8px;
    color: #1a1a1a;
    line-height: 1.35;
}

.tkd-cta-desc {
    font-size: 0.85rem;
    margin: 0 0 18px;
    color: #555;
    line-height: 1.6;
}

.tkd-cta-button {
    text-decoration: none !important;
    color: #fff !important;
}
.tkd-cta-button:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

/* Image banner type */
.tkd-cta-card-image {
    width: 100%;
    box-sizing: border-box;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: adBannerFadeIn 0.6s ease-out forwards;
}
.tkd-cta-card-image:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.tkd-cta-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    border-radius: 0;
}

@media (max-width: 768px) {
    .tkd-cta-card {
        padding: 18px 16px !important;
    }
    .tkd-cta-title {
        font-size: 1rem;
    }
    .tkd-cta-button {
        padding: 10px 22px;
        font-size: 0.82rem;
    }
}

/* ── Highlight Badges (Single Listing) ── */
.tkd-highlights-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tkd-highlight-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
    border: 1px solid rgba(37, 99, 235, 0.2);
}

.tkd-highlight-badge i {
    font-size: 12px;
}

/* ── Verified Badge ── */
.glass-status-badge.status-verified {
    background: rgba(76, 175, 80, 0.15);
    color: #2e7d32;
    border: 1px solid rgba(76, 175, 80, 0.3);
}
