/* ==========================================================================
   DESIGN SYSTEM & VARIABLES
   ========================================================================== */
:root {
    --bg-dark-primary: #07090e;
    --bg-dark-secondary: #0f131a;
    --bg-dark-tertiary: #171d26;
    
    /* Neon & Accent Colors */
    --accent-ice: #00F2FE;
    --accent-sky: #4FACFE;
    --accent-sunset: #FF9900;
    --accent-sunset-glow: rgba(255, 153, 0, 0.3);
    --accent-ice-glow: rgba(0, 242, 254, 0.2);
    
    /* Glassmorphism Styling */
    --glass-bg: rgba(15, 19, 26, 0.75);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: rgba(0, 0, 0, 0.4);
    
    /* Text colors */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Transitions */
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ==========================================================================
   GLOBAL RESET
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    height: 100%;
    background-color: var(--bg-dark-primary);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--bg-dark-tertiary);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-sky);
}

/* ==========================================================================
   PARALLAX HERO HEADER
   ========================================================================== */
.hero-banner {
    position: relative;
    width: 100%;
    height: 13vh;
    min-height: 90px;
    max-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    overflow: hidden;
    z-index: 10;
    border-bottom: 1px solid var(--glass-border);
}

/* Parallax Layer Simulations using Gradients */
.parallax-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.bg-sky {
    background: linear-gradient(to bottom, #0d1b2a, #1b263b, #415a77);
    z-index: 1;
}

.bg-mountains-back {
    /* Silhouette of distant mountains */
    background: radial-gradient(circle at 80% 120%, rgba(255,153,0,0.15) 0%, transparent 60%),
                linear-gradient(135deg, transparent 50%, rgba(79, 172, 254, 0.1) 50%),
                linear-gradient(225deg, transparent 65%, rgba(79, 172, 254, 0.1) 65%);
    background-size: 100% 100%;
    z-index: 2;
    opacity: 0.7;
}

.bg-mountains-front {
    /* Closer dark mountain silhouette */
    background: linear-gradient(to top, var(--bg-dark-primary) 0%, transparent 80%),
                linear-gradient(150deg, transparent 60%, rgba(7, 9, 14, 0.9) 60%),
                linear-gradient(210deg, transparent 70%, rgba(7, 9, 14, 0.9) 70%);
    z-index: 3;
}

.hero-content {
    position: relative;
    z-index: 4;
    padding: 0 20px;
    transform: translateY(0);
}

.hero-title {
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff 30%, var(--accent-ice) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 20px rgba(0,0,0,0.4);
    margin-bottom: 2px;
    line-height: 1.1;
}

.hero-subtitle {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 300;
    max-width: 600px;
    margin: 0 auto;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    letter-spacing: 0.01em;
}

.scroll-indicator {
    display: none;
}

.scroll-indicator:hover {
    color: var(--accent-ice);
}

.arrow-down {
    width: 20px;
    height: 20px;
    fill: currentColor;
    margin-top: 4px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
    60% { transform: translateY(-3px); }
}

/* ==========================================================================
   APP LAYOUT
   ========================================================================== */
.app-container {
    display: flex;
    width: 100%;
    height: calc(100vh - 13vh);
    min-height: calc(100vh - 140px);
    overflow: hidden;
    position: relative;
    background-color: var(--bg-dark-primary);
}

/* SIDEBAR GLASS PANEL */
.sidebar-panel {
    width: 380px;
    height: 100%;
    background-color: var(--bg-dark-secondary);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
    z-index: 5;
}

/* PROFILE CARD */
.profile-card {
    padding: 24px;
    border-bottom: 1px solid var(--glass-border);
    background: linear-gradient(180deg, var(--bg-dark-secondary) 0%, var(--bg-dark-primary) 100%);
    text-align: center;
}

.profile-image-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 16px;
}

