/*
 * Single Tour Responsive Styles
 */
:root {
    --brand-primary: #FF6700;
    --brand-secondary: #374151;
    --color-primary: #FF6700 !important;
    --p: 74.8% 0.17 65.5 !important;
    --pc: 100% 0 0 !important;
    --color-secondary: #374151 !important;
    --s: 35% 0.02 260 !important;
}

.wishlist-toggle.active {
    background-color: white !important;
    color: var(--brand-primary) !important;
}

.wishlist-toggle.active .dashicons {
    color: var(--brand-primary) !important;
}

.itinerary-item:has(.itinerary-toggle:checked) .itinerary-day-label,
.itinerary-item:has(.itinerary-toggle:checked)::after,
.itinerary-timeline .collapse:has(.itinerary-toggle:checked) .collapse-title {
    color: var(--brand-primary) !important;
}

.itinerary-item:has(.itinerary-toggle:checked)::after {
    background-color: var(--brand-primary) !important;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.15) !important;
}

.tour-header-strip {
    --base-content: #1f2937;
}

/* Gallery Grid System */
#trangtour-gallery-trigger .gallery-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    border-radius: 1rem;
    overflow: hidden;
    position: relative;
    height: 320px;
}

#trangtour-gallery-trigger .gallery-main {
    grid-column: 1 / -1;
    position: relative;
    overflow: hidden;
    height: 100% !important;
    align-self: stretch !important;
}

#trangtour-gallery-trigger .gallery-side {
    display: none;
}

/* Extracted Inline Styles & Media Queries */
.gallery-wishlist-icon {
    font-size: 24px;
    width: 24px;
    height: 24px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.gallery-h-full {
    height: 100% !important;
}

.gallery-mobile-badge {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: rgba(0,0,0,0.6);
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.75rem;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 500;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.2);
}

.gallery-desktop-badge {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: rgba(0,0,0,0.7);
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.75rem;
    color: #fff;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.3);
    z-index: 30 !important;
}

.gallery-icon-18 {
    font-size: 18px;
    width: 18px;
    height: 18px;
    line-height: 1;
}

.lb-main-img-bound {
    max-height: calc(100dvh - 110px);
}

.lb-nav-icon {
    width: 32px;
    height: 32px;
    font-size: 32px;
}

.lb-title-gradient {
    background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, transparent 100%);
}

.lb-thumb-container {
    flex-shrink: 0;
    width: 56px;
    height: 44px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity .2s, border-color .2s;
}

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

/* Responsive Overrides */
@media (max-width: 767px) {
    .tour-header-strip h2 {
        white-space: normal !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        font-size: 0.85rem !important;
        line-height: 1.2 !important;
    }

    article img,
    .prose img,
    figure img {
        max-width: 100% !important;
        height: auto !important;
    }

    .trangtour-gallery-container {
        aspect-ratio: 16 / 9 !important;
        height: auto !important;
    }

    .prose table,
    table {
        display: block !important;
        overflow-x: auto !important;
    }
}

@media (min-width: 768px) {
    .trangtour-gallery-container {
        aspect-ratio: auto !important;
        height: 400px !important;
    }
    
    #trangtour-gallery-trigger .gallery-grid {
        grid-template-columns: 3fr 2fr;
        height: 440px;
    }

    #trangtour-gallery-trigger .gallery-main {
        grid-column: 1 / 2;
    }

    #trangtour-gallery-trigger .gallery-side {
        display: grid;
        grid-column: 2 / 3;
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(2, 1fr);
        gap: 4px;
        height: 100% !important;
        align-self: stretch !important;
    }

    #trangtour-gallery-trigger .gallery-side-item {
        position: relative;
        overflow: hidden;
        height: 100% !important;
        align-self: stretch !important;
    }
}

/* Print Overrides */
@media print {
    #lb-main-img,
    #lb-counter,
    .modal.bg-black\/95,
    #trangtour-lightbox-modal,
    .gallery-grid,
    .tour-sidebar,
    header,
    footer {
        display: none !important;
    }

    .bg-base-100 {
        background: #fff !important;
        color: #000 !important;
    }

    body {
        background: #fff !important;
    }

    .prose {
        max-width: 100% !important;
    }
}

