﻿/* Import modern font */
@import url('https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@400;700&display=swap');

/* General military-style dark theme */
body {
    font-family: 'Roboto Condensed', Arial, sans-serif;
    background: #1C2526; /* Dark gray for C2 systems */
    color: #B0BEC5; /* Light gray text for contrast */
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* Menu wrapper to isolate menus */
#menu-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    pointer-events: none;
}

/* Topbar (horizontal menu) */
#topbar {
    position: fixed;
    top: 10px;
    left: 10px;
    right: 10px;
    height: 60px;
    min-width: 300px;
    max-width: calc(100% - 20px);
    min-height: 50px;
    max-height: 80px;
    background: #263238;
    padding: 5px;
    border: 2px solid #EF4135;
    border-radius: 6px;
    z-index: 2001;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    resize: both;
    overflow-x: auto;
    overflow-y: hidden;
    pointer-events: auto;
}

    #topbar::after {
        content: '';
        position: absolute;
        bottom: 0;
        right: 0;
        width: 10px;
        height: 10px;
        background: #EF4135;
        border-radius: 2px;
        cursor: nwse-resize;
    }

    #topbar .topbar-section {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        background: #37474F;
        padding: 4px;
        border-radius: 4px;
        border: 1px solid #EF4135;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    }

        #topbar .topbar-section summary {
            font-size: 14px;
            font-weight: 700;
            color: #EF4135;
            cursor: pointer;
            padding: 4px;
            text-transform: uppercase;
        }

        #topbar .topbar-section select,
        #topbar .topbar-section button,
        #topbar .topbar-section input[type="text"],
        #topbar .topbar-section input[type="file"] {
            background: #0055A4;
            color: #FFFFFF;
            border: 1px solid #EF4135;
            padding: 6px 10px;
            font-family: 'Roboto Condensed', Arial, sans-serif;
            font-size: 14px;
            font-weight: 700;
            border-radius: 4px;
            cursor: pointer;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
            transition: background 0.2s, transform 0.2s;
        }

        #topbar .topbar-section select {
            max-width: 160px;
        }

            #topbar .topbar-section button:hover,
            #topbar .topbar-section select:hover,
            #topbar .topbar-section input[type="text"]:hover,
            #topbar .topbar-section input[type="file"]:hover {
                background: #EF4135;
                transform: scale(1.05);
            }

/* Sidebar (vertical menu) */
#sidebar {
    position: fixed;
    top: 80px;
    left: 10px;
    width: 250px;
    min-width: 200px;
    max-width: 300px;
    height: calc(100vh - 90px);
    background: #263238;
    padding: 10px;
    border: 2px solid #EF4135;
    border-radius: 6px;
    z-index: 2001;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    resize: horizontal;
    pointer-events: auto;
}

    #sidebar::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 6px;
        background: #EF4135;
        cursor: ew-resize;
    }

    #sidebar:has(#mission-description-text) {
        overflow-y: visible; /* Assurer que la sidebar ne masque pas la poignée */
    }

    #sidebar .sidebar-section {
        display: flex;
        flex-direction: column;
        gap: 8px;
        background: #37474F;
        padding: 8px;
        border-radius: 4px;
        border: 1px solid #EF4135;
    }

        #sidebar .sidebar-section:has(#mission-description-text) {
            overflow: visible; /* Empêche le masquage de la poignée */
            min-height: auto; /* Permet au conteneur de s'adapter */
        }

        #sidebar .sidebar-section h3 {
            color: #EF4135;
            font-size: 16px;
            font-weight: 700;
            margin: 0 0 5px;
            text-transform: uppercase;
        }

        #sidebar .sidebar-section label {
            font-size: 13px;
            font-weight: 700;
            color: #B0BEC5;
            margin-bottom: 3px;
        }

        #sidebar .sidebar-section button,
        #sidebar .sidebar-section input[type="text"],
        #sidebar .sidebar-section input[type="file"] {
            background: #0055A4;
            color: #FFFFFF;
            border: 1px solid #EF4135;
            padding: 6px 10px;
            font-size: 14px;
            font-weight: 700;
            border-radius: 4px;
            cursor: pointer;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
            transition: background 0.2s, transform 0.2s;
            width: 100%;
        }

            #sidebar .sidebar-section button:hover,
            #sidebar .sidebar-section input[type="text"]:hover,
            #sidebar .sidebar-section input[type="file"]:hover {
                background: #EF4135;
                transform: scale(1.05);
            }

        #sidebar .sidebar-section textarea:not(#mission-description-text) {
            width: 100%;
            height: 80px;
            min-height: 50px;
            max-height: 150px;
            resize: vertical;
            background: #ECEFF1;
            color: #263238;
            border: 1px solid #EF4135;
            border-radius: 4px;
            padding: 6px;
            font-size: 13px;
        }

            #sidebar .sidebar-section textarea:not(#mission-description-text):hover,
            #sidebar .sidebar-section textarea:not(#mission-description-text):focus {
                border-color: #FFFFFF;
                box-shadow: 0 3px 8px rgba(239, 65, 53, 0.2);
            }

    #sidebar .custom-select {
        background: #0055A4;
        color: #FFFFFF;
        border: 1px solid #EF4135;
        padding: 6px;
        border-radius: 4px;
        cursor: pointer;
        font-size: 14px;
        font-weight: 700;
        width: 100%;
    }

    #sidebar .custom-select-selected {
        padding: 6px;
        border-radius: 4px;
    }

    #sidebar .custom-select-options {
        background: red !important; /* Couleur vive pour tester */
        z-index: 9999 !important; /* Assurer qu'il est au-dessus de tout */
        min-height: 120px !important; /* Forcer une hauteur visible */
        width: 200px !important; /* Forcer une largeur visible */
        opacity: 1 !important; /* Éviter une opacité nulle */
        border: 2px solid yellow !important; /* Bordure pour visualiser */
    }

    #sidebar .custom-select-option {
        padding: 6px 10px;
        color: #B0BEC5;
        font-size: 13px;
        cursor: pointer;
    }

        #sidebar .custom-select-option:hover,
        #sidebar .custom-select-option.selected {
            background: #EF4135;
            color: #FFFFFF;
        }

    #topbar .drag-handle,
    #sidebar .drag-handle {
        pointer-events: auto;
        cursor: move;
        user-select: none;
        z-index: 2002;
    }

