:root {
    --gold: #DDD1A0;
    --light-gold: #EDE8D4;
    --blue: #A0B8DD;
    --light-blue: #D4DEED;
    --pink: #DDA0AF;
    --light-pink: #EDD4DA;

    --dot-main: var(--gold);
    --dot-shadow: var(--light-gold);
    --dot-selected: var(--gold);
    --dot-shadow-selected: var(--light-gold);

    --app-btn-main: #fffdf8;
    --panel-main: #fcf9f2;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; }

body { 
    background: var(--panel-main);
}

.container {
    display: flex;
    flex-direction: row;
    height: 100vh;
    width: 100vw;
}

/* ====== PHONE STYLES ======= */



@media only screen and (orientation: portrait) {
    .container {
        flex-direction: column;
    }

    .maps-container {
        height: 50vh !important;
    }

    #map {
        width: 100% !important;
        height: 100% !important;
    }

    .panel-footer {
        justify-content: center !important;
    }

    #inset-map-container {
        visibility: hidden !important;
    }

    
}

@media (max-width: 1000px) {
    .gallery-header {
        flex-direction: column;
        align-items: center; 
        text-align: left;
        gap: 0px !important;                  
        padding-top: 16px;
    }   

    .gallery-item.expanded .gallery-logo {
        width: 0px !important;
        height: 0px !important;
    }
    
}

@media (max-width: 1450px) {
    .gallery-item.expanded .gallery-logo {
        margin-top: 0;

        width: 40px;
        height: 40px;   
    }

}

/* ====== MAP STYLES ======= */

.maps-container{
    width: 100%;
    height: 100%;
}

#map { 
    width: 70vw; 
    height: 100%; 
    background: #333; 
    position: relative;
}

#inset-map {
    width: 100%;
    height: 100%;
    /* overflow-y: hidden; */
    /* position: absolute; */
}

#inset-map-container {
    width: 18vw;
    height: 18vw;
    top: 70px;
    left: 70px;
    position: absolute;
    display: flex;
    flex-flow: column wrap;
    overflow: hidden;
    box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.4);
    border: 4px solid white;
    border-radius: 5px;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease visibility 0.5s ease;
}

#inset-map-container.hidden {
    opacity: 0;
    visibility: hidden;
}

/* ====== RESET MAP VIEW BUTTON ======= */

#reset-map-view{
    position:absolute;
    top: 6vh;
    right: 6vh;
    /* display: block; */
    padding: 10px;
    border-radius: 12px;
    background: rgb(71, 87, 110);
    color: white;
    font-size: 12px;
    font-family: 'DM Sans', sans-serif;
    /* font-weight: bold; */
    border: 1px solid white;
    box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.4);
    transition: all 0.25s ease;
    visibility: visible;
    opacity: 100;
    z-index: 2;
}

#reset-map-view:hover {
    background: rgb(132, 146, 165);
    box-shadow: 0 4px 15px rgba(38, 37, 41, 0.4);
    transform: translateX(-2px);
}

#reset-map-view.hidden {
    visibility: hidden;
    opacity: 0;
    transition: all 0.25s ease;
}


/* ====== RIGHT PANEL BASICS ======= */

#right-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    /* position: absolute;
    top: 0;
    right: 0; */
    /* width: max(30vw, 300px); */
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;

    background: var(--panel-main);
    padding: 20px 40px 20px 50px;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);

    z-index: 0;
    transition: all 0.5s ease;
    transition-delay: 0.3s;
    opacity: 100%;
    visibility: visible;
}

#right-panel.hidden {
    opacity: 0;
    visibility: hidden;
}

h1 {
    width: 100%;
    font-family: 'DM Sans', sans-serif;
    margin-top: clamp(0px, 2vw, 40px);
    text-align: left;
    color: #333;
    font-size: clamp(18px, 2vw, 25px);
    letter-spacing: clamp(1px, 0.05vw, 2px);
    font-weight: 550;
}

