/* Popup Overlay - Full screen background */

/* CSS Variables matching immersive tour page */
:root {
    --primary-bg: #0e1011;
    --secondary-bg: #333;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --accent1: #444;
    --accent2: #555;
    --primary-color: #ff0000;
    --star-color: #ffc107;
    --popup-bg: #333;
    --bottom-ad-height: 150px; /* reserve space for bottom ad/banner - increased for scrolling room */
    --popup-safe-bottom: 0px; /* runtime-measured bottom-nav/ad height for popup placement */
}

/* When the popup is open, hide the marketing flash container so it cannot overlap the card */
body.popup-open #marketing-flash-container,
body.popup-open .marketing-flash-container {
    display: none !important;
}

.popup-overlay,
#global-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.25); /* semi-transparent dark overlay */
    backdrop-filter: blur(8px); /* frosted glass effect */
    -webkit-backdrop-filter: blur(8px); /* Safari support */
    display: none;
    justify-content: center;
    align-items: flex-end;
    z-index: 2147483647;
    transition: opacity 0.3s ease;
}

.popup-overlay.ios-popup-safe,
#global-popup-overlay.ios-popup-safe {
    background: rgba(0, 0, 0, 0.65) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.popup-overlay.active,
#global-popup-overlay.active {
    display: flex !important;
    justify-content: center !important;
    align-items: flex-end !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 2147483647 !important;
    /* Keep the popup card above the bottom nav/ad by padding the overlay itself. */
    padding-bottom: calc(var(--popup-safe-bottom) + env(safe-area-inset-bottom));
    box-sizing: border-box;
}

/*
  Legacy business/POI popup layout (scoped).
  This restores the old, working behavior where the entire card scrolls (not just .popup-body),
  and avoids bottom clipping.
  IMPORTANT: This class is applied only by scripts/ui/popupCard.js and does not affect metro/tour popups.
*/
.popup-overlay.legacy-business-poi-popup.active {
    padding-bottom: 0 !important;
}

.popup-overlay.legacy-business-poi-popup .popup-content {
    /* Match the original 'pops up properly' behavior: tall card with small top margin */
    height: calc(100dvh - 40px) !important;
    max-height: calc(100dvh - 40px) !important;
    display: flex !important;
    flex-direction: column !important;
}

.popup-overlay.legacy-business-poi-popup .tour-popup {
    width: 100% !important;
    flex: 1 1 auto !important;
    height: 100% !important;
    /* Keep small-content POIs from rendering as a tiny, low card */
    min-height: 50vh !important;
    max-height: none !important;
    overflow-y: auto !important;
    display: block !important;
    padding: 0 16px 16px 16px !important;
}

.popup-overlay.legacy-business-poi-popup .tour-popup .popup-body {
    position: static !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    flex: none !important;
}

/* Centered variant for tour-route popup */
.popup-overlay.centered-popup.active,
#global-popup-overlay.centered-popup.active {
    align-items: center !important;
}

/* Prevent background scroll when popup is open */
body.popup-open {
    overflow: hidden;
    transform: none !important;
    position: static !important;
}

/* ⛔ iOS BLACK SCREEN FIX ⛔
   overflow:hidden on <body> triggers a WebKit compositing layer flush in
   WKWebView. The Mapbox WebGL canvas is in its own GPU compositing layer;
   when that flush hits, iOS reclaims the GPU layer and the canvas goes
   permanently black. iOS does NOT fire webglcontextlost in this case, so
   our recovery code never runs.
   Fix: on iOS, NEVER allow overflow:hidden on body — regardless of popup-open
   class or JS setting body.style.overflow directly. CSS !important beats
   inline styles (without their own !important), so this covers:
   - collectionsPanel.js: document.body.style.overflow = 'hidden'
   - language-init.js: document.body.style.overflow = 'hidden'
   - utils.js fallback path: document.body.style.overflow = 'hidden'
   - any future code that bypasses the popup-open class system
   All position:fixed overlays cover the screen regardless of body overflow,
   so background scroll is invisible and the WebGL canvas is never disturbed. */
body.ios-device,
body.ios-device.popup-open {
    overflow: visible !important;
}