/* Map container */
#map-container {
    position: fixed;
    top: 80px;
    left: 270px;
    right: 10px;
    bottom: 10px;
    z-index: 1;
}

#map {
    width: 100%;
    height: 100%;
    background: #37474F;
    border: 2px solid #EF4135;
    border-radius: 6px;
    z-index: 1;
}

.leaflet-container {
    z-index: 1;
    pointer-events: auto;
}

    .leaflet-container * {
        pointer-events: auto;
    }

/* Relief grid for 3D mode */
#relief-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

body:not(.no-3d) #relief-grid {
    display: block;
}

.relief-cell {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-sizing: border-box;
    background: transparent;
    transition: transform 0.3s ease;
}

    .relief-cell.flat {
        background: transparent;
    }

    .relief-cell.low {
        background: rgba(0, 85, 164, 0.1);
    }

    .relief-cell.medium {
        background: rgba(239, 65, 53, 0.25);
    }

    .relief-cell.high {
        background: rgba(255, 255, 255, 0.5);
    }

/* Tactical elements */
.military-symbol {
    overflow: visible;
}

.tactical-cross::before,
.tactical-cross::after {
    content: '';
    position: absolute;
    background: #EF4135;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.tactical-cross::before {
    width: 15px;
    height: 3px;
}

.tactical-cross::after {
    width: 3px;
    height: 15px;
}

#heatmap-opacity {
    width: 100px;
    vertical-align: middle;
}

#heatmap-opacity-value {
    margin-left: 5px;
    font-size: 13px;
    color: #B0BEC5;
}

/* Measurement styles */
.measure-point {
    width: 10px;
    height: 10px;
    background: #EF4135;
    border-radius: 50%;
    border: 1px solid #FFFFFF;
}

.measure-line {
    stroke: #0055A4;
    stroke-width: 2;
    stroke-dasharray: 4, 4;
}

.measure-label {
    color: #0055A4;
    font-size: 12px;
    background: #FFFFFF;
    padding: 3px 6px;
    border-radius: 3px;
    border: 1px solid #EF4135;
}

.no-3d #map {
    transform: none;
}

/* Leaflet popups */
.leaflet-popup-content-wrapper {
    background: #37474F;
    color: #B0BEC5;
    border: 2px solid #EF4135;
    border-radius: 6px;
    z-index: 2002;
    pointer-events: auto;
    opacity: 1;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
    padding: 8px;
}

.leaflet-popup-tip {
    background: #37474F;
    border-left: 2px solid #EF4135;
    border-right: 2px solid #EF4135;
    z-index: 2002;
}

