/* Updated style.css */
:root {
    --viewport-height: 100vh;
}

body {
    overflow: hidden;
    margin: 0;
    padding: 0;
    height: var(--viewport-height);
}

.hidden {
    display: none;
}

/* Main app container using flexbox */
#app-container {
    display: flex;
    flex-direction: column;
    height: var(--viewport-height);
    position: relative;
}

/* Fixed nav bar at top */
.nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 15px;
    background-color: rgba(33, 37, 41, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1001;
    flex-shrink: 0;
}

/* Class for nav bar panel with text content */
.nav-bar-text-panel {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
    text-align: center;
}

/* Map container that grows/shrinks */
.main-display-container {
    flex: 1;
    position: relative;
    transition: flex 0.35s ease-in-out;
}

/* Toast container */

.toast-container {
    position: static;
    width: 100%;
    border-top: 1px solid rgba(33, 37, 41, 0.95);
    border-bottom: 1px solid rgba(33, 37, 41, 0.95);
}

.toast-container:empty {
    display: none;
}

.toast-message {
    padding: 10px 16px;
    font-weight: bold;
    text-align: left;
    background-color: rgba(33, 37, 41, 0.7);
    color: white;
    border-top: 1px solid rgba(33, 37, 41, 0.95);
    border-bottom: 1px solid rgba(33, 37, 41, 0.95);
}

/* Header bar */
.header-bar {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    pointer-events: auto;
}

/* Instruction styles - base styling (used by both old and new) */
.instruction-banner,
.instruction-banner-overlay {
    padding: 10px 16px;
    font-weight: bold;
    text-align: center;
    border-bottom: 1px solid rgba(33, 37, 41, 0.95);
}

/* Old instruction banner (outside map) */
.instruction-banner {
    border-top: 1px solid rgba(33, 37, 41, 0.95);
}

/* New instruction banner overlay (inside map area, flex item) */
.instruction-banner-overlay {
    flex-shrink: 0;
    pointer-events: auto;
    
    /* Animation properties - height-based */
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
}

/* Visible state for the banner */
.instruction-banner-overlay.banner-visible {
    max-height: 100px; /* Generous max to accommodate content */
    opacity: .7;
}