/* Ensure popup overlay is always on top */
body.popup-open .popup-overlay,
body.popup-open #global-popup-overlay {
    z-index: 2147483647 !important;
    position: fixed !important;
}


/* Popup Content Container - Positioned by JavaScript */
.popup-content {
    width: 100%;
    max-width: 360px;
    max-height: calc(100dvh - 40px - var(--popup-safe-bottom) - env(safe-area-inset-bottom)); /* viewport minus margins + bottom guard */
    height: auto;
    background: rgba(25, 25, 25, 0.55); /* translucent panel so backdrop-filter blur shows through */
    border-radius: 20px 20px 0 0;
    animation: slideUp 0.3s ease;
    will-change: transform, opacity;
    overflow: hidden; /* overflow is on the inner popup-body, not here */
    position: relative;
    z-index: 2147483647;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.15s ease-out;
    opacity: 1; /* Always visible when parent overlay is active */
    display: flex;
    flex-direction: column;
}

.popup-overlay.ios-popup-safe .popup-content,
#global-popup-overlay.ios-popup-safe .popup-content {
    background: #202124 !important;
    animation: none !important;
    transition: none !important;
    will-change: auto !important;
}

/* Ensure popup content is visible when overlay is active */
.popup-overlay.active .popup-content,
#global-popup-overlay.active .popup-content {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Tour Popup - Main content area */
.tour-popup {
    --primary-bg: #0e1011;
    --secondary-bg: #333333;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --accent1: #444444;
    --accent2: #555555;
    --popup-bg: #333333;
    position: relative;
    width: 100%;
    flex: 1 1 auto; /* Take up available space in flex container */
    background-color: var(--popup-bg, #333);
    color: white;
    /* Make the popup a column flex container so the inner body can scroll independently */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Outer padding: symmetric horizontal padding for uniform content alignment */
    padding: 16px 16px 0 16px;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.3);
    scrollbar-width: none;
    -ms-overflow-style: none;
    z-index: 2147483647;
}

.popup-overlay.ios-popup-safe .tour-popup,
#global-popup-overlay.ios-popup-safe .tour-popup {
    background-color: #202124 !important;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5) !important;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.tour-popup::-webkit-scrollbar {
    display: none;
}

/* Popup content wrapper inside tour popup */
.tour-popup .popup-body {
    position: relative;
    width: 100%;
    max-width: none;
    background: transparent;
    border-radius: 0;
    animation: none;
    /* Make the inner body the scrollable area */
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 0 calc(var(--bottom-ad-height)) 0; /* keeps the last item visible above ad */
    box-shadow: none;
    transform: none;
}

/* Hide inner scrollbar on WebKit while keeping scrolling functional */
.tour-popup .popup-body::-webkit-scrollbar { display: none; }
.tour-popup .popup-body { scrollbar-width: none; -ms-overflow-style: none; }

/* Bottom spacer - empty container to ensure last POI clears nav/ads */
.popup-bottom-spacer {
    width: 100%;
    min-height: 200px;
    height: 200px;
    flex-shrink: 0;
    pointer-events: none;
    display: block;
}

/* NOTE: Bottom spacing is handled on the overlay (not on the card) to avoid clipping. */

/* Images Container */
.popup-image-scroll {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 8px;
    width: 100%;
    height: 300px;
    margin: 0 0 16px 0;
    padding: 4px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    /* Hide scrollbar */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* Internet Explorer 10+ */
}