.leaflet-popup-content select,
.leaflet-popup-content input {
    background: #0055A4;
    color: #FFFFFF;
    border: 1px solid #EF4135;
    padding: 5px;
    font-family: 'Roboto Condensed', Arial, sans-serif;
    font-size: 13px;
    font-weight: 700;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: background 0.2s;
}

    .leaflet-popup-content select:hover,
    .leaflet-popup-content input:hover {
        background: #EF4135;
    }

/* Restricted area form */
#restricted-area-form {
    position: fixed;
    top: 90px;
    right: 10px;
    background: #37474F;
    border: 2px solid #EF4135;
    padding: 10px;
    border-radius: 6px;
    z-index: 2000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

    #restricted-area-form h3 {
        color: #EF4135;
        font-size: 16px;
        font-weight: 700;
        margin-bottom: 5px;
    }

    #restricted-area-form label {
        display: block;
        font-size: 13px;
        font-weight: 600;
        color: #B0BEC5;
        margin-bottom: 3px;
    }

    #restricted-area-form select,
    #restricted-area-form input,
    #restricted-area-form button {
        width: 100%;
        background: #0055A4;
        color: #FFFFFF;
        border: 1px solid #EF4135;
        padding: 6px;
        margin-bottom: 5px;
        font-size: 13px;
        font-weight: 700;
        border-radius: 4px;
        cursor: pointer;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        transition: background 0.2s;
    }

        #restricted-area-form button:hover,
        #restricted-area-form select:hover,
        #restricted-area-form input:hover {
            background: #EF4135;
        }

/* Responsive adjustments */
@media (max-width: 768px) {
    #topbar {
        height: auto;
        min-height: 50px;
        padding: 4px;
    }

    #sidebar {
        width: 200px;
        min-width: 150px;
        top: 100px;
    }

    #map-container {
        left: 220px;
        top: 100px;
    }

    #topbar .topbar-section select,
    #topbar .topbar-section button,
    #topbar .topbar-section input[type="text"],
    #topbar .topbar-section input[type="file"] {
        font-size: 13px;
        padding: 5px 8px;
    }

    #sidebar .sidebar-section button,
    #sidebar .sidebar-section input[type="text"],
    #sidebar .sidebar-section input[type="file"] {
        font-size: 13px;
        padding: 5px 8px;
    }
}

#mission-description-text {
    width: 100%;
    min-width: 250px;
    height: 250px;
    min-height: 150px;
    max-height: 400px;
    resize: vertical !important;
    font-size: 16px;
    padding: 10px;
    box-sizing: border-box;
    background: #ECEFF1;
    color: #263238;
    border: 1px solid #EF4135;
    border-radius: 4px;
    z-index: 2002;
}

    #mission-description-text::-webkit-resizer {
        border: 2px solid #EF4135;
        background: #EF4135;
        width: 12px;
        height: 12px;
    }

    #mission-description-text:hover,
    #mission-description-text:focus {
        border-color: #FFFFFF;
        box-shadow: 0 3px 8px rgba(239, 65, 53, 0.2);
    }

@media (max-width: 480px) {
    #sidebar {
        width: 160px;
        min-width: 120px;
    }

    #map-container {
        left: 180px;
    }

    #topbar {
        left: 5px;
        right: 5px;
        padding: 3px;
    }

        #topbar .topbar-section select,
        #topbar .topbar-section button,
        #topbar .topbar-section input[type="text"],
        #topbar .topbar-section input[type="file"] {
            font-size: 12px;
            padding: 4px 6px;
        }

    #sidebar .sidebar-section button,
    #sidebar .sidebar-section input[type="text"],
    #sidebar .sidebar-section input[type="file"] {
        font-size: 12px;
        padding: 4px 6px;
    }
}

#sidebar .sidebar-section button#generate-description {
    background: #0055A4;
    color: #FFFFFF;
    border: 1px solid #EF4135;
    padding: 6px 10px;
    font-family: 'Roboto Condensed', Arial, sans-serif;
    font-size: 14px;
    font-weight: 700;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: background 0.2s, transform 0.2s;
    width: 100%;
    margin-top: 5px;
}

    #sidebar .sidebar-section button#generate-description:hover {
        background: #EF4135;
        transform: scale(1.05);
    }

#heatmap-type {
    background: #0055A4;
    color: #FFFFFF;
    border: 1px solid #EF4135;
    padding: 6px;
    font-family: 'Roboto Condensed', Arial, sans-serif;
    font-size: 14px;
    font-weight: 700;
    border-radius: 4px;
    cursor: pointer;
    width: 200px;
    transition: background 0.2s, transform 0.2s;
}

    #heatmap-type:hover {
        background: #EF4135;
        transform: scale(1.05);
    }