/**
 * Map View Styles
 */

.ws-record-map-container {
    position: relative;
    width: 100%;
    min-height: 600px;
    background-color: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#record-map {
    width: 100%;
    height: 600px;
}

/* Custom Marker Styles */
.custom-marker {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.custom-marker:hover {
    transform: scale(1.2);
    z-index: 1;
}

/* Popup Styles */
.marker-popup {
    padding: 10px;
    min-width: 200px;
    max-width: 300px;
}

.marker-popup .marker-title {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.marker-popup .marker-type {
    margin: 5px 0;
    font-size: 13px;
    color: #666;
}

.marker-popup .marker-description {
    margin: 10px 0;
    font-size: 13px;
    color: #555;
    line-height: 1.5;
}

.marker-popup .marker-link {
    display: inline-block;
    margin-top: 10px;
    padding: 6px 12px;
    background-color: #4ecdc4;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    transition: background-color 0.2s ease;
}

.marker-popup .marker-link:hover {
    background-color: #45b7d1;
}

/* Legend Styles */
.map-legend {
    position: absolute;
    bottom: 30px;
    left: 10px;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 180px;
    max-width: 220px;
}

.map-legend h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: bold;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
}

.legend-item:last-of-type {
    margin-bottom: 12px;
}

.legend-color {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.legend-label {
    color: #333;
    font-weight: 500;
    flex-grow: 1;
}

.legend-count {
    color: #999;
    font-size: 12px;
    margin-left: 4px;
}

.legend-total {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e0e0e0;
    font-size: 13px;
    color: #666;
}

/* Mapbox GL Controls Customization */
.mapboxgl-ctrl-group {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

.mapboxgl-popup-content {
    padding: 0;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.mapboxgl-popup-close-button {
    font-size: 20px;
    padding: 8px;
    color: #999;
}

.mapboxgl-popup-close-button:hover {
    background-color: #f0f0f0;
    color: #333;
}

/* Loading State */
.ws-record-map-container.loading {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ws-record-map-container.loading::before {
    content: 'Loading map...';
    font-size: 16px;
    color: #666;
}

/* No Data State */
.ws-record-map-container .ws-no-data {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    font-size: 18px;
    color: #999;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .ws-record-map-container {
        min-height: 400px;
    }

    #record-map {
        height: 400px;
    }

    .custom-marker {
        width: 24px;
        height: 24px;
        border: 2px solid white;
    }

    .marker-popup {
        min-width: 180px;
        max-width: 250px;
    }

    .marker-popup .marker-title {
        font-size: 14px;
    }

    .marker-popup .marker-type,
    .marker-popup .marker-description {
        font-size: 12px;
    }

    .map-legend {
        bottom: 10px;
        left: 10px;
        padding: 10px;
        min-width: 150px;
        max-width: 180px;
    }

    .map-legend h4 {
        font-size: 13px;
        margin-bottom: 8px;
    }

    .legend-item {
        font-size: 12px;
        margin-bottom: 6px;
    }

    .legend-color {
        width: 14px;
        height: 14px;
        margin-right: 6px;
    }

    .legend-count {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .ws-record-map-container {
        min-height: 300px;
    }

    #record-map {
        height: 300px;
    }

    .custom-marker {
        width: 20px;
        height: 20px;
    }

    .map-legend {
        font-size: 11px;
        padding: 8px;
        min-width: 130px;
    }

    .map-legend h4 {
        font-size: 12px;
    }

    .legend-item {
        font-size: 11px;
    }
}

/* Sidebar Styles */
.map-sidebar {
    position: absolute;
    top: 0;
    left: -350px;
    width: 350px;
    height: 100%;
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(10px);
    color: white;
    transition: left 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
}

.map-sidebar.active {
    left: 0;
}

.sidebar-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: white;
    font-size: 32px;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    line-height: 32px;
    text-align: center;
    z-index: 10;
    transition: all 0.2s ease;
}

.sidebar-close:hover {
    color: #ff6b6b;
    transform: rotate(90deg);
}

.sidebar-content {
    padding: 0;
}

.sidebar-image-container {
    width: 100%;
    height: 250px;
    background: #1a1a1a;
    overflow: hidden;
}

.sidebar-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-image-container .no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
    font-size: 14px;
}

.sidebar-details {
    padding: 25px;
}

.sidebar-title {
    margin: 0 0 15px 0;
    font-size: 24px;
    font-weight: bold;
    color: white;
    line-height: 1.3;
}

.sidebar-type {
    margin: 0 0 20px 0;
}

.type-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-description {
    margin: 0 0 25px 0;
    font-size: 14px;
    line-height: 1.8;
    color: #ddd;
}

.sidebar-link {
    display: inline-block;
    padding: 10px 20px;
    background-color: #4ecdc4;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.sidebar-link:hover {
    background-color: #45b7d1;
}

/* Active marker highlight */
.custom-marker.active {
    transform: scale(1.3);
    z-index: 1000;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8), 0 0 10px rgba(0, 0, 0, 0.5);
}

