/* ============================================
   GLOBAL STYLES
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

body {
    background-color: #f5f5f5;
}

/* ============================================
   LOADING SCREEN
   ============================================ */

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.6s ease-out;
}

.loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   APP CONTAINER & MAP
   ============================================ */

.app-container {
    width: 100%;
    height: 100%;
    display: flex;
    position: relative;
}

.map-container {
    flex: 1;
    position: relative;
    background-color: #e5e3df;
}

.map {
    width: 100%;
    height: 100%;
    z-index:1000;
}

/* ============================================
   MAP CONTROLS
   ============================================ */

.menu-button,
.background-button,
.layer-button,
.layer-dropdown-toggle {
    border: none;
    border-radius: 4px;
    padding: 10px 12px;
    background-color: white;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-button:hover,
.background-button:hover,
.layer-button:hover,
.layer-dropdown-toggle:hover {
    background-color: #f5f5f5;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.menu-button:active,
.background-button:active,
.layer-button:active {
    transform: scale(0.98);
}

/* Menu Button */
.menu-button {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 44px;
    height: 44px;
    padding: 0;
    z-index: 1003;
    animation: slideInLeft 0.4s ease;
}
    .menu-button img{display:none;width:30px;height:30px;}
    .menu-button__home .menu-icon__home{display:block;}
    .menu-button__info .menu-icon__info{display:block;}



@keyframes slideInLeft {
    from {
        transform: translateX(-30px);
        /* opacity: 0; */
    }
    to {
        transform: translateX(0);
        /* opacity: 1; */
    }
}

/* Background Button */
.background-button {
    position: absolute;
    bottom: 80px;
    right: 16px;
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 20px;
    z-index: 1001;
}

/* Layer Controls */
.layer-controls {
    position: absolute;
    left: 16px;
    bottom:16px;
    transform: none;
    z-index: 1006;
    display: flex;
    align-items: center;
    gap: 0;
    background: transparent;
    border-radius: 6px;
    padding: 0;
    transform: translateX(0);
    transition: transform 0.4s ease-out;
}
    .layer-controls.menu__open {
        transform: translateX(300px);
    }

.layer-buttons-container {
    display: flex;
    gap: 0;
    align-items: center;
}

.layer-button {
    padding: 8px 12px;
    font-size: 12px;
    white-space: nowrap;
    background: white;
    border: 1px solid rgba(0,0,0,0.08);
    margin: 0;
    border-left: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius:0;
}

.layer-button + .layer-button {
    border-left: 1px solid rgba(0,0,0,0.08);
}
.layer-button__linked::before{
    display:block;
    content:'';
    background-image:url('../images/info.png');
    background-size:contain;
    background-repeat:no-repeat;
    width:15px;height:15px;
    padding-right:3px;
}
.layer-button__home::before{
    display:block;
    content:'';
    background-image:url('../images/home.png');
    background-size:contain;
    background-repeat:no-repeat;
    width:15px;height:15px;
    padding-right:7px;
}

.layer-button:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.layer-button:last-child {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

.layer-button.active {
    background-color: #667eea;
    color: white;
}

.layer-dropdown-toggle {
    display: none;
    width: 24px;
    height: 32px;
    padding: 0;
    font-size: 12px;
    margin-left: 0px;
    border-radius:0;
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
    background: white;
    border: 1px solid rgba(0,0,0,0.08);
}

/* ============================================
   MARKER STYLES
   ============================================ */

.lflapp-icon svg{
    fill: #9b3b03;
}

.lflapp-icon__text {
    background-color:#f19b69;
    color:#9b3b03;
    font-weight:bold;
    border:none;
    border-bottom:3px solid #9b3b03;
    border-radius:0px;
    padding-left:12px; padding-right:12px;
}
.lflapp-icon__text.leaflet-tooltip-top:before {
    border-top-color:#9b3b03;
    border-width:12px;
    margin-left:-12px;margin-bottom:-24px; /* adjust the position of the tooltip arrow, in relation to the width */
    }

.lflapp-icon__text__V2 {
    background-color:#f19b69;
    color:#9b3b03;
    font-weight:bold;
    border:none;
    border-bottom:3px solid #9b3b03;
    border-radius:0px;
    padding-left:12px; padding-right:12px;
    
}
.lflapp-icon__text__V2.leaflet-tooltip-top:before {
    border-top-color:#9b3b03;
    border-left-color:#9b3b03;
    border-width:6px;
    margin-left:-50%;margin-bottom:-15px; /* adjust the position of the tooltip arrow, in relation to the width */
}
/* ============================================
   MENU SIDEBAR
   ============================================ */

.menu {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 300px;
    height: 100%;
    background-color: white;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
    z-index: 1004;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.4s ease-out;
    overflow-y: auto;
}

.menu.open {
    transform: translateX(0);
}

.menu-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-header h2 {
    font-size: 18px;
    color: #333;
    margin: 0;
}

.close-button {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.close-button:hover {
    color: #333;
}

.menu-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.menu-footer {
    padding: 16px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-action-button {
    background-color: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.menu-action-button:hover {
    background-color: #efefef;
    border-color: #d0d0d0;
}

.menu-action-button .icon {
    font-size: 16px;
}

/* Menu Backdrop */
.menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 1003;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.menu-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================
   EXTENDED INFORMATION PANEL
   ============================================ */

.extended-info {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: white;
    z-index: 1005;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    overflow: hidden;
}
    .extended-info.allowmenu {
        z-index: 1002;
    }

    .extended-info.open {
        transform: translateX(0);
    }

.extended-info .close-button {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 1007;
}

.extended-info-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.extended-info-column {
    flex: 1;
    padding: 60px 24px 24px;
    overflow-y: auto;
    border-right: 1px solid #e0e0e0;
}

.extended-info-column.column-right {
    border-right: none;
}

.extended-info-column h3 {
    font-size: 18px;
    color: #333;
    margin-bottom: 16px;
}

.extended-info-column p {
    font-size: 14px;
    line-height: 1.6;
    color: #666;
    margin-bottom: 12px;
}

button.pswp__button--lflapp-closebutton, .extended-info__video .close-button, .extended-info__image .close-button{
    font-weight:bold;
    color:white;
    font-size:1.4em;
    background-color:#333;
    border-radius:60px;
    width:50px; height:50px;
}
    
    button.pswp__button--lflapp-closebutton:hover, .extended-info__video .close-button:hover, .extended-info__image .close-button:hover{
        width:50px; height:50px;
        border-radius:60px;
        background-color:#999999;
    }

.extended-info__text{
    box-sizing: border-box;
    padding:20px;
}
    
.extended-info.extended-info__video{
    background-color:rgba(0, 0, 0, 0.5);
}
.extended-info.extended-info__image{
    background-color:rgba(0, 0, 0, 0);
}

#lflapp-videoframe{
    position:fixed;
    top:0;bottom:0;left:0;right:0;margin:auto;
    width:100%;height:100%; aspect-ratio:16/9;
    max-width:560px; max-height:315px;
    background-color:#333;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .menu {
        height: calc(100% - 80px);
        width: 100%;
    }

    .background-button {
        bottom: 100px;
    }

    .layer-controls {
        left: 16px;
        bottom: 16px;
        width: auto;
        padding: 0;
        position: absolute;
        align-items: center;
        transition: 
            z-index 0.4s step-start,
            transform 0.4s ease-out;
        z-index:1006;
    }
        .layer-controls.menu__open {
            transform: translate(50px,calc(-100vh + 16px + 15px + 100%));
            z-index:1006;
            transition: 
                z-index 0.4s step-end,
                transform 0.4s ease-out;
        }


    .layer-buttons-container {
        display: flex;
        gap: 0;
        position: relative;
    }

    .layer-buttons-container .layer-button:not(.active) {
        display: none;
    }

    /* Show toggle to the left of the phase buttons */
    .layer-controls .layer-dropdown-toggle {
        order: -1;
        margin-right: 0px;
        align-self: center;
    }

    /* Expanded list stacks upward; bottom item aligns with toggle */
    .layer-buttons-container.expanded {
        position: absolute;
        bottom: 0;
        left: 0px; /* leave space for the toggle on the left */
        display: flex;
        flex-direction: column-reverse;
        gap: 0;
        background: transparent;
        box-shadow: 0 6px 18px rgba(0,0,0,0.12);
        padding-left:24px 0px;
        border-radius: 8px;
        z-index: 1006; /* I assume this is not required, as managed by parent container*/
    }
        .layer-controls.menu__open .layer-buttons-container.expanded {
            /* When menu is open, expand towards to bottom */
            bottom:auto;top:0;
        }

    .layer-buttons-container.expanded .layer-button {
        display: flex;
        width: 160px;
        justify-content: flex-start;
        border-radius:0;
        margin-left:0px;
    }

    .layer-dropdown-toggle {
        display: flex;
    }

    .layer-button {
        width: auto;
        justify-content: flex-start;
        border-radius:0;
        border-top-right-radius: 6px;
        border-bottom-right-radius: 6px;
    }
        .layer-button:first-child {
            border-radius:0;
            border-top-right-radius: 6px;
            border-bottom-right-radius: 6px;
        }
        .layer-button:last-child {
            border-radius:0;
            border-top-right-radius: 6px;
            border-bottom-right-radius: 6px;
        }

    .extended-info__text{
        padding:10px;
    }

    .extended-info-content {
        flex-direction: column;
    }

    .extended-info-column {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        padding: 80px 20px 20px;
    }

    .extended-info-column.column-right {
        border-bottom: none;
    }

    .extended-info-column h3 {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .menu-button {
        top: 12px;
        left: 12px;
        width: 40px;
        height: 40px;
    }

    .background-button {
        bottom: 76px;
        right: 12px;
        width: 40px;
        height: 40px;
    }

    .menu-header {
        padding: 16px;
    }

    .menu-header h2 {
        font-size: 16px;
    }

    .menu-content {
        padding: 12px;
    }

    .menu-footer {
        padding: 12px;
    }

    .menu-action-button {
        font-size: 12px;
        padding: 10px 12px;
    }
}

/* ============================================
   MENU CONTENT STYLING
   ============================================ */

.menu-section {
    margin-bottom: 20px;
}

.menu-section h3 {
    font-size: 16px;
    color: #333;
    margin-bottom: 10px;
    font-weight: 600;
}

.menu-section h4 {
    font-size: 14px;
    color: #555;
    margin-top: 12px;
    margin-bottom: 8px;
    font-weight: 500;
}

.menu-section h5 {
    font-size: 13px;
    color: #666;
    margin-top: 10px;
    margin-bottom: 8px;
    font-weight: 500;
}

.menu-section p {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    margin-bottom: 8px;
}

.menu-section ul {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
}

/* ============================================
   EXTENDED INFO CONTENT STYLING
   ============================================ */

.info-block {
    margin-bottom: 24px;
}

.info-block h4 {
    font-size: 15px;
    color: #333;
    margin-bottom: 12px;
    font-weight: 600;
}

.info-block h5 {
    font-size: 13px;
    color: #555;
    margin-bottom: 10px;
    font-weight: 500;
}

.info-block p {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 8px;
}

.info-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.info-table tr {
    border-bottom: 1px solid #e0e0e0;
}

.info-table tr:last-child {
    border-bottom: none;
}

.info-table td {
    padding: 10px 0;
    color: #666;
}

.info-table td:first-child {
    color: #333;
    font-weight: 500;
    padding-right: 12px;
}

.info-table code {
    background-color: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-active {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.badge-inactive {
    background-color: #f3e5f5;
    color: #6a1b9a;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}