/* ============================================================
   Lightbox — #tt-lightbox (<dialog>)
   ============================================================ */

/* Slide animations */
@keyframes tt-slide-in-right  { from { transform: translateX(60px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes tt-slide-in-left   { from { transform: translateX(-60px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes tt-slide-out-left  { from { transform: translateX(0); opacity: 1; } to { transform: translateX(-60px); opacity: 0; } }
@keyframes tt-slide-out-right { from { transform: translateX(0); opacity: 1; } to { transform: translateX(60px); opacity: 0; } }

.tt-slide-in-right  { animation: tt-slide-in-right  0.22s ease forwards; }
.tt-slide-in-left   { animation: tt-slide-in-left   0.22s ease forwards; }
.tt-slide-out-left  { animation: tt-slide-out-left  0.18s ease forwards; }
.tt-slide-out-right { animation: tt-slide-out-right 0.18s ease forwards; }

/* Thumbnail strip */
#tt-lb-thumbs {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}
#tt-lb-thumbs::-webkit-scrollbar { display: none; }

.tt-lb-thumb {
    flex-shrink: 0;
    width: 64px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.45;
    transition: opacity 0.2s, border-color 0.2s, transform 0.15s;
}
.tt-lb-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.tt-lb-thumb:hover  { opacity: 0.75; }
.tt-lb-thumb.active {
    opacity: 1;
    border-color: var(--brand-primary, #FF6700);
    transform: scale(1.08);
}

@media (max-width: 640px) {
    .tt-lb-thumb { width: 52px; height: 40px; }
}

/* Loading spinner */
#tt-lb-spinner {
    display: none; /* hidden by default; JS shows it */
    position: absolute;
    inset: 0;
    z-index: 10;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    background: transparent;
}

/* Main image fade transition */
#tt-lb-img {
    transition: opacity 0.18s ease;
}

/* Prevent lingering animation classes when dialog is hidden */
#tt-lightbox[open] #tt-lb-img-wrap {
    position: relative;
}

/* ── Lightbox nav buttons — use ID for maximum specificity ── */

/* Make #tt-lb-box the positioning context for the nav buttons */
#tt-lb-box {
    position: relative !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    outline: none !important;
}

#tt-lightbox {
    outline: none !important;
    border: none !important;
}

#tt-lightbox:focus,
#tt-lb-box:focus {
    outline: none !important;
}

#tt-lightbox:not([open]) {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
    z-index: -1 !important;
}

#tt-lightbox[open] {
    display: grid !important;
    pointer-events: auto !important;
    visibility: visible !important;
    z-index: 999999 !important;
}

#tt-lb-close:hover {
    background-color: var(--brand-primary, #FF6700) !important;
    transform: scale(1.1);
}

@media (max-width: 767px) {
    .gallery-mobile-badge,
    .gallery-desktop-badge,
    .wishlist-toggle {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
}

#tt-lb-prev,
#tt-lb-next {
    /* Reset any inherited styles */
    all: unset;
    /* Position within #tt-lb-box */
    position: absolute !important;
    /* Center vertically */
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 60 !important;
    /* Button appearance */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 50px !important;
    height: 50px !important;
    border-radius: 50% !important;
    background: rgba(0, 0, 0, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #fff !important;
    cursor: pointer !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-sizing: border-box !important;
    backdrop-filter: blur(4px);
}

#tt-lb-prev {
    left: 20px !important;
    right: auto !important;
}

#tt-lb-next {
    right: 20px !important;
    left: auto !important;
}

#tt-lb-prev:hover,
#tt-lb-next:hover {
    background: var(--brand-primary, #FF6700) !important;
    transform: translateY(-50%) scale(1.1) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
}

#tt-lb-prev svg,
#tt-lb-next svg {
    display: block;
    flex-shrink: 0;
    pointer-events: none;
}

/* Fix for thumbnails centering when they don't overflow */
#tt-lb-thumbs {
    scrollbar-width: none;
    display: flex;
    justify-content: flex-start; /* Default for overflow scrolling */
}

@media (min-width: 640px) {
    #tt-lb-thumbs {
        justify-content: center; /* Center when on desktop/large screens */
    }
}

/* Ensure caption is always visible on top of background */
#tt-lb-title {
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    font-weight: 500;
    z-index: 50;
}

