/* Global Styles */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

.h-100 {
    height: 100vh !important;
}

/* Sidebar Styles */
.sidebar {
    background-color: var(--bs-dark);
    border-right: 1px solid var(--bs-border-color);
    height: 100vh;
    overflow-y: auto;
    position: relative;
}

.sidebar h4 {
    color: var(--bs-warning);
    border-bottom: 1px solid var(--bs-border-color);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}

.sidebar h6 {
    color: var(--bs-light);
    text-transform: uppercase;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Main Content */
.main-content {
    padding: 0;
    height: 100vh;
    position: relative;
}

/* Map Container */
.map-container {
    position: relative;
    width: 100%;
    height: 100%;
}

#map {
    height: 100%;
    width: 100%;
    z-index: 1;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    color: white;
}

/* Custom Map Markers */
.custom-marker {
    background: none;
    border: none;
}

/* Alert List Styles */
.alert-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    background-color: var(--bs-body-bg);
}

.alert-list-item {
    padding: 0.5rem;
    border-bottom: 1px solid var(--bs-border-color);
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 0.875rem;
}

.alert-list-item:hover {
    background-color: var(--bs-secondary-bg);
}

.alert-list-item:last-child {
    border-bottom: none;
}

.alert-list-item .alert-header {
    display: flex;
    align-items: center;
    margin-bottom: 0.25rem;
}

.alert-list-item .alert-meta {
    font-size: 0.75rem;
    color: var(--bs-text-muted);
    line-height: 1.2;
}

.alert-list-item .alert-description {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.alert-list-empty {
    padding: 1rem;
    text-align: center;
    color: var(--bs-text-muted);
    font-size: 0.875rem;
}

/* Zoom Out Button */
.zoom-out-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: rgba(33, 37, 41, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.zoom-out-btn:hover {
    background: rgba(33, 37, 41, 1);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.marker-inner {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: bold;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.marker-inner:hover {
    transform: scale(1.1);
}

/* NAPSG Icon Marker Styling */
.marker-inner.napsg-marker {
    /* Override font awesome icon styles when using NAPSG icons */
    font-size: 0; /* Hide any text content */
    /* Background image is set inline via JavaScript */
    background-size: 27px 27px !important;
    background-repeat: no-repeat !important;
    background-position: center calc(50% - 2px) !important;
}

.marker-inner.napsg-marker i {
    /* Hide any font awesome icons when NAPSG is active */
    display: none;
}

/* Legend Styles */
.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Status Panel */
.status-panel {
    background-color: var(--bs-gray-800);
    border-radius: 0.375rem;
    padding: 1rem;
    border: 1px solid var(--bs-border-color);
}

.status-panel h6 {
    margin-bottom: 0.5rem;
    color: var(--bs-light);
}

/* Alert Popup Styles */
.alert-popup {
    max-width: 300px;
}

.alert-popup h6 {
    color: var(--bs-primary);
    margin-bottom: 0.5rem;
}

.alert-popup p {
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

/* Custom Tooltip Styling (for hover) */
.custom-tooltip {
    background: var(--bs-dark) !important;
    border: 1px solid var(--bs-gray-600) !important;
    border-radius: 6px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    color: var(--bs-light) !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
    max-width: 250px !important;
}

.custom-tooltip::before {
    border-top-color: var(--bs-dark) !important;
}

/* Custom Popup Styling (for persistent display) */
.custom-popup .leaflet-popup-content-wrapper {
    background: var(--bs-dark) !important;
    border: 1px solid var(--bs-gray-600) !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
    color: var(--bs-light) !important;
    padding: 0 !important;
    max-width: 320px !important;
    min-width: 280px !important;
}

.custom-popup .leaflet-popup-tip {
    background: var(--bs-dark) !important;
    border: 1px solid var(--bs-gray-600) !important;
}

.tooltip-content {
    padding: 16px;
    background: var(--bs-dark);
    border-radius: 8px;
    position: relative;
}

.tooltip-content .badge {
    font-size: 11px;
    padding: 4px 8px;
}

.tooltip-content .btn {
    font-size: 12px;
    padding: 4px 12px;
}

/* Modal Customizations */
.modal-content {
    background-color: var(--bs-dark);
    border: 1px solid var(--bs-border-color);
}

.modal-header {
    border-bottom: 1px solid var(--bs-border-color);
}

.modal-footer {
    border-top: 1px solid var(--bs-border-color);
}

.alert-details .row {
    border-bottom: 1px solid var(--bs-border-color-translucent);
    padding-bottom: 0.5rem;
}

.alert-details .row:last-child {
    border-bottom: none;
}

/* Form Controls */
.form-range::-webkit-slider-thumb {
    background-color: var(--bs-primary);
}

.form-range::-moz-range-thumb {
    background-color: var(--bs-primary);
    border: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        height: auto;
        position: relative;
    }
    
    .main-content {
        height: 70vh;
    }
    
    .row.h-100 {
        height: auto !important;
    }
    
    .container-fluid.h-100 {
        height: auto !important;
    }
}

@media (max-width: 576px) {
    .sidebar .p-3 {
        padding: 1rem !important;
    }
    
    .sidebar h4 {
        font-size: 1.1rem;
    }
    
    .main-content {
        height: 60vh;
    }
}

/* Leaflet Popup Customizations */
.leaflet-popup-content-wrapper {
    background-color: var(--bs-dark);
    color: var(--bs-light);
    border: 1px solid var(--bs-border-color);
}

.leaflet-popup-tip {
    background-color: var(--bs-dark);
    border: 1px solid var(--bs-border-color);
}

/* Loading Animation */
@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
    }
}

.loading-overlay .spinner-border {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Accessibility Improvements */
.btn:focus,
.form-control:focus,
.form-select:focus,
.form-range:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Print Styles */
@media print {
    .sidebar {
        display: none;
    }
    
    .main-content {
        width: 100% !important;
        height: 100vh;
    }
}

/* Hide the Ukrainian flag in Leaflet attribution */
.leaflet-control-attribution a[href*="donate"] {
    display: none !important;
}

/* Additional selector to hide the flag span element */
.leaflet-control-attribution span[title*="flag"] {
    display: none !important;
}

/* Hide any element with the Ukrainian flag emoji or similar */
.leaflet-control-attribution {
    font-size: 0 !important;
}

.leaflet-control-attribution:after {
    content: "© OpenStreetMap contributors" !important;
    font-size: 11px !important;
    color: rgba(0, 0, 0, 0.75) !important;
}

/* Timezone Selector Styles */
.timezone-selector {
    position: relative;
}

.current-time-display {
    background-color: var(--bs-gray-800);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    color: var(--bs-light);
}

.current-time-display:hover {
    background-color: var(--bs-gray-700);
    border-color: var(--bs-primary);
}

.timezone-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--bs-dark);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    max-height: 300px;
    overflow: hidden;
}

.timezone-selector:hover .timezone-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}


.timezone-list {
    max-height: 250px;
    overflow-y: auto;
}

.timezone-option {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--bs-border-color-translucent);
    transition: background-color 0.15s ease;
    color: var(--bs-light);
}

.timezone-option:hover {
    background-color: var(--bs-primary);
    color: white;
}

.timezone-option.selected {
    background-color: var(--bs-primary);
    color: white;
    font-weight: 500;
}

.timezone-option:last-child {
    border-bottom: none;
}

.timezone-option .timezone-name {
    display: block;
    font-weight: 500;
}

.timezone-option .timezone-offset {
    display: block;
    font-size: 0.75rem;
    opacity: 0.8;
}