/* Flash animation for content replacement */
@keyframes banner-flash {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

.instruction-banner-overlay.banner-flash {
    animation: banner-flash 0.25s ease-in-out;
}

.instruction-info {
    background-color: #99CCFF;
    color: black;
}

.instruction-warning {
    background-color: #ffff00;
    color: black;
}

.instruction-error {
    background-color: #ff0000;
    color: white;
}

.instruction-success {
    background-color: #00a000;
    color: white;
}

.instruction-failure {
    background-color: #fdcbdd;
    color: #800000;
}

/* Footer bar */
.footer-bar {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    pointer-events: auto;
}

/* Log display - fixed height of 25vh */
.log-display {
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    height: 25vh;
    display: flex;
    flex-direction: column;
}

.log-title-bar {
    padding: 8px 12px;
    font-weight: bold;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.log-content {
    padding: 8px 12px;
    overflow-y: auto;
    flex: 1;
    min-height: 0; /* Important for flex child scrolling */
}

.log-message:not(:last-child) {
    margin-bottom: 5px;
}

/* Settings display styling */
.settings-display h2 {
    color: white;
    margin-bottom: 20px;
}

/** Dialog styling adjustments */

.modal-header {
    background-color: #e8e8e8;
    color: black;
}

.modal-title {
    color: black;
}

.modal-header .btn-close {
    filter: black;
}

.modal-content {
    border: 2px solid #666;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

/* Map libre map element */
.map-element {
    width: 100%;
    height: 100%;
}


/* ==================== MapDisplay ==================== */

.map-display-root {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.map-display-header {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.map-display-module-header:empty {
    display: none;
}

.map-display-area {
    flex: 1;
    position: relative;
    min-height: 0; /* Important for flex children */
    
    /* CSS custom property for banner offset, used by MapLibre controls and view buttons */
    --banner-offset: 0px;
}

.map-display-map-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* UI layer - flex column overlay that sits on top of the map */
.map-display-ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    pointer-events: none;
}

.map-display-ui-layer > * {
    pointer-events: auto;
}

/* MapLibre control positioning - offset by banner height */
.map-display-area .maplibregl-ctrl-top-right {
    top: var(--banner-offset, 0px);
}

.map-display-area .maplibregl-ctrl-top-left {
    top: var(--banner-offset, 0px);
}

.map-display-overlay-layer {
    flex: 1;
    position: relative;
    min-height: 0; /* Important for flex children */
    pointer-events: none;
}

.map-display-overlay-layer > * {
    /*pointer-events: auto;*/
}

.map-display-footer {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.map-display-module-footer {
    max-height: 25vh;
}

.map-display-module-footer:empty {
    display: none;
}


/* ==================== Game Mode View Buttons ==================== */
/* 
.game-view-buttons {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 8px;
    pointer-events: auto;
}

.game-view-buttons.hidden {
    display: none;
}

.game-view-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    background-color: rgba(33, 37, 41, 0.7);
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
    min-width: 48px;
    min-height: 48px;
    font-size: 16px;
}

.game-view-button:hover {
    background-color: rgba(33, 37, 41, 0.5);
    border-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.game-view-button.active {
    background-color: rgba(13, 110, 253, 0.4);
    border-color: #0d6efd;
    box-shadow: 0 0 12px rgba(13, 110, 253, 0.5);
}

.game-view-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.game-view-button-icon {
    width: 36px;
    height: 36px;
    opacity: 0.6;
    object-fit: contain;
} */


.game-view-buttons {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 4px;
    pointer-events: auto;
}

.game-view-buttons.hidden {
    display: none;
}

.game-view-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border: 4px solid rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.0);
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
    min-width: 48px;
    min-height: 48px;
    font-size: 16px;
}

.game-view-button:hover {
    background-color: rgba(33, 37, 41, 0.5);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.game-view-button.active {
    border-color: #0d6efda0;
    box-shadow: 0 0 12px rgba(13, 110, 253, 0.5);
}

.game-view-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.game-view-button-icon {
    width: 36px;
    height: 36px;
    opacity: 0.7;
    object-fit: contain;
}

/* ==================== Custom MapLibre Controls ==================== */

.maplibregl-ctrl-group {
    background-color: rgba(255, 255, 255, 0.7);
}

.maplibregl-ctrl-group button {
    width: 48px; 
    height: 48px;
}

/* POV Toggle Control */
.pov-toggle-control {
    border-radius: 4px;
}

.pov-toggle-label {
    display: flex;
    align-items: center;
    padding: 16px 16px;
    cursor: pointer;
    user-select: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 20px;
    font-weight: 500;
    color: #333;
}

.pov-toggle-checkbox {
    margin: 0;
    margin-right: 6px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #0078d4;
}

.pov-toggle-text {
    line-height: 1;
}

/* Zoom Extents Control */
.maplibregl-ctrl-group .mapmanager-ctrl-zoom-extents {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    color: #333;
}

.maplibregl-ctrl-group .mapmanager-ctrl-zoom-extents:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.maplibregl-ctrl-group .mapmanager-ctrl-zoom-extents svg {
    display: block;
}

/* Recenter Control */
.maplibregl-ctrl-group .mapmanager-ctrl-recenter {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    color: #333;
}

.maplibregl-ctrl-group .mapmanager-ctrl-recenter:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.maplibregl-ctrl-group .mapmanager-ctrl-recenter svg {
    display: block;
}

.maplibregl-ctrl-attrib {
    font-size: 10px; /* to prevent overlapping left side controls */
    background-color: rgba(255, 255, 255, 0.7) !important;
}

