/* ============================================
   FSVA Atlas - Global Theme
   ============================================ */

:root {
    --primary-color: #2c7da0;
    --primary-dark: #1f5f7e;
    --secondary-color: #61a5c2;
    --success-color: #2ecc71;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --dark-color: #2c3e50;
    --light-color: #f8f9fa;
    --gray-color: #6c757d;
    --border-color: #dee2e6;
    
    --priority-1: #8B0000;
    --priority-2: #D32F2F;
    --priority-3: #F4A261;
    --priority-4: #E9C46A;
    --priority-5: #6A994E;
    --priority-6: #2C6E49;
    --no-data: #CCCCCC;
    
    --navbar-bg: #f8f9fa;
    --navbar-bg-rgb: 248, 249, 250;
    --navbar-text: #404040;
}

/* Base Layout */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-color);
}

/* Map */
#map {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    cursor: grab;
    background: #e9ecef;
}

#map:active {
    cursor: grabbing;
}

/* OpenLayers Controls */
.ol-control {
    position: absolute;
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.ol-control button {
    background-color: white;
    color: var(--primary-color);
    cursor: pointer;
}

.ol-control button:hover {
    background-color: var(--primary-color);
    color: white;
}

.ol-zoom {
    margin-top: 80px;
    left: 20px;
}

.ol-scale-line, .ol-scale-bar {
    position: fixed;
    bottom: 140px;
    left: 20px;
    padding: 4px 8px;
    font-family: monospace;
    font-size: 12px;
    pointer-events: none;
    z-index: 100;
}

.ol-zoom-extent {
    top: 150px;
    left: 20px;
}

.ol-zoom-extent button {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
}

/* Map Title Overlay */
.ol-title-control {
    position: absolute;
    bottom: 70px;
    left: 20px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    padding: 8px 16px;
    pointer-events: none;
}

.ol-title-control h2 {
    margin: 0 0 4px 0;
    font-size: 21pt;
    font-weight: 500;
    color: white;
    white-space: nowrap;
}

.ol-title-control .logo-map {
    margin-right: 20px;
    height: 21pt;
    width: auto;
}

/* Top Navbar */
#top-navbar-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.navbar-top-content {
    background: rgba(var(--navbar-bg-rgb), 0.55);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Bottom Navbar */
#bottom-navbar-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.navbar-bottom-content {
    background: rgba(var(--navbar-bg-rgb), 0.55);
    backdrop-filter: blur(5px);
    border-top: 1px solid var(--border-color);
    padding: 6px 20px;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.05);
}

/* Navbar Layout */
.navbar-container {
    max-width: 1396px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 15px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--navbar-text);
    font-weight: 600;
}

.navbar-brand img,
.logo-top {
    height: 32px;
    width: auto;
    display: block;
}

.navbar-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.navbar-buttons-right {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-left: auto;
}