/* Hide any duplicate close buttons that aren't part of the icon container */
/* Global suppression when popup is open: hide all legacy/extra close buttons */
body.popup-open #popupCloseBtn,
body.popup-open .tour-close,
body.popup-open button[id="popupCloseBtn"],
body.popup-open button[class*="close"]:not(.popup-icon-container .popup-close) {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* By default hide any .popup-close, then re-enable only the one inside icon stack */
body.popup-open .popup-close {
    display: none !important;
    visibility: hidden !important;
}
body.popup-open .popup-overlay .popup-icon-container .popup-close {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Close Button */
.popup-close {
    cursor: pointer;
    font-size: 20px;
    color: #e0e0e0; /* toned down white X */
    background-color: var(--primary-bg); /* dark gray background */
    border: 1px solid rgba(255, 0, 0, 0.3); /* red border with transparency */
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease-in-out;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
}

.popup-close:hover {
    background-color: var(--accent1); /* lighter gray on hover */
    border-color: #ff0000; /* solid red border on hover */
}

/* Handle */
.popup-handle {
    width: 40px;
    height: 4px;
    background-color: var(--accent2);
    border-radius: 2px;
    margin: 8px auto 16px auto;
}

/* Icon Container */
.popup-icon-container {
    position: absolute;
    top: 12px;
    left: 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 2147483640;
}

/* Force the close icon to show inside the stacked icon container */
.popup-overlay .popup-icon-container .popup-close {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 2147483641;
}

/* Unified popup icon styling: black pill with white icon */
.popup-icon-container .popup-close,
.popup-icon-container .popup-favorite,
.popup-icon-container .popup-share,
.popup-icon-container .popup-basket,
.popup-icon-container .popup-remove {
    color: #ffffff !important;
    background: #000000 !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45) !important;
    display: flex;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.popup-icon-container .popup-close:hover,
.popup-icon-container .popup-favorite:hover,
.popup-icon-container .popup-share:hover,
.popup-icon-container .popup-basket:hover,
.popup-icon-container .popup-remove:hover {
    transform: scale(1.07);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6) !important;
}

.popup-favorite, .popup-share, .popup-basket, .popup-remove {
    cursor: pointer;
    font-size: 20px;
    color: white !important; /* bright white icon */
    background-color: var(--primary-bg); /* dark gray background */
    border: 1px solid rgba(255, 0, 0, 0.3); /* red border with transparency */
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease-in-out;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-favorite:hover, .popup-share:hover, .popup-basket:hover, .popup-remove:hover {
    background-color: var(--accent1); /* lighter gray on hover */
    border-color: #ff0000; /* solid red border on hover */
}

.popup-favorite:hover, .popup-share:hover, .popup-basket:hover, .popup-remove:hover {
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
}

.popup-favorite i, .popup-share i, .popup-basket i, .popup-remove i {
    color: white !important;
}

/* Audio Tour Specific Icons */
.popup-ear, .popup-headphones, .popup-tour-toggle {
    cursor: pointer;
    font-size: 20px;
    color: #ffffff !important;
    background-color: #000000 !important; /* solid black to match other icons */
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease-in-out;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.popup-ear:hover, .popup-headphones:hover, .popup-tour-toggle:hover {
    background-color: var(--accent1); /* lighter gray on hover */
    border-color: #ff0000; /* solid red border on hover */
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
}

/* Purchased tour - green headphones */
.popup-headphones.purchased-tour {
    color: #4ade80 !important;
    background-color: rgba(74, 222, 128, 0.2) !important;
    border-color: rgba(74, 222, 128, 0.6) !important;
}

.popup-headphones.purchased-tour:hover {
    background-color: rgba(74, 222, 128, 0.3) !important;
    border-color: #4ade80 !important;
    box-shadow: 0 0 10px rgba(74, 222, 128, 0.8) !important;
}

/* Tour toggle icon styling */
.popup-tour-toggle i {
    color: #4ade80; /* green color for route icon */
}

.popup-tour-toggle .tour-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ff0000;
    color: white;
    font-size: 10px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.popup-tour-toggle.saved {
    background-color: rgba(74, 222, 128, 0.2);
    border-color: #4ade80;
}

.popup-tour-toggle.saved .tour-badge {
    background: #4ade80;
}

/* QR play button spinner (three dots) */
.qr-play-spinner {
    display: none;
    gap: 4px;
    align-items: center;
    justify-content: center;
}
.qr-play-spinner .dot {
    width: 6px;
    height: 6px;
    background: #ccc;
    border-radius: 50%;
    opacity: 0.9;
    transform: translateY(0);
    animation: qrDotBounce 0.9s infinite ease-in-out;
}
.qr-play-spinner .dot:nth-child(2) { animation-delay: 0.12s; }
.qr-play-spinner .dot:nth-child(3) { animation-delay: 0.24s; }

@keyframes qrDotBounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.9; }
    40% { transform: translateY(-6px); opacity: 1; }
}

/* Images Container */
.popup-image-scroll {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 8px;
    width: 100%;
    height: 300px;
    margin: 0 0 16px 0;
    padding: 4px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    /* Hide scrollbar */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* Internet Explorer 10+ */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.popup-image-scroll::-webkit-scrollbar {
    display: none;
}

.popup-image {
    width: 290px;
    height: 290px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
    background-color: var(--accent2);
}

/* Main Title */
.popup-title-main {
    font-family: 'Anton SC', sans-serif !important;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary, #e0e0e0);
    margin: 12px 0 8px 0;
    line-height: 1.3;
    letter-spacing: 0.3px;
}

.popup-title-with-play {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0 8px 0;
    position: relative;
}
.popup-title-with-play .popup-title-main {
    margin: 0;
}

/* Rating Row */
.popup-rating-row {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    font-size: 13px;
}

.ona-rating-row {
    width: 100%;
    justify-content: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.ona-rating-info {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.popup-rating-stars {
    color: var(--text-primary, #e0e0e0);
    font-weight: 500;
}

.popup-rating-stars .stars {
    color: #ffc107;
    margin-left: 4px;
    font-size: 16px;
}

.popup-review-count {
    color: var(--text-secondary, #a0a0a0);
    margin-left: 6px;
}

/* Google Badge */
.google-badge {
    display: inline-block;
    background: #4285f4;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 4px;
    border-radius: 3px;
    margin-right: 6px;
    vertical-align: middle;
}

/* Alternative Google Badge Styles */
.google-badge-circle {
    display: inline-block;
    background: #4285f4;
    color: white;
    font-size: 10px;
    font-weight: bold;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    text-align: center;
    line-height: 14px;
    margin-right: 6px;
    vertical-align: middle;
}

.google-badge-minimal {
    display: inline-block;
    color: #4285f4;
    font-size: 12px;
    font-weight: bold;
    margin-right: 4px;
    vertical-align: middle;
    font-family: 'Roboto', Arial, sans-serif;
}

.google-badge-outline {
    display: inline-block;
    background: white;
    color: #4285f4;
    border: 1px solid #4285f4;
    font-size: 10px;
    font-weight: bold;
    padding: 1px 3px;
    border-radius: 3px;
    margin-right: 6px;
    vertical-align: middle;
}

/* 🎨 EXTRA G BADGE STYLES FOR YOU TO CHOOSE FROM */

/* Option 1: Square Modern */
.google-badge-square {
    display: inline-block;
    background: linear-gradient(135deg, #4285f4, #34a853);
    color: white;
    font-size: 11px;
    font-weight: 900;
    width: 16px;
    height: 16px;
    text-align: center;
    line-height: 16px;
    margin-right: 6px;
    vertical-align: middle;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Option 2: Pill Shape */
.google-badge-pill {
    display: inline-block;
    background: #4285f4;
    color: white;
    font-size: 9px;
    font-weight: bold;
    padding: 3px 6px;
    border-radius: 12px;
    margin-right: 6px;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Option 3: Neon Glow */
.google-badge-glow {
    display: inline-block;
    background: #4285f4;
    color: white;
    font-size: 10px;
    font-weight: bold;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    text-align: center;
    line-height: 15px;
    margin-right: 6px;
    vertical-align: middle;
    box-shadow: 0 0 8px #4285f4, 0 0 12px rgba(66, 133, 244, 0.3);
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 8px #4285f4, 0 0 12px rgba(66, 133, 244, 0.3); }
    50% { box-shadow: 0 0 12px #4285f4, 0 0 20px rgba(66, 133, 244, 0.5); }
}

/* Option 4: Large Google Colors Badge */
.google-badge-gradient {
    display: inline-block;
    background: linear-gradient(45deg, #4285f4, #ea4335, #fbbc04, #34a853);
    color: white;
    font-size: 16px;
    font-weight: 900;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    text-align: center;
    line-height: 28px;
    margin-right: 8px;
    vertical-align: middle;
    animation: rotate-colors 4s linear infinite;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

@keyframes rotate-colors {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

/* Option 5: Glass Effect */
.google-badge-glass {
    display: inline-block;
    background: rgba(66, 133, 244, 0.8);
    backdrop-filter: blur(10px);
    color: white;
    font-size: 10px;
    font-weight: bold;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    text-align: center;
    line-height: 16px;
    margin-right: 6px;
    vertical-align: middle;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Option 6: 3D Effect */
.google-badge-3d {
    display: inline-block;
    background: linear-gradient(145deg, #5a95f5, #3d7bd4);
    color: white;
    font-size: 10px;
    font-weight: bold;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    text-align: center;
    line-height: 16px;
    margin-right: 6px;
    vertical-align: middle;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.3), inset 1px 1px 2px rgba(255,255,255,0.3);
}

/* 🆕 WANDERLOG STYLE - EXACT COLORFUL GOOGLE G! */
.google-badge-large {
    display: inline-block;
    background: linear-gradient(135deg, 
        #4285f4 0%, 
        #4285f4 25%, 
        #ea4335 25%, 
        #ea4335 50%, 
        #fbbc04 50%, 
        #fbbc04 75%, 
        #34a853 75%, 
        #34a853 100%);
    color: white;
    font-size: 14px;
    font-weight: 700;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    text-align: center;
    line-height: 24px;
    margin-right: 8px;
    vertical-align: middle;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    position: relative;
}

/* Wanderlog-style Google G badge - clean and professional */

/* Status Row */
.popup-status-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-indicator.open {
    background-color: #4caf50;
}

.status-indicator.closed {
    background-color: #f44336;
}

.status-text {
    color: var(--text-primary, #e0e0e0);
}

/* Price Row */
.popup-price-row {
    margin-bottom: 12px;
    font-size: 13px;
}

.price-label {
    color: var(--text-secondary, #a0a0a0);
}

.price-value {
    color: var(--text-primary, #e0e0e0);
    font-weight: 500;
}

/* Action Buttons */
.popup-action-buttons {
    display: flex;
    gap: 8px;
    margin: 16px 0 8px 0;
    padding: 0;
}

.action-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    background: linear-gradient(135deg, rgba(255,0,0,0.1) 0%, rgba(139,0,0,0.1) 100%);
    border: 1px solid rgba(255,0,0,0.3);
    border-radius: 8px;
    color: var(--text-primary, #e0e0e0);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: linear-gradient(135deg, rgba(255,0,0,0.2) 0%, rgba(139,0,0,0.2) 100%);
    border-color: rgba(255,0,0,0.6);
    transform: translateY(-1px);
}

/* Add to Route button - red styling */
.action-btn.add-to-route-btn {
    background: rgba(220, 38, 38, 0.15);
    border-color: rgba(220, 38, 38, 0.5);
    color: #ef4444;
}
.action-btn.add-to-route-btn:hover {
    background: rgba(220, 38, 38, 0.25);
    border-color: rgba(220, 38, 38, 0.7);
}
.action-btn.add-to-route-btn.saved {
    background: rgba(74, 222, 128, 0.15);
    border-color: rgba(74, 222, 128, 0.5);
    color: #4ade80;
}
.action-btn.add-to-route-btn.saved:hover {
    background: rgba(74, 222, 128, 0.25);
    border-color: rgba(74, 222, 128, 0.7);
}

/* Play Tour button */
.action-btn.play-tour-btn {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
}
.action-btn.play-tour-btn:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
    border-color: rgba(99, 102, 241, 0.6);
}

/* Overview play button (circular, inline with overview header) */
.overview-play-btn {
    position: relative;
    z-index: 10;
    width: 30px;
    height: 30px;
    min-width: 30px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    overflow: hidden;
    flex-shrink: 0;
}
.overview-play-btn::before {
    content: '';
    position: absolute;
    width: 45%;
    height: 200%;
    background: linear-gradient(to right, transparent 0%, rgba(255,255,255,0.28) 50%, transparent 100%);
    transform: rotate(-45deg);
    pointer-events: none;
    bottom: -75%;
    left: -75%;
    animation: floatingPlayShine 2s ease-in-out infinite;
}
.overview-play-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}
.overview-play-btn.playing {
    background: rgba(255, 0, 0, 0.2);
    border: 2px solid rgba(255, 0, 0, 0.6);
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.8), 0 0 20px rgba(255, 0, 0, 0.4);
}
.overview-play-btn.playing::before {
    animation: none;
    opacity: 0;
}
.overview-play-btn i {
    font-size: 14px;
}

/* Compact variant for inline action-like buttons (do NOT flex-grow) */
.action-btn.small-action {
    flex: 0 0 auto; /* prevent stretching in flex rows */
    padding: 10px 14px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    align-items: center;
    display: inline-flex;
    gap: 6px;
}

.action-btn.small-action:hover {
    transform: translateY(-1px);
}

/* Additional popup content styling */
.popup-content-wrapper {
    padding: 12px 8px 8px 8px;
}

.popup-description {
    color: var(--text-secondary, #a0a0a0);
    font-size: 13px;
    line-height: 1.4;
    margin: 8px 0;
}

.popup-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 12px 0;
}

.popup-detail-item {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary, #a0a0a0);
}

.popup-detail-label {
    font-weight: 500;
}

.popup-detail-value {
    color: var(--text-primary, #e0e0e0);
}

/* Overview Section */
.popup-overview-section {
    margin: 16px 0;
}

.overview-title {
    font-family: 'Anton SC', sans-serif !important;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.2px;
    color: var(--text-primary, #e0e0e0);
    margin-bottom: 12px;
}

.overview-content p {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.6;
    color: #fff;
    margin-bottom: 12px;
}

.overview-highlights {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.highlight-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-secondary, #a0a0a0);
}

.highlight-icon {
    font-size: 12px;
}

/* Details Section */
.popup-details-section {
    margin: 16px 0;
    border-top: 1px solid var(--accent1, #444);
    padding-top: 12px;
}

.details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 10px 0;
    font-family: 'Anton SC', sans-serif !important;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: #fff;
}

.details-header.expanded .expand-icon {
    transform: rotate(180deg);
}

.expand-icon {
    transition: transform 0.3s ease;
}

.details-content {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.7;
    color: #fff;
    max-height: 200px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.details-content.collapsed {
    max-height: 0;
}

/* Contact Section */
.popup-contact-section {
    margin: 16px 0;
    border-top: 1px solid var(--accent1, #444);
    padding-top: 12px;
}

.contact-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 13px;
}

.contact-row svg {
    flex-shrink: 0;
    color: var(--primary-color, #ff0000);
}

.contact-row a {
    color: var(--text-primary, #e0e0e0);
    text-decoration: none;
}

.contact-row a:hover {
    color: var(--primary-color, #ff0000);
}

/* Image scroll container */
.popup-image-scroll-container {
    margin: 12px 0;
}

/* Slide up animation */
@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Loading spinner with animated dots */
@keyframes loadingDots {
    0%, 20% {
        content: '.';
        letter-spacing: 0;
    }
    40% {
        content: '..';
        letter-spacing: 2px;
    }
    60%, 100% {
        content: '...';
        letter-spacing: 4px;
    }
}

.loading-spinner {
    display: inline-block;
    font-size: 12px;
    color: var(--text-secondary, #a0a0a0);
    font-weight: 500;
    letter-spacing: 1px;
    animation: loadingDots 1.4s infinite;
}

/* ==========================================================================
   IMAGE LIGHTBOX - 48% positioning to match floating audio player
   ========================================================================== */
#popup-image-lightbox {
    position: fixed !important;
    inset: 0 !important;
    z-index: 10001 !important;
    background: rgba(0, 0, 0, 0.9) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#popup-image-lightbox-img {
    position: fixed !important;
    top: 48% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 70vw !important;
    height: 70vw !important;
    max-width: 300px !important;
    max-height: 300px !important;
    object-fit: cover !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
    border: 3px solid rgba(255, 0, 0, 0.5) !important;
    z-index: 10002 !important;
    pointer-events: auto !important;
    background: linear-gradient(135deg, #333 0%, #222 100%) !important;
}

/* Popup cards intentionally stay dark in light mode for legibility. */

.tour-popup h1,
.tour-popup h2,
.tour-popup h3,
.tour-popup h4,
.tour-popup .popup-title-main,
.tour-popup .overview-title {
    color: #ffffff !important;
}