.profile-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-sky);
    box-shadow: 0 0 15px rgba(79, 172, 254, 0.4);
    transition: var(--transition-spring);
}

.profile-card:hover .profile-img {
    transform: rotate(5deg) scale(1.05);
}

.profile-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    background: linear-gradient(135deg, var(--accent-sky), var(--accent-ice));
    color: var(--bg-dark-primary);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    border: 2px solid var(--bg-dark-secondary);
}

.profile-info h2 {
    font-size: 1.35rem;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.profile-role {
    font-size: 0.8rem;
    color: var(--accent-ice);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.profile-bio {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    text-align: justify;
}

/* EXPEDITIONS NAV LIST */
.expeditions-nav {
    padding: 20px 16px;
    flex-grow: 1;
}

.expeditions-nav h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding-left: 8px;
}

.nav-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    text-align: left;
    cursor: pointer;
    width: 100%;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}

.nav-item:hover {
    background-color: var(--bg-dark-tertiary);
    color: var(--text-primary);
    border-color: var(--glass-border);
}

.nav-item.active {
    background-color: rgba(79, 172, 254, 0.08);
    border-color: rgba(79, 172, 254, 0.3);
    color: var(--text-primary);
}

.nav-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-muted);
    margin-right: 14px;
    flex-shrink: 0;
    transition: var(--transition-smooth);
}

.nav-item:hover .nav-dot {
    background-color: var(--accent-ice);
    box-shadow: 0 0 8px var(--accent-ice);
}

.nav-item.active .nav-dot {
    background-color: var(--accent-sky);
    box-shadow: 0 0 10px var(--accent-sky);
}

.nav-text {
    display: flex;
    flex-direction: column;
}

.nav-title {
    font-size: 0.9rem;
    font-weight: 600;
}

.nav-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.info-footer {
    padding: 16px;
    border-top: 1px solid var(--glass-border);
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* CONTENT PANEL */
.content-panel {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* MAP WRAPPER */
.map-wrapper {
    position: relative;
    width: 100%;
    height: 60%;
    border-bottom: 1px solid var(--glass-border);
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
    background-color: var(--bg-dark-primary);
}

/* MAP OVERLAY OVERVIEW CARD */
.map-overlay-card {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;
    background-color: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 16px 20px;
    width: 320px;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px var(--glass-shadow);
    pointer-events: none;
    transition: var(--transition-smooth);
}

#current-expedition-badge {
    display: inline-block;
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--accent-sky);
    background-color: rgba(79, 172, 254, 0.15);
    padding: 2px 8px;
    border-radius: 20px;
    margin-bottom: 8px;
}

.map-overlay-card h3 {
    font-size: 1.1rem;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.map-overlay-card p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ==========================================================================
   DYNAMIC GALLERY DRAWER
   ========================================================================== */
.gallery-drawer {
    width: 100%;
    height: 40%;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-dark-secondary);
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    border-bottom: 1px solid var(--glass-border);
    background-color: var(--bg-dark-tertiary);
}

.gallery-title-group h4 {
    font-size: 1rem;
    color: var(--text-primary);
}

.gallery-title-group p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.gallery-stats {
    font-size: 0.8rem;
}

#photo-count-badge {
    background-color: var(--bg-dark-primary);
    border: 1px solid var(--glass-border);
    padding: 4px 10px;
    border-radius: 20px;
    color: var(--accent-ice);
    font-weight: 600;
}

.gallery-grid-wrapper {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px 16px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
}

.gallery-placeholder {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
}

.placeholder-icon {
    width: 48px;
    height: 48px;
    fill: currentColor;
    margin-bottom: 12px;
    opacity: 0.4;
}

.gallery-placeholder p {
    font-size: 0.85rem;
    max-width: 320px;
}

/* GALLERY CARDS */
.gallery-card {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background-color: var(--bg-dark-primary);
    border: 1px solid var(--glass-border);
    transition: var(--transition-spring);
}

