/* styles for gaap */
:root {
    --primary: #000;
    --secondary: #fff;
    --tertiary: #000;
}
html {
    font-size: 16px;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    margin: 0;
    overflow: hidden;
    padding: 0;
    width: 100%;
}
div, aside, main {
    display: block;
    float: left;
    width: 100%;
}
.btn-link {
    text-decoration: none;
}
@media (min-width: 0px) {
    #ui, #ui-inner {
        display: flex;
        flex-direction: column;
        height: 100vh;
        margin: 0;
        padding: 0;
        width: 100%;
    }
    #filters details summary,
    #locations-counter {
        padding: 4px 12px;
    }
    #details-filters[open] summary {
        background: #fff;
        color: #000;
        font-weight: 700;
    }
    #details-filters[open] .details-contents {
        background: #eee;
        padding: 6px 12px;
    }
    #details-filters[open] .details-contents details summary {
        background: #eee;
        color: #222;
        font-weight: 400;
    }
    #options {
        background: #eee;
        overflow-x: hidden;
        overflow-y: auto;
    }
    #canvas {
        background: #fff;
        display: flex;
        flex-direction: row;
        flex-grow: 1;
        flex-shrink: 0;
        min-height: 240px;
        width: auto;
        position: relative;
        will-change: contents;
    }
    
    #map {
        width: 100%;
        height: 100%;
        position: relative;
        will-change: transform;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        touch-action: pan-x pan-y; /* Allow panning but prevent pinch-zoom conflicts */
    }
    
    /* Prevent text selection during map interactions */
    #map * {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    /* override google maps styles */
    .gm-style-mtc-bbw {
        display: none !important;
    }
    /* Re-enable text selection for info windows */
    .gm-style-iw,
    .gm-style-iw * {
        -webkit-user-select: text;
        -moz-user-select: text;
        -ms-user-select: text;
        user-select: text;
    }
    
    /* location items in aside */
    .location-item {
        text-align: left;
        background-color: #fff;
    }
    
    .location-item button {
        display: flex;
        flex-direction: column;
        text-align: left;
        text-decoration: none;
        color: #333;
        width: 100%;
        touch-action: manipulation; /* Prevent double-tap zoom */
        -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
    }
    
    .location-item .location-title {
        font-weight: bold;
    }
    
    /* Google Maps InfoWindow */
    .gm-style-iw.gm-style-iw-c {
        padding: 0 !important; /* Remove padding - handled by marker-info */
        max-height: none !important;
    }

    .gm-style-iw-d {
        overflow-y: auto !important; /* Allow vertical scrolling only */
        max-height: none !important;
        width: 100% !important;
        box-sizing: border-box !important;
        padding: 0 !important; /* Remove padding - handled by marker-info */
    }
    
    /* Google Maps InfoWindow close button positioning */
    .gm-ui-hover-effect {
        position: absolute !important;
        right: 8px !important;
        top: 0 !important;
        margin: 0 !important;
        padding: 8px !important;
        z-index: 1000 !important; /* Ensure close button is above all content including logos */
    }

    .marker-info {
        width: 70vw;
        max-width: 640px;
        max-height: 320px;
        overflow-y: auto;
        box-sizing: border-box;
        word-wrap: break-word;
        word-break: break-word;
        padding: 12px; /* Add padding to keep content away from edges */
        position: relative;
        z-index: 1;
        margin: 0;
    }
    
    /* Ensure all content inside marker-info respects container width */
    .marker-info * {
        box-sizing: border-box;
    }
    
    /* Prevent any element from exceeding container width */
    .marker-info > * {
        max-width: 100%;
        width: 100%;
    }

    /* Style the scrollbar */
    .marker-info::-webkit-scrollbar {
        width: 8px;
    }

    .marker-info::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 4px;
    }

    .marker-info::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 4px;
    }

    .marker-info::-webkit-scrollbar-thumb:hover {
        background: #666;
    }

    /* Video embedding styles for Bootstrap 4.6.0 */
    .video-embed {
        width: 100%;
        margin: 10px 0;
    }
    
    /* Videos in map location markers - 80% width and centered */
    .marker-videos .video-embed {
        width: 80%;
        margin: 10px auto;
    }
    
    .embed-responsive {
        position: relative;
        display: block;
        width: 100%;
        padding: 0;
        overflow: hidden;
    }
    
    .embed-responsive::before {
        display: block;
        content: "";
        padding-top: 56.25%; /* 16:9 aspect ratio */
    }
    
    .embed-responsive-16by9::before {
        padding-top: 56.25%;
    }
    
    .embed-responsive-4by3::before {
        padding-top: 75%;
    }
    
    .embed-responsive-item {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border: 0;
        max-width: 100%; /* Ensure iframes don't overflow */
    }
    
    /* Excludes .embed-responsive-item to allow video embeds to maintain 16:9 aspect ratio */
    .marker-info iframe:not(.embed-responsive-item),
    .marker-info embed,
    .marker-info object,
    .marker-info video {
        max-width: 100%;
        width: 100%;
        height: auto;
    }
    
    /* Prevent overflow from long URLs, text, and other elements */
    .marker-info a {
        word-wrap: break-word;
        word-break: break-all; /* Break URLs if needed */
        overflow-wrap: break-word;
    }
    
    .marker-info table {
        width: 100%;
        max-width: 100%;
        table-layout: fixed; /* Force table to respect container width */
        overflow-x: auto;
        display: block;
    }
    
    .marker-info pre,
    .marker-info code {
        max-width: 100%;
        overflow-x: auto;
        word-wrap: break-word;
        white-space: pre-wrap; /* Allow wrapping */
    }
    
    .marker-info img {
        max-width: 100%;
        height: auto;
        display: block;
    }
    
    /* Ensure form elements don't overflow */
    .marker-info input,
    .marker-info textarea,
    .marker-info select {
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Basic content spacing */
    .marker-info h2 {
        margin: 0 0 15px 0;
        padding: 0;
    }

    .marker-info p {
        font-size: 1.15rem;
        line-height: 1.6;
        margin: 0 0 15px 0;
        padding: 4px 0;
    }
    .marker-info section {
        display: block;
        float: left;
        width: 100%;
        box-sizing: border-box;
        margin: 0;
        padding: 0;
    }
    .marker-info details {
        float: left;
        width: 100%;
        box-sizing: border-box;
        margin: 0;
        padding: 0;
    }
    .marker-info details summary {
        background: #eee;
        color: #000;
        font-weight: 700;
        font-size: 1.5rem;
        padding: 8px 12px;
    }

    .marker-info .marker-header {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap; /* Allow wrapping on smaller screens */
        align-items: flex-start;
        gap: 12px;
        width: 100%;
        box-sizing: border-box;
        margin: 0 0 16px 0;
        padding: 0;
    }
        .marker-info .marker-title {
            flex: 1 1 200px; /* Flexible but minimum 200px */
            font-size: 2rem;
            line-height: 1.4;
            margin: 0;
            padding: 0;
            min-width: 0; /* Allow flex item to shrink below content size */
            word-wrap: break-word;
            word-break: break-word;
            overflow-wrap: break-word;
            max-width: 100%; /* Flex will handle space distribution */
        }
        .marker-info .marker-logo {
            flex: 0 0 auto; /* Don't grow or shrink */
            max-width: 240px; /* Maximum logo width */
            width: auto;
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }
            .marker-info .marker-logo img {
                max-width: 100%;
                height: auto;
                display: block;
            }
            
    /* When header wraps or on smaller screens, ensure logo fits */
    @media (max-width: 500px) {
        .marker-info .marker-logo {
            max-width: 100%;
        }
        .marker-info .marker-title {
            max-width: 100%;
            flex-basis: 100%; /* Take full width when wrapped */
        }
    }
    .marker-body {
        padding: 16px 0;
    }
    
    .marker-images {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
        align-items: center;
        width: 100%;
        margin: 10px 0;
    }
    
    .marker-images img {
        flex: 0 0 160px;
        width: 160px;
        height: 160px;
        object-fit: cover;
        border-radius: 4px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        padding: 4px;
        background: #fff;
        cursor: pointer;
        transition: transform 0.2s ease;
        touch-action: manipulation; /* Prevent double-tap zoom on touch devices */
        -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
    }
    
    @media (hover: hover) {
        .marker-images img:hover {
            transform: scale(1.05);
        }
    }
    
    @media (hover: none) {
        .marker-images img:active {
            transform: scale(0.98);
        }
    }
    
    /* Image Modal */
    .image-modal {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.9);
        z-index: 10000;
        display: none;
        justify-content: center;
        align-items: center;
    }
    
    .image-modal.active {
        display: flex;
    }
    
    .image-modal-content {
        position: relative;
        max-width: 90%;
        max-height: 90%;
        background: #fff;
        border-radius: 8px;
        overflow: hidden;
    }
    
    .image-modal img {
        width: 100%;
        height: auto;
        max-height: 80vh;
        object-fit: contain;
    }
    
    .image-modal-close {
        position: absolute;
        top: 10px;
        right: 10px;
        background: rgba(0,0,0,0.7);
        color: #fff;
        border: none;
        border-radius: 50%;
        width: 40px;
        height: 40px;
        font-size: 20px;
        cursor: pointer;
        z-index: 10001;
    }
    
    .image-modal-nav {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        background: rgba(0,0,0,0.7);
        color: #fff;
        border: none;
        border-radius: 50%;
        width: 50px;
        height: 50px;
        font-size: 24px;
        cursor: pointer;
        z-index: 10001;
    }
    
    .image-modal-prev {
        left: 20px;
    }
    
    .image-modal-next {
        right: 20px;
    }
    
    .directions-nav {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        float: left;
        gap: 8px;
        margin-top: 12px;
        width: 100%;
    }
    details[open] .directions-form {
        border: 1px solid #999;
        height: 240px;
        overflow-y: auto;
        padding: 8px 12px;
    }
    #sponsors {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        margin-top: 12px;
    }
    .sponsor {
        flex-grow: 1;
        flex-shrink: 1;
        width: 100%;
    }
    .sponsor img {
        width: 100%;
        height: auto;
        max-height: 40px;
        object-fit: contain;
    }
}
@media (min-width: 768px) {
    #sponsors {
        height: 100px;
    }
    #ui-inner {
        flex-direction: row;
        flex-wrap: nowrap;
        height: calc(100vh - 100px); /* height of sponsors */
        width: 100%;
    }
    .map-item {
        height: 100%;
    }
    #options {
        flex-shrink: 0;
        flex-grow: 0;
        width: 200px;
    }
    #canvas {
        flex-grow: 1;
        flex-shrink: 1;
        width: auto;
    }
    #sponsors .sponsor {
        flex-grow: 0;
        flex-shrink: 0;
        width: 200px;
    }
    

}
@media (min-width: 992px) {
    #options {
        width: 240px;
    }
    

}
@media (min-width: 1200px) {
    #options {
        width: 280px;
    }
}