p {
    font-family: 'DM Sans', sans-serif;
    line-height: 1.6;
    margin-top: clamp(0px, 2vw, 10px);
}

#emphasized-text{
    width: 100%;
    text-align: left;
    font-size: clamp(14px, 1vw, 18px);
    font-weight: bold;
    color: #333;
}



.panel-body {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 0; 
    overflow-y: auto;
    margin-bottom: auto;
}

.panel-footer {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 15px;
    justify-content: flex-end;
    align-items: center;

    margin-right: 15px;

    height: auto;
    min-height: unset;
    max-height: unset;
    margin-bottom: 0;
}

.gal-logo {
    width: clamp(45px, 5vw, 70px);      /* Fixed pixel width */
    height: auto;     /* Maintains aspect ratio */
    max-height: none; /* No max constraints */
    object-fit: contain;
}



/* ====== RIGHT PANEL CLOSE BUTTON ======= */

#close-btn {
    align-self: flex-start;
    /* padding: 12px;  */
    margin-top: 10px;
    margin-bottom: auto;
    margin-right: 15px;
    width: 0px;
    height: 0px;
    background: var(--dot-main); 
    color: black; 
    border: none;
    /* border-radius: 6px;  */
    cursor: pointer;
    font-size: 0px;
    font-family: 'DM Sans', sans-serif;

    transition: all 0.2s ease;
}

#close-btn:hover {
    background: var(--dot-shadow);
}

#close-btn.hidden{
    display: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ===== SCROLLBAR STYLES (Cross-browser) ===== */

/* Base container scrollbar (for #right-panel and .panel-body) */
#right-panel,
.panel-body {
    scrollbar-width: thin;
    scrollbar-color: var(--light-gold) #ede8d471;
}

#right-panel::-webkit-scrollbar,
.panel-body::-webkit-scrollbar {
    width: 6px;
}

#right-panel::-webkit-scrollbar-track,
.panel-body::-webkit-scrollbar-track {
    background: #ede8d471;
    border-radius: 3px;
}

#right-panel::-webkit-scrollbar-thumb,
.panel-body::-webkit-scrollbar-thumb {
    background: var(--light-gold);
    border-radius: 3px;
}

#right-panel::-webkit-scrollbar-thumb:hover,
.panel-body::-webkit-scrollbar-thumb:hover {
    background: var(--gold);
}

/* ====== GALLERY LIST ======= */

#gallery-list-wrapper {
    position: relative;
    overflow: hidden;  /* Clips anything bleeding out */
    padding-bottom: 0; /* No extra padding here */

    flex-grow: 1;
    flex-shrink: 1;
    min-height: 0;         /* Allows shrinking below content height */
    margin-top: 10px;      /* Moved from #gallery-list */
}

#gallery-list {
    height: 100%;
    overflow-y: auto;
    /* margin-top: 10px; */
    padding: 0px 15px 0px 0px;
    scroll-behavior: smooth; 
    transition: all 0.3s ease;

    scrollbar-gutter: stable;
}

/* Top fade gradient - only visible when can scroll up */
#gallery-list-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(to bottom, 
                var(--panel-main) 0%, 
                transparent 100%);
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Bottom fade gradient - only visible when can scroll down */
#gallery-list-wrapper::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(to top, 
                var(--panel-main) 0%, 
                transparent 80%);
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#gallery-list-wrapper.can-scroll-up::before {
    opacity: 1;
}

#gallery-list-wrapper.can-scroll-down::after {
    opacity: 1;
}

/* ----- Collapsed state ------ */
.gallery-item {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    flex-grow: 1;
    min-height: 0;
    gap: 0;
    padding: 16px;
    margin: 8px 0px; 
    border: 1px solid #3830152a;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.35s ease;
    background: var(--app-btn-main);
    min-height: 50px;
    position: relative;
    box-shadow: 1px 1px 3px rgba(68, 42, 23, 0.3);

    will-change: transform, max-height, opacity;

    scroll-margin-top: 30px;
}

