/* ============================================
   FSVA Atlas - Global Theme
   ============================================ */

:root {
    /* --primary-color: #2c7da0; */
	--primary-color: #1e7816; 
    --primary-dark: #12470d;
	--primary-light: #2fba22;
    --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: #F6F6F2;
    --navbar-bg-rgb: 246, 246, 242;
    --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: 190px;
    left: 20px;
}

.ol-zoom-extent button {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
}

/* Chart container styles */
#charts-container .card {
    transition: all 0.3s ease;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#charts-container .card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

#charts-container .card-header {
    font-weight: 600;
    border-bottom: 2px solid #e9ecef;
}

.toggle-chart-type {
    transition: all 0.2s ease;
}

.toggle-chart-type:hover {
    transform: scale(1.05);
}

/* Tab styles */
.nav-tabs .nav-link {
    color: #495057;
    font-weight: 500;
    border: none;
    border-bottom: 2px solid transparent;
}

.nav-tabs .nav-link.active {
    color: #007bff;
    border-bottom: 2px solid #007bff;
    background: transparent;
}

.nav-tabs .nav-link:hover {
    border-bottom: 2px solid #007bff;
    isolation: isolate;
}

/* Scrollbar for charts container */
#charts-container {
    scrollbar-width: thin;
}

#charts-container::-webkit-scrollbar {
    width: 6px;
}

#charts-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#charts-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

/* Export Button */
.ol-export {
    top: 160px;
    left: 20px;
}

.ol-export button {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
	font-weight: 1200;
}

/* Map Title Overlay */
.ol-title-control {
    position: absolute;
    bottom: 70px;
    left: 20px;
	background: rgba(var(--navbar-bg-rgb),0.5);
	backdrop-filter: blur(8px);
    /* 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: 18pt;
    font-weight: 500;
    color: var(--primary-dark);
    white-space: nowrap;
}

.ol-title-control h2 .map-subtitle {
    font-size: 12pt;    
    color: var(--primary-dark);
	font-style: italic;
    white-space: nowrap;
}

.ol-title-control .logo-map {
    margin-right: 10px;
	margin-top: 10px;
    height: 28pt;
    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.75);
    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.75);
    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(--primary-color);
	border-color: rgba(var(--primary-light),1); 
	color: var(--light-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 {
    background-color: var(--navbar-bg);
    padding: 8px 0;
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    margin-top: 8px;
    min-width: 320px;
    max-width: 450px;
}

/* 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: inline-block;
    width: auto;
    margin-right: 8px;
}

.dropdown-item:hover {
    background-color: var(--primary-light);
	color: var(--light-color);
}

/* ===== FIXED: Active indicator styling (GREEN THEME) ===== */
#indicatorsDropdownMenu .dropdown-item.active {
    background-color: var(--primary-color) !important;
    color: white !important;
}

#indicatorsDropdownMenu .dropdown-item.active i {
    color: white !important;
}

.dropdown-submenu .submenu-item.active {
    background-color: var(--primary-color) !important;
    color: white !important;
}
/* ======================================================== */

/* Multi-level Dropdown */
.dropdown-submenu {
    position: relative;
}

.dropdown-submenu .submenu {
    position: absolute;
    top: -20px;
    left: 96%;
    background: var(--navbar-bg);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    z-index: 1100;
    min-width: 320px;
    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;
}

