* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --date-accent-color: #038674;
    --accent-color-rgb: 3, 134, 116;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8f9fa;
    overflow: hidden;
}

#map {
    height: 100vh;
    width: 100%;
    border: none;
}

.date-filter {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    height: 60px;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
    border: none;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
}

.filter-container {
    max-width: none;
    width: calc(100% - 80px);
    margin: 0 auto;
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
}

.filter-title {
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 15px;
    text-align: center;
}

.date-range-container {
    position: relative;
    height: 40px;
    background: transparent;
    border-radius: 6px;
    margin: 0;
    padding: 10px;
    flex: 1;
    min-width: 120px;
}

.date-range-track {
    position: absolute;
    top: 50%;
    left: 30px;
    right: 30px;
    height: 12px;
    background: #e9ecef;
    border-radius: 6px;
    transform: translateY(-50%);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.date-range-selected {
    position: absolute;
    height: 12px;
    /* фон прозорий, щоб під ним було видно градієнт треку */
    background: rgba(0,0,0,0);
    border-radius: 6px;
    /* сині лінії зверху та знизу, що позначають межі вибраного діапазону */
    border-top: 2px solid var(--date-accent-color);
    border-bottom: 2px solid var(--date-accent-color);
    top: 0;
    /* залишаємо легку тінь, щоб вибір був помітним */
    box-shadow: 0 0 6px rgba(0,0,0,0.25) inset;
    transition: all 0.2s ease;
}

.date-handle {
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border: 3px solid var(--date-accent-color);
    border-radius: 50%;
    cursor: pointer;
    top: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 10;
}

.handle-tooltip {
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #34495e;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.date-handle:hover .handle-tooltip,
.date-handle.dragging .handle-tooltip {
    opacity: 1;
    visibility: visible;
}

.date-handle:hover {
    box-shadow: 0 4px 12px rgba(var(--accent-color-rgb), 0.4);
    transform: translate(-50%, -50%) scale(1.1);
}

.date-handle.dragging {
    box-shadow: 0 6px 16px rgba(var(--accent-color-rgb), 0.5);
    transform: translate(-50%, -50%) scale(1.2);
}

.year-marks {
    position: absolute;
    top: 50%;
    left: 30px;
    right: 30px;
    height: 12px;
    transform: translateY(-50%);
    pointer-events: none;
}

.year-mark {
    position: absolute;
    width: 2px;
    height: 16px;
    background: #6c757d;
    top: -2px;
    transform: translateX(-50%);
}

/* додаткові засічки між роками */
.year-submark {
    position: absolute;
    width: 1px;
    height: 10px;
    background: #1f605651;
    top: 1px;
    opacity: 0.7;
    transform: translateX(-50%);
}

.year-label {
    position: absolute;
    font-size: 10px;
    color: #6c757d;
    top: 20px;
    transform: translateX(-50%);
    white-space: nowrap;
}

.date-labels {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    font-size: 11px;
    color: #d8e6f5;          
    font-weight: 500;
    transform: translateY(-50%);
    pointer-events: none;
}

.date-labels span:first-child {
    position: absolute;
    left: 0;
    transform: translate(-100%, -50%);
    background-color: #445662e5;
    padding: 2px 6px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.date-labels span:last-child {
    position: absolute;
    right: 0;
    transform: translate(100%, -50%);
    background-color: #445662e5;
    padding: 2px 6px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.current-range {
    text-align: center;
    margin-top: 5px;
    font-size: 14px;
    font-weight: 500;
    color: #495057;
}

.points-counter {
    text-align: center;
    margin-top: 3px;
    font-size: 12px;
    color: #6c757d;
}

.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1000;
}

.custom-tooltip {
    background: rgba(255, 255, 255, 0.98) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    backdrop-filter: blur(10px);
    /* width: auto !important; */
    /* white-space: normal !important; */
}

.custom-tooltip .leaflet-tooltip-content {
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    max-width: 250px !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

.popup-content {
    padding: 12px;
}

.popup-date {
    font-size: 16px;
    font-weight: bold;
    color: var(--date-accent-color);
    margin-bottom: 8px;
}

.map-tooltip-date {
    color: var(--date-accent-color);
}

.custom-marker.selected-map-marker > div {
    box-shadow: 0 0 0 6px var(--date-accent-color), 0 2px 8px rgba(0,0,0,0.4) !important;
}

.popup-time {
    color: #7f8c8d;
    font-weight: normal;
}

.popup-location {
    font-size: 14px;
    color: #34495e;
    margin-bottom: 8px;
    font-weight: 500;
}

.popup-weapon,
.popup-casualties,
.popup-wounded,
.popup-damage {
    font-size: 12px;
    color: #495057;
    margin-bottom: 4px;
    line-height: 1.3;
}

.popup-damage {
    padding-top: 20px;
}
.popup-location,
.popup-weapon {
    padding-top: 10px;
}

.popup-casualties {
    color: #dc3545;
    font-weight: 600;
}

.popup-wounded {
    color: #fd7e14;
    font-weight: 600;
}

.popup-image {
    width: 100%;
    max-width: 280px;
    min-height: 100px;
    height: auto;
    margin-top: 10px;
    border-radius: 4px;
    cursor: pointer;
}

.popup-image-wrapper {
    position: relative;
    margin-top: 10px;
}

.popup-image-wrapper .popup-image {
    margin-top: 0;
    display: block;
}

.image-zoom-icon {
    position: absolute;
    bottom: 5px;
    left: 5px;
    font-size: 1.5em;
    color: white;
    text-shadow: 0 0 5px black;
    pointer-events: none;
    /* Hidden until the image finishes loading */
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* Once the image has fully loaded, reveal the icon */
.popup-image.loaded + .image-zoom-icon {
    opacity: 1;
}

.image-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    pointer-events: none;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-preview-overlay.visible {
    opacity: 1;
}

.image-preview-overlay img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    box-shadow: 0 0 35px rgba(0,0,0,0.5);
    border-radius: 8px;
}

.marker-cluster {
    background: rgba(220, 53, 69, 0.8);
    border: 2px solid rgba(220, 53, 69, 1);
    border-radius: 50%;
    color: white;
    font-weight: bold;
    text-align: center;
    font-size: 12px;
}

.error-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #dc3545;
    color: white;
    padding: 15px;
    border-radius: 4px;
    z-index: 1000;
    max-width: 300px;
}

.legend {
    /* Hide the legend block completely */
    display: none !important;
}

.info-panel {
    position: fixed;
    bottom: 90px;
    left: 62px;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
    padding: 12px 16px;
    border-radius: 8px;
    z-index: 1000;
    min-width: 200px;
    min-height: 62px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.info-title {
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 5px;
    color: #495057;
}

.info-details {
    font-size: 12px;
    color: #6c757d;
    line-height: 1.4;
}

.reset-zoom-btn {
    position: fixed;
    left: 20px;
    top: 280px;
    z-index: 1000;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.85);
    padding: 4px;
    border: 2px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    width: 32px;
    height: 32px;
}

.reset-zoom-btn img {
    display: block;
}

.filters-panel {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    transition: all 0.3s ease;
}

.details-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 300px;
    bottom: 162px;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 999;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
}

.details-placeholder {
    margin: auto;
    text-align: center;
    color: #6c757d;
    font-size: 14px;
}

.details-empty-state {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 100%;
}

.details-empty-content {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.details-empty-state .details-placeholder {
    margin: 0;
    text-align: left;
    color: #44505d;
    font-size: 13px;
    font-weight: 600;
}

.empty-note {
    font-size: 11px;
    color: #8a5a00;
    background: rgba(255, 243, 205, 0.7);
    border-radius: 6px;
    padding: 6px 8px;
}

.empty-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.empty-stat-card {
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(140, 155, 170, 0.25);
    border-radius: 8px;
    padding: 8px;
}

.empty-stat-card-dates {
    min-width: 0;
}

.empty-stat-card-dates .empty-stat-value {
    font-size: 12px;
    line-height: 1.25;
}

.empty-stat-label {
    font-size: 10px;
    color: #6c757d;
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.empty-stat-value {
    font-size: 16px;
    font-weight: 700;
    color: #2f3b45;
    line-height: 1.1;
}

.empty-stat-subvalue {
    font-size: 10px;
    color: #6c757d;
    margin-top: 2px;
}

.empty-chart-block {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(140, 155, 170, 0.2);
    border-radius: 8px;
    padding: 8px;
}

.empty-chart-title {
    font-size: 11px;
    color: #425466;
    margin-bottom: 8px;
    font-weight: 600;
}

.empty-stacked-bar {
    display: flex;
    width: 100%;
    height: 10px;
    border-radius: 99px;
    overflow: hidden;
    background: rgba(222, 226, 230, 0.7);
    margin-bottom: 8px;
}

.empty-stacked-segment {
    height: 100%;
}

.empty-stacked-segment-empty {
    width: 100%;
    background: rgba(173, 181, 189, 0.5);
}

.empty-legend {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.empty-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    color: #495057;
    white-space: nowrap;
}

.empty-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: 0 0 auto;
}

.empty-bar-row {
    margin-bottom: 8px;
}

.empty-bar-row:last-child {
    margin-bottom: 0;
}

.empty-bar-header {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #495057;
    margin-bottom: 3px;
}

.empty-bar-track {
    width: 100%;
    height: 8px;
    background: rgba(222, 226, 230, 0.75);
    border-radius: 99px;
    overflow: hidden;
}

.empty-bar-fill {
    height: 100%;
    border-radius: 99px;
}

.empty-time-inline {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.empty-time-head,
.empty-time-values {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #495057;
}

.empty-time-head {
    font-weight: 600;
}

.empty-time-values {
    font-size: 12px;
    color: #2f3b45;
}

.empty-time-bars {
    display: flex;
    gap: 8px;
}

.empty-time-joined {
    width: 100%;
    height: 8px;
    background: rgba(222, 226, 230, 0.75);
    border-radius: 99px;
    overflow: hidden;
    display: flex;
}

.empty-time-fill {
    height: 100%;
    flex: 0 0 auto;
}

.empty-time-fill-night {
    border-top-left-radius: 99px;
    border-bottom-left-radius: 99px;
}

.empty-time-fill-day {
    border-top-right-radius: 99px;
    border-bottom-right-radius: 99px;
}

.filter-group {
    margin-bottom: 15px;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-size: 12px;
    margin-bottom: 3px;
    color: #333;
}

.filter-group select,
.filter-group input {
    padding: 5px;

    border-radius: 3px;
    border: 1px solid #ccc;
    font-size: 14px;
}

.filter-group input {
    width: 60px;
}

.button-group {
    display: flex;
}

.button-group button {
    padding: 5px 10px;
    border: 1px solid #ccc;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    border-radius: 0;
}

.button-group button:not(:first-child) {
    border-left: none;
}

.button-group button:first-child {
    border-top-left-radius: 3px;
    border-bottom-left-radius: 3px;
}

.button-group button:last-child {
    border-top-right-radius: 3px;
    border-bottom-right-radius: 3px;
}

.button-group button img {
    height: 20px;
    vertical-align: middle;
}

.button-group button.active {
    background: var(--date-accent-color);
    color: white;
    border-color: var(--date-accent-color);
}

.filter-group-row {
    display: flex;
    gap: 10px;
}

.input-with-reset {
    display: flex;
    align-items: center;
}

.input-with-reset input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    color: var(--date-accent-color);
    border-color: rgba(var(--accent-color-rgb), 0.45);
}

.input-with-reset input:focus {
    outline: none;
    border-color: var(--date-accent-color);
    box-shadow: 0 0 0 2px rgba(var(--accent-color-rgb), 0.2);
}

.reset-btn {
    padding: 5px;
    border: 1px solid #ccc;
    border-left: none;
    background: #f0f0f0;
    cursor: pointer;
    border-top-right-radius: 3px;
    border-bottom-right-radius: 3px;
    font-size: 14px;
    line-height: 1;
    color: #555;
}

.reset-btn:hover {
    background: #e0e0e0;
}

/* Auto-zoom checkbox styling */
.auto-zoom-group {
    margin: 2px -10px 0 -10px;
    padding: 12px 10px 0 10px;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: center;
}

#autoZoomFilter {
    width: 26px;
    accent-color: var(--date-accent-color);
}

.auto-zoom-label {
    display: flex;
    
    gap: 4px;
    cursor: pointer;
    font-size: 12px;
    color: #333;
    user-select: none;
}

.auto-zoom-label input[type="checkbox"] {
    margin: 0;
    padding: 0;
    cursor: pointer;
    transform: scale(0.9);
}

.mobile-message {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 80%;
    z-index: 60606;
}

.mobile-message p {
    margin-bottom: 10px;
    font-size: 16px;
    color: #495057;
}

.date-labels #maxDateLabel {
    float: right;
}

.disclaimer {
    position: fixed;
    text-align: left;
    right: 20px;
    width: 300px;
    bottom: 90px;
    background-color: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
    color: #c6c6c6;
    padding: 12px 16px;
    min-height: 62px;
    font-size: 11px;
    border-radius: 8px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0;
    line-height: 1.4;
}

.disclaimer a {
    color: #c6c6c6;
    text-decoration: none;
}

@media (min-width: 768px) {
    .leaflet-bottom.leaflet-left .leaflet-control-zoom {
        margin-bottom: 92px;
        margin-left: 20px;
    }
}

.disclaimer-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    margin-top: 5px;
}

.refresh-data-btn {
    border: 1px solid rgba(198, 198, 198, 0.28);
    background: rgba(255, 255, 255, 0.16);
    color: rgba(198, 198, 198, 0.92);
    font-size: 9px;
    font-weight: 500;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.85;
    transition: background 0.2s ease, color 0.2s ease, opacity 0.2s ease, border-color 0.2s ease;
}

.refresh-data-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(198, 198, 198, 0.38);
    color: rgba(198, 198, 198, 1);
    opacity: 1;
}

.refresh-data-btn:disabled {
    opacity: 0.55;
    cursor: wait;
}

/* Hide mobile-only UI on desktop by default */
.mobile-nav,
.mobile-topbar,
#mobileDatePickers,
#mobileFiltersSummary { display: none; }

/* мітки з датами по краях */
.date-label {
    font-size: 11px;
    color: #d8e6f5;
    font-weight: 500;
    background-color: #445662e5;
    padding: 2px 6px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    white-space: nowrap;
    cursor: pointer;
}

/* прибрали символ «<>» у ползунках */
.date-handle::after {
    content: "";
}