/* Adjust legend position when sidebar is active */
.map-sidebar.active ~ .map-legend {
    left: 360px;
}

/* Print Styles */
@media print {
    .mapboxgl-ctrl-group,
    .map-legend,
    .map-sidebar {
        display: none;
    }

    .ws-record-map-container {
        box-shadow: none;
    }
}

/* Responsive Styles for Sidebar */
@media (max-width: 768px) {
    .map-sidebar {
        width: 100%;
        left: -100%;
    }

    .map-sidebar.active {
        left: 0;
    }

    .sidebar-image-container {
        height: 200px;
    }

    .sidebar-details {
        padding: 20px;
    }

    .sidebar-title {
        font-size: 20px;
    }

    .sidebar-description {
        font-size: 13px;
    }

    .map-sidebar.active ~ .map-legend {
        left: 10px;
        bottom: 80px;
    }
}

@media (max-width: 480px) {
    .sidebar-image-container {
        height: 150px;
    }

    .sidebar-details {
        padding: 15px;
    }

    .sidebar-title {
        font-size: 18px;
    }
}

/* ── Year Picker ─────────────────────────────────────────────────────────── */

.year-picker {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1100;
    font-family: inherit;
}

/* Trigger (collapsed state) */
.year-picker-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
    font-size: 15px;
    color: #333;
    transition: border-color 0.2s ease;
    user-select: none;
    white-space: nowrap;
}

.year-picker-trigger:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
}

.year-picker-trigger.active {
    border-color: #c0392b;
}

.year-picker-label {
    color: #555;
    font-weight: 400;
}

.year-picker-value {
    font-weight: 700;
    color: #222;
    font-size: 16px;
    min-width: 38px;
}

.year-picker-icon {
    font-size: 17px;
    margin-left: 4px;
    color: #777;
}

/* Dropdown panel */
.year-picker-dropdown {
    display: none;
    margin-top: 6px;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.14);
    padding: 12px;
    min-width: 260px;
}

.year-picker-dropdown.open {
    display: block;
}

/* Dropdown header */
.year-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.year-header-label {
    font-size: 16px;
    font-weight: 600;
    color: #222;
}

.year-nav-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 22px;
    color: #888;
    padding: 0 8px;
    line-height: 1;
    transition: color 0.15s ease;
}

.year-nav-btn:hover {
    color: #c0392b;
}

/* Year grid — 4 columns */
.year-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.year-item {
    background: none;
    border: none;
    border-radius: 6px;
    padding: 8px 4px;
    font-size: 14px;
    color: #444;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s ease, color 0.15s ease;
}

.year-item:hover {
    background: #f5f0ea;
    color: #c0392b;
}

.year-item.selected {
    background: #f0e8e6;
    color: #c0392b;
    font-weight: 600;
}

@media (max-width: 480px) {
    .year-picker-trigger {
        font-size: 13px;
        padding: 8px 10px;
    }

    .year-picker-dropdown {
        min-width: 220px;
    }

    .year-item {
        font-size: 12px;
        padding: 6px 2px;
    }
}