.btn-navbar {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 6px 16px;
    border-radius: 6px;
    font-weight: 500;
    color: var(--navbar-text);
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-navbar:hover {
    background: var(--light-color);
    border-color: var(--primary-color);
}

.btn-navbar-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.btn-navbar-primary:hover {
    background: var(--primary-dark);
}

/* Bottom Navbar Specific */
.level-badge {
    background: var(--primary-color);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
    color: var(--light-color);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.year-selector {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.year-selector label {
    margin: 0;
    color: var(--gray-color);
}

.year-dropdown {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: white;
}

.info-text {
    color: var(--gray-color);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Dropdown Menu */
.dropdown-menu {
    padding: 8px 0;
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    margin-top: 8px;
    min-width: 280px;
    max-width: 450px;
}

/*
.dropdown-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 12px;
    transition: all 0.2s;
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.4;
}

.dropdown-item i {
    width: 24px;
    flex-shrink: 0;
    text-align: center;
    margin-top: 2px;
}
*/

/* Icon styling - only for indicators dropdown */
#indicatorsDropdownMenu .dropdown-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 12px;
}

#indicatorsDropdownMenu .dropdown-item i {
    width: 24px;
    flex-shrink: 0;
    text-align: center;
    margin-top: 2px;
}

/* Regular dropdown items (like Peta FSVA menu) - normal bullet style */
.dropdown-item {
    display: block;
    padding: 8px 16px;
    white-space: normal;
}

.dropdown-item i {
    display: none; /* Hide icons in regular dropdowns */
}

/* If you want icons in regular dropdowns but not as flex, use inline */
.dropdown-item i {
    display: inline-block;
    width: auto;
    margin-right: 8px;
}

.dropdown-item:hover {
    background-color: var(--light-color);
}

/* Multi-level Dropdown */
.dropdown-submenu {
    position: relative;
}

.dropdown-submenu .submenu {
    position: absolute;
    top: 0;
    left: 100%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    z-index: 1100;
    min-width: 280px;
    max-width: 450px;
    display: none;
}

.dropdown-submenu .submenu.show {
    display: block;
}

.dropdown-submenu .submenu-header {
    padding: 8px 16px;
    font-weight: 600;
    color: var(--dark-color);
    background-color: var(--light-color);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 4px;
}

.dropdown-submenu .submenu-item {
    display: block;
    padding: 8px 16px;
    padding-left: 32px;
    color: var(--navbar-text);
    text-decoration: none;
    transition: background 0.2s;
}

.dropdown-submenu .submenu-item:hover {
    background-color: var(--light-color);
    color: var(--primary-color);
}

.dropdown-submenu .submenu-arrow {
    float: right;
    padding-left: 20px;
    font-size: 16px;
    color: var(--gray-color);
}

.dropdown-submenu:hover .submenu-arrow {
    color: var(--primary-color);
}

.dropdown-toggle::after {
    margin-left: 6px;
}

/* Remove arrow from submenu toggles */
.dropdown-submenu > .dropdown-toggle::after {
    display: none;
}

/* Legend Card */
.legend-card {
    position: fixed;
    bottom: 70px;
    right: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    width: 260px;
    z-index: 1001;
    overflow: hidden;
}

.legend-header {
    background: var(--dark-color);
    color: white;
    padding: 12px 15px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.legend-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
}

.legend-body {
    padding: 12px 15px;
    max-height: 400px;
    overflow-y: auto;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 12px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
}

.legend-color.priority-1 { background-color: var(--priority-1); }
.legend-color.priority-2 { background-color: var(--priority-2); }
.legend-color.priority-3 { background-color: var(--priority-3); }
.legend-color.priority-4 { background-color: var(--priority-4); }
.legend-color.priority-5 { background-color: var(--priority-5); }
.legend-color.priority-6 { background-color: var(--priority-6); }
.legend-color.no-data { background-color: var(--no-data); }

/* Summary Card */
.summary-card {
    position: fixed;
    top: 80px;
    left: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 12px 20px;
    min-width: 220px;
    z-index: 1001;
    cursor: pointer;
    transition: transform 0.2s;
}

.summary-card:hover {
    transform: translateY(-2px);
}

.summary-value {
    font-size: 28px;
    font-weight: bold;
    color: var(--primary-color);
    line-height: 1.2;
}

.summary-label {
    font-size: 12px;
    color: var(--gray-color);
    margin-top: 4px;
}

.summary-sub {
    font-size: 11px;
    color: #adb5bd;
    margin-top: 6px;
}

/* Modal Styles */
.modal-content {
    border: none;
    border-radius: 16px;
    overflow: hidden;
}

.modal-header {
    border-bottom: none;
    padding: 1rem 1.5rem;
}

.modal-footer {
    border-top: none;
    padding: 1rem 1.5rem;
}

.level-option {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    margin: 10px 0;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.level-option:hover {
    background: var(--light-color);
    border-color: var(--primary-color);
}

.level-option h6 {
    margin: 0 0 4px 0;
    font-weight: 600;
}

.level-option small {
    color: var(--gray-color);
    font-size: 12px;
}

/* Tables */
.table-responsive {
    border-radius: 12px;
    overflow: hidden;
}

.table thead th {
    background-color: var(--dark-color);
    color: white;
    border: none;
    padding: 12px;
    font-weight: 500;
}

.table tbody tr:hover {
    background-color: rgba(44, 125, 160, 0.05);
}

/* Loading Spinner */
.loading-spinner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--gray-color);
}

.loading-spinner::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 992px) {
    .navbar-brand span { display: none; }
    .btn-navbar span { display: none; }
    .btn-navbar i { margin: 0; }
}

@media (max-width: 768px) {
    .navbar-top-content { padding: 6px 12px; }
    .navbar-bottom-content { padding: 4px 12px; }
    .summary-card { top: 70px; left: 10px; padding: 8px 15px; min-width: 160px; }
    .summary-value { font-size: 20px; }
    .legend-card { bottom: 70px; right: 10px; width: 220px; }
    .dropdown-menu { max-width: 90vw; }
    .dropdown-submenu .submenu { max-width: 85vw; left: auto; right: 0; }
}

@media (max-width: 480px) {
    .btn-navbar span { display: none; }
    .btn-navbar i { margin: 0; }
    .year-selector label { display: none; }
}