.gallery-card:hover {
    transform: translateY(-4px) scale(1.03);
    border-color: var(--accent-sky);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

.gallery-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-smooth);
}

.gallery-card:hover .gallery-thumb {
    transform: scale(1.08);
}

/* Video badge overlay */
.video-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: rgba(7, 9, 14, 0.8);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-sunset);
    border: 1px solid rgba(255, 153, 0, 0.3);
}

.video-badge svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* Video thumbnail placeholder styling */
.video-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-dark-tertiary) 0%, var(--bg-dark-primary) 100%);
    padding: 16px;
    border-top: 3px solid var(--accent-sunset);
    transition: var(--transition-smooth);
}

.gallery-card:hover .video-thumb-placeholder {
    filter: brightness(1.15);
}

.video-icon {
    width: 38px;
    height: 38px;
    fill: var(--accent-sunset);
    filter: drop-shadow(0 0 8px var(--accent-sunset-glow));
    margin-bottom: 12px;
    transition: var(--transition-spring);
}

.gallery-card:hover .video-icon {
    transform: scale(1.15);
    fill: #ffffff;
    filter: drop-shadow(0 0 12px var(--accent-sunset));
}

.video-filename {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: center;
    font-weight: 500;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 4px;
}

/* Card hover caption reveal */
.gallery-card-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 8px;
    background: linear-gradient(to top, rgba(7, 9, 14, 0.95) 0%, rgba(7, 9, 14, 0.6) 60%, transparent 100%);
    opacity: 0;
    transform: translateY(10px);
    transition: var(--transition-smooth);
}

.gallery-card:hover .gallery-card-info {
    opacity: 1;
    transform: translateY(0);
}

.gallery-card-location {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent-ice);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-card-date {
    font-size: 0.6rem;
    color: var(--text-secondary);
}

/* ==========================================================================
   LEAFLET CUSTOM POPUPS & MARKERS
   ========================================================================== */
/* Custom pulsing marker div icon */
.custom-map-marker {
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-pin {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--accent-sky);
    border: 2px solid #ffffff;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    position: relative;
    transition: var(--transition-spring);
}

/* Wave pulsing effect */
.marker-pin::after {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--accent-sky);
    opacity: 1;
    animation: marker-pulse 1.8s infinite ease-out;
}

/* Different markers for cumbres (summits) */
.custom-map-marker.summit .marker-pin {
    background-color: var(--accent-sunset);
    width: 20px;
    height: 20px;
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    border: none;
    border-radius: 0;
}

.custom-map-marker.summit .marker-pin::after {
    display: none;
}

.custom-map-marker:hover .marker-pin {
    transform: scale(1.25);
    box-shadow: 0 0 15px currentColor;
}

@keyframes marker-pulse {
    0% { transform: scale(0.6); opacity: 1; }
    100% { transform: scale(1.8); opacity: 0; }
}

/* Leaflet dark theme tweaks */
.leaflet-container {
    background: var(--bg-dark-primary) !important;
}

.leaflet-bar {
    border: 1px solid var(--glass-border) !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3) !important;
}

.leaflet-bar a {
    background-color: var(--bg-dark-secondary) !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--glass-border) !important;
    transition: var(--transition-smooth);
}

.leaflet-bar a:hover {
    background-color: var(--bg-dark-tertiary) !important;
    color: var(--accent-ice) !important;
}

/* Custom Glassmorphism Popups */
.leaflet-popup-content-wrapper {
    background: var(--glass-bg) !important;
    border: 1px solid var(--glass-border) !important;
    color: var(--text-primary) !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 24px var(--glass-shadow) !important;
    backdrop-filter: blur(10px) !important;
}

.leaflet-popup-tip {
    background: var(--glass-bg) !important;
    border-left: 1px solid var(--glass-border) !important;
    border-bottom: 1px solid var(--glass-border) !important;
}