.location-name {
    font-weight: 600;
    color: #333;
    margin: 0;
    font-size: clamp(14px, 1vw, 16px);;
    line-height: 1.4;
    text-align: left;
    transition: all 0.6s ease;
}

.gallery-item:not(.expanded):hover {
    transform: translateX(3px);
}

.gallery-item.expanded:hover {
    transform: none !important;
}

/* ----- Expanded state ------ */
.gallery-expanded-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.6s ease, opacity 0.6s ease;
}

.gallery-item.expanded .location-name {
    /* font-weight: 1000; */
    font-size: clamp(14px, 1.25vw, 16px);
}

.gallery-item.expanded .gallery-expanded-content {
    max-height: 1500px; /* Adjust based on expected content */
    opacity: 1;
}

.gallery-item.expanded .gallery-logo {
    width: clamp(30px, 8vw, 80px);
    height: clamp(30px, 8vw, 80px);
    opacity: 1;
}

.gallery-item.expanded {
    padding-top: 16px;
    border-color: var(--dot-selected);
    border-width: 2.5px;
}

.gallery-header {
    display: flex;
    align-items: flex-start;
    flex-direction: row;
    gap: 16px;
    padding-top: 12px;
}

.gallery-logo {
    width: 0;
    height: 0;
    opacity: 0;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
    transition: width 0.6s ease, height 0.6s ease, opacity 0.6s ease;

    /* Center vertically within header */
    margin-top: auto;
    margin-bottom: auto;
}

.location-details {
    flex: 1;
    min-width: 0;
}

.location-desc {
    margin: 0;
    font-size: clamp(12px, 0.85vw, 13px);
    color: #666;
    line-height: 1.4;
    font-family: 'DM Sans', sans-serif
}


/* === GALLERY ITEM APP SECTIONS === */

.divider {
    height: 1px;
    background: #e0d8b8;
    margin: 12px 0;
}

.app-section {
    display: flex;
    flex-direction: column;
    /* align-items: center; */
    gap: 2px;
    transition: all 0.2s ease;
}

.app-section:hover {
    transform: translateX(3px); 
}

.app-info {
    display: flex;
    flex-direction: row;
    flex: 1;
    gap: 25px;
    min-width: 0;
}

.app-name {
    font-weight: 1000;
    color: #333;
    margin: 0;
    font-size: clamp(14px, 1vw, 16px);
}

.app-desc {
    margin: 4px 0 0 0;
    font-size: clamp(12px, 0.85vw, 13px);
    color: #666;
    line-height: 1.4;
}