/* FSVA Legacy Button - Green Border Highlight */
.btn-navbar.btn-fsva-legacy {
    border: 2px solid #28a745;
    background-color: transparent;
    /* color: #28a745; */
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-navbar.btn-fsva-legacy:hover {
    background-color: #28a745;
    color: white;
}

.btn-navbar.btn-fsva-legacy:hover i {
    color: white;
}

.btn-navbar.btn-fsva-legacy i {
    color: #28a745;
    transition: color 0.3s ease;
}

/* 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;
}


#previewTableContainer .table td,
#previewTableContainer .table th {
    vertical-align: middle;
}

#previewTableContainer .badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

#upload-dataModal .modal-dialog {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

#upload-dataModal .modal-content {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

#upload-dataModal .modal-body {
    flex: 1;
    overflow: visible;
}

#previewTableContainer {
    overflow: auto;
    height: 450px;
    width: 100%;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

/* ============================================
   MODAL STYLES
   ============================================ */

/* Modal Container */
.modal-content {
    background: var(--navbar-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
}

.modal-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 0.7rem 1.5rem;
}

.modal-footer {
    background: transparent;
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}

.modal-body {
    background: transparent;
}

.modal-title {
    font-size: 12pt;
}
/* Cards inside modals */
.modal .card {
    background: var(--navbar-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 1rem;
}

.modal .card:last-child {
    margin-bottom: 0;
}

.modal .card-header {
    background: rgba(30, 120, 22, 0.08);
    border-bottom: 1px solid var(--border-color);
    color: var(--primary-color);
    font-weight: 600;
    padding: 0.75rem 1rem;
}

.modal .card-header.bg-info {
    background-color: var(--primary-color) !important;
    color: white;
}

.modal .card-header.bg-primary {
    background-color: var(--primary-color) !important;
    color: white;
}

.modal .card-header.bg-secondary {
    background-color: #ECBD33 !important;
    color: #2c3e50 !important;
}

.modal .card-body {
    padding: 1rem;
}

/* Modal Buttons */
.modal .btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.modal .btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.modal .btn-secondary {
    background-color: #ECBD33;
    border-color: #ECBD33;
    color: #2c3e50;
}

.modal .btn-secondary:hover {
    background-color: #d4a82c;
    border-color: #d4a82c;
    color: #2c3e50;
}

.modal .btn-danger {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
    color: white;
}

.modal .btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.modal .btn-success {
    background-color: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.modal .btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

.modal .btn-info {
    background-color: var(--primary-light);
    border-color: var(--primary-light);
    color: white;
}

.modal .btn-info:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Close button */
.modal .btn-close {
    background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23404040'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e") center/0.7em auto no-repeat;
    opacity: 0.7;
    width: 0.7em;
    height: 0.7em;
}

.modal .btn-close:hover {
    opacity: 1;
}

/* Form elements inside modals */
.modal .form-control,
.modal .form-select {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: white;
    padding: 0.5rem 0.75rem;
}

.modal .form-control:focus,
.modal .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(30, 120, 22, 0.25);
    outline: none;
}

.modal .form-label {
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--navbar-text);
}

/* Level options */
.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;
    background: white;
}

.level-option:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: white;
}

.level-option h6 {
    margin: 0 0 4px 0;
    font-weight: 600;
}

.level-option small {
    color: var(--gray-color);
    font-size: 12px;
}

.level-option:hover small {
    color: white;
}

/* Progress bar in modals */
.modal .progress {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
}

.modal .progress-bar {
    background-color: var(--primary-color);
    border-radius: 4px;
}

/* Alert boxes in modals */
.modal .alert-success {
    background-color: rgba(30, 120, 22, 0.1);
    border-color: var(--primary-color);
    color: var(--primary-dark);
    border-radius: 8px;
}

.modal .alert-danger {
    background-color: rgba(231, 76, 60, 0.1);
    border-color: var(--danger-color);
    color: var(--danger-color);
    border-radius: 8px;
}

.modal .alert-warning {
    background-color: rgba(236, 189, 51, 0.1);
    border-color: #ECBD33;
    color: #856404;
    border-radius: 8px;
}

.modal .alert-info {
    background-color: rgba(47, 186, 34, 0.1);
    border-color: var(--primary-light);
    color: var(--primary-color);
    border-radius: 8px;
}

/* Table inside modals */
.modal .table {
    margin-bottom: 0;
}

.modal .table thead th {
    background-color: var(--dark-color);
    color: white;
    border: none;
    padding: 10px 12px;
    font-weight: 500;
}

.modal .table tbody td {
    padding: 8px 12px;
    vertical-align: middle;
}

.modal .table tbody tr:hover {
    background-color: rgba(30, 120, 22, 0.05);
}

/* Scrollable content inside modals */
.modal-body .table-responsive {
    max-height: 400px;
    overflow-y: auto;
}

/* Custom file input styling */
.modal input[type="file"] {
    padding: 0.375rem 0.75rem;
}

.modal input[type="file"]::file-selector-button {
    background-color: var(--primary-color);
    border: none;
    border-radius: 4px;
    padding: 0.25rem 0.75rem;
    margin-right: 0.75rem;
    color: white;
    cursor: pointer;
}

.modal input[type="file"]::file-selector-button:hover {
    background-color: var(--primary-dark);
}

/* 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; }
}