.leaflet-popup-content {
    font-family: 'Inter', sans-serif !important;
    padding: 4px !important;
    margin: 8px 12px !important;
}

.popup-media-container {
    margin-top: 6px;
    display: flex;
    gap: 4px;
    max-height: 80px;
    overflow: hidden;
}

.popup-media-container img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

.leaflet-popup-close-button {
    color: var(--text-muted) !important;
    padding: 6px 8px 0 0 !important;
}

.leaflet-popup-close-button:hover {
    color: var(--accent-ice) !important;
}

.popup-title {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.popup-altitude {
    font-size: 0.75rem;
    color: var(--accent-ice);
    font-weight: 600;
    margin-top: 2px;
}

.popup-button {
    display: inline-block;
    margin-top: 8px;
    background-color: rgba(79, 172, 254, 0.2);
    color: var(--accent-sky);
    border: 1px solid rgba(79, 172, 254, 0.4);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.popup-button:hover {
    background-color: var(--accent-sky);
    color: var(--bg-dark-primary);
}

/* ==========================================================================
   FULLSCREEN LIGHTBOX
   ========================================================================== */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(5, 7, 12, 0.96);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.lightbox.active {
    opacity: 1;
    pointer-events: all;
}

.lightbox-close {
    position: absolute;
    top: 24px;
    right: 24px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    border-radius: 50%;
}

.lightbox-close:hover {
    color: #ffffff;
    background-color: rgba(255,255,255,0.05);
    transform: rotate(90deg);
}

.lightbox-close svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    cursor: pointer;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition-spring);
    z-index: 1010;
}

.lightbox-nav:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-50%) scale(1.08);
    border-color: var(--accent-sky);
}

.lightbox-nav svg {
    width: 32px;
    height: 32px;
    fill: currentColor;
}

.nav-prev {
    left: 32px;
}

.nav-next {
    right: 32px;
}

.lightbox-content {
    max-width: 85%;
    max-height: 75vh;
    display: flex;
    justify-content: center;
    align-items: center;
    transform: scale(0.95);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.15);
}

.lightbox.active .lightbox-content {
    transform: scale(1);
}

.lightbox-image {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
}

.lightbox-video {
    max-width: 100%;
    max-height: 75vh;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    border-radius: 4px;
}

.lightbox-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 24px 40px 32px;
    background: linear-gradient(to top, rgba(5,7,12,0.95) 0%, rgba(5,7,12,0.7) 60%, transparent 100%);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-top: 1px solid rgba(255,255,255,0.02);
}

.caption-text {
    max-width: 70%;
}

.caption-location {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-ice);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.caption-title {
    font-size: 1.25rem;
    margin-top: 4px;
    color: #ffffff;
}

.caption-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.caption-source {
    background-color: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.caption-source.source-exif {
    color: var(--accent-sky);
    border-color: rgba(79, 172, 254, 0.3);
}

.caption-source.source-ai {
    color: var(--accent-sunset);
    border-color: rgba(255, 153, 0, 0.3);
}

/* ==========================================================================
   RESPONSIVE DESIGN (MEDIA QUERIES)
   ========================================================================== */
@media (max-width: 992px) {
    .app-container {
        flex-direction: column;
        height: auto;
        overflow-y: visible;
    }
    
    .sidebar-panel {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
    }
    
    .content-panel {
        height: 100vh;
    }
    
    .map-wrapper {
        height: 50%;
    }
    
    .gallery-drawer {
        height: 50%;
    }
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2.2rem;
    }
    
    .hero-subtitle {
        font-size: 0.95rem;
    }
    
    .lightbox-nav {
        width: 44px;
        height: 44px;
    }
    
    .nav-prev {
        left: 8px;
    }
    
    .nav-next {
        right: 8px;
    }
    
    .lightbox-caption {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 16px 20px;
    }
    
    .caption-text {
        max-width: 100%;
    }
}