.launch-btn {
    /* width: 60px; */
    /* height: 60px; */
    margin-right: 5px;
    background: none;
    border: none;
    /* border-radius: 50%; */
    cursor: pointer;
    color: var(--gold);
    font-size: 40px;
    line-height: 2;
    display: flex;
    align-items: center;
    text-align: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.launch-btn:hover {
    color: var(--light-gold);
}


/* ========== MAP MARKERS AND LABELS ========== */

.marker-wrapper {
    position: relative;
    width: 30px;
    height: 30px;
}

.marker-dot {
    width: 30px;
    height: 30px;
    background-color: var(--dot-main);
    border-radius: 50%;
    /* border: 1px solid rgba(255,255,255,0.7); */
    box-shadow: inset 0 0 0 1px #ede8d4c7;
    transform: translateZ(0);
    cursor: pointer;
    backface-visibility: hidden;
    will-change: transform;
    /* box-shadow: none; */
    transition: box-shadow 0.25s ease, background-color 2s ease, transform 0.25s ease; 
}

.marker-label {
    position: absolute;
    left: calc(100% + 30px);
    top: 50%;
    transform: translateY(-50%);
    
    padding: 6px 12px;
    border-radius: 8px;
    background-color: var(--dot-shadow);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    opacity: 0%;
    white-space: nowrap;
    z-index: 1000;
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    color: #333;
    visibility: hidden;
    transition: opacity 1s ease, visibility 1s ease;
}

.marker-label.alt {
    position: absolute;
    /* left: -130px; */
    /* top: 50%; */
    padding: 10px 12px;
    width: 9.5vw;
    font-size: clamp(8px, 0.8vw, 12px);
    line-height: clamp(0.6rem, 0.5vw, 0.8rem);
    white-space: normal;           
    word-wrap: break-word;        
    overflow-wrap: break-word; 
}

.marker-label.selected {
    opacity: 100%;
    visibility: visible;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    transition-delay: 0.1s;
}

.marker-dot:hover {
    transform: scale(1.5) translateZ(0);
    box-shadow: inset 0 0 0 1px #EDE8D4,
                0 0 0 4px var(--dot-shadow);
}

.marker-dot.selected {
    transform: scale(1.5);
    box-shadow: 0 0 0 4px var(--dot-shadow-selected);
    background-color: var(--dot-selected);
    transition: box-shadow 2s ease, background-color 2s ease, transform 2s ease;
    cursor: grab;
    animation: none;
}

@keyframes dot-pulse {
    0%   { transform: scale(1);   box-shadow: 0 0 0 0 var(--dot-shadow); }
    40%  { transform: scale(1.3); box-shadow: 0 0 0 6px var(--dot-shadow); }
    100% { transform: scale(1);   box-shadow: 0 0 0 0 var(--dot-shadow); }
}

.pulse-attract .marker-dot.pulsing {
    animation: dot-pulse 1.5s ease-in-out;
}


/* ========== MAP APP BUTTON STYLES ========== */

.app-button-container {
    position: absolute;
    left: calc(100% + 30px);
    top: 50%;
    transform: translateY(25px); /* Offset below label */
    z-index: 999;
    min-width: 140px;
    width: 100%;
    
    display: flex;           
    flex-direction: column;
    gap: 6px;
    
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

/* Show app buttons  */
.app-button-container.app-buttons-visible {
    opacity: 1;
    visibility: visible;
    transition-delay: 0.15s; /* Wait for label to appear first */
}

/* Individual app button styling */
.marker-app-btn {
    display: flex;
    justify-content: space-between; 
    align-items: center;
    gap: 8px;

    /* width: 9.5vw; */

    padding: 4px 10px;
    border-radius: 6px;
    background-color: var(--app-btn-main, #e8e4c9);
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.295);
    cursor: pointer;
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    color: #333;
    text-align: left;
    
    white-space: normal;           
    word-wrap: break-word;        
    overflow-wrap: break-word;     

    opacity: 0;
    transition: opacity 0.2s ease 0s, background-color 0.2s ease 0s !important;
}

/* Staggered fade-in for each button */
.app-button-container.app-buttons-visible .marker-app-btn:nth-child(1) { transition-delay: 0.2s; opacity: 1; }
.app-button-container.app-buttons-visible .marker-app-btn:nth-child(2) { transition-delay: 0.4s; opacity: 1; }
.app-button-container.app-buttons-visible .marker-app-btn:nth-child(3) { transition-delay: 0.6s; opacity: 1; }
.app-button-container.app-buttons-visible .marker-app-btn:nth-child(4) { transition-delay: 0.8s; opacity: 1; }

/* Hover state */
.marker-app-btn:hover {
    background-color: var(--gold);
    transition-delay: 0s !important; /* Force instant hover */
}

/* Left-aligned arrow */
.app-btn-arrow {
    font-size: 16px;
    color: var(--gold);
    transition: transform 0.2s ease, color 0.2s ease;
}

/* Right-aligned name */
.app-btn-name {
    text-align: left;
    flex: 1;
}
