/* Map */
#map {
    flex: 2;
    height: 100%;
}

/* Sidebar */
#sidebar {
    flex: 1;
    min-width: 320px;
    max-width: 460px;
    padding: 10px;
    border-left: 1px solid #ddd;
    border-right: 2px solid rgba(0, 0, 0, .4);
    background: #fafafa;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

#sidebar.hidden {
    transform: translateX(-100%);
}

/* List preloader */
#km-list-preloader {
    display: none;
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

#km-list-preloader.visible {
    display: block;
}

#km-list-preloader .spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #8b1a1a;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 12px;
}

/* List */
#km-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#km-list li {
    padding: 8px;
    margin-bottom: 6px;
    border-radius: 4px;
    background: #fff;
    border: 1px solid #eee;
    cursor: pointer;
    font-size: 14px;
}

#km-list li:hover {
    background: #f0f0f0;
}

#km-list li.active {
    background: #d9eaff;
    border-color: #99c6ff;
}

#km-list li.hover-highlight {
    background: #fff3cd;
    border-color: #ffc107;
}

#km-list small {
    color: #666;
}

#km-list .list-item-content {
    display: flex;
    min-height: 94px;
}

#km-list .list-item-location {
    margin-bottom: 15px;
}

#km-list .list-item-image img {
    flex: 0 0 92px;
    height: 92px;
    margin-right: 15px;
    width: 92px;
}

/* Pagination (bottom only) */
#pagination-bottom {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin: 16px 0;
    padding-bottom: 30px;
    font-size: 14px;
    position: relative;
}

#pagination-bottom button {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    min-width: 36px;
}

#pagination-bottom button:hover:not(:disabled) {
    background: #f0f0f0;
}

#pagination-bottom button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#pagination-bottom button.active {
    background: #8D847B;
    color: white;
    border-color: #8D847B;
}

#pagination-bottom .page-info {
    color: #666;
    margin: 0 8px;

}

#pagination-bottom .total-pages {
    position: absolute;
    bottom: 0;
    width: 100%;
    text-align: center;
}

/* Detail panel - separate sidebar */
#detail-panel {
    position: fixed;
    left: 0;
    top: 0;
    width: 1000px;
    height: 100vh;
    background: #fff;
    border-left: 1px solid #ddd;
    border-right: 2px solid rgba(0, 0, 0, .4);
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 1000;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
    transform: translateX(-100%);
}

#detail-panel.visible {
    transform: translateX(0);
}

/* Adaptive width for detail panel */
@media (max-width: 1540px) {
    #detail-panel {
        width: calc(100% - 560px);
    }
}

@media (max-width: 1440px) {
    #detail-panel {
        width: calc(100% - 400px);
    }
}

@media (max-width: 992px) {
    #detail-panel {
        width: calc(100% - 100px);
    }
}

#detail-panel .detail-header-bar {
    position: sticky;
    top: 0;
    background: #fff;
    padding: 16px;
    border-bottom: 1px solid #eee;
    z-index: 10;
}

#detail-panel h3 {
    margin: 0;
    font-size: 18px;
    padding-right: 30px;
}

#detail-panel .close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 1;
    color: #666;
}

#detail-panel .close-btn:hover {
    color: #333;
}

#detail-panel .detail-body {
    padding: 16px;
}

/* Preloader */
#detail-panel .preloader {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #666;
}

#detail-panel .spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #8b1a1a;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin-right: 12px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Detail sections */
#detail-panel .detail-header {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

#detail-panel .detail-header-item {
    font-size: 12px;
}

#detail-panel .detail-header-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
}

#detail-panel .detail-header-value {
    color: #666;
}

#detail-panel .detail-image {
    margin-bottom: 16px;
}

#detail-panel .detail-image img {
    max-width: 100%;
    max-height: 460px;
    border-radius: 4px;
    display: block;
    margin: 0 auto;
}

#detail-panel .image-caption {
    font-size: 13px;
    color: #333;
    margin-top: 8px;
    font-weight: 500;
}

#detail-panel .image-credit {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

/* Image slider */
#detail-panel .detail-image-slider {
    margin-bottom: 16px;
}

#detail-panel .slider-container {
    position: relative;
    background: #f5f5f5;
    border-radius: 4px;
    overflow: hidden;
}

#detail-panel .slider-images {
    position: relative;
    width: 100%;
}

#detail-panel .slider-slide {
    display: none;
    width: 100%;
}

#detail-panel .slider-slide.active {
    display: block;
}

#detail-panel .slider-slide img {
    max-width: 100%;
    max-height: 460px;
    display: block;
    margin: 0 auto;
}

#detail-panel .slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: background 0.2s;
}

#detail-panel .slider-btn:hover {
    background: rgba(255, 255, 255, 1);
}

#detail-panel .slider-prev {
    left: 10px;
}

#detail-panel .slider-next {
    right: 10px;
}

#detail-panel .slider-counter {
    text-align: center;
    padding: 8px;
    font-size: 13px;
    color: #666;
    background: #fff;
}

#detail-panel .detail-section {
    margin-bottom: 20px;
}

#detail-panel .detail-section-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    color: #333;
}

#detail-panel .detail-table {
    width: 100%;
    border-collapse: collapse;
}

#detail-panel .detail-table tr {
    border-bottom: 1px solid #f0f0f0;
}

#detail-panel .detail-table td {
    padding: 8px 0;
    font-size: 13px;
}

#detail-panel .detail-table td:first-child {
    font-weight: 600;
    color: #333;
    width: 40%;
    padding-right: 12px;
}

#detail-panel .detail-table td:last-child {
    color: #666;
}

#detail-panel .detail-description {
    font-size: 13px;
    line-height: 1.6;
    color: #666;
}

#detail-panel .detail-row {
    margin-bottom: 8px;
    font-size: 13px;
}

#detail-panel .detail-label {
    font-weight: 600;
    color: #333;
}

#detail-panel .detail-value {
    color: #666;
}

.leaflet-attribution-flag {
    display: none !important;
}

.popup-title:hover {
    text-decoration: underline;
}

/* Hover marker with gold/orange color */
.hover-marker-icon {
    overflow: visible !important;
}

.hover-marker-icon svg {
    overflow: visible;
}

.hover-marker-icon .leaflet-marker-shadow {
    filter: none;
}