/* Map Page Styles */

#map,
#spot-map {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.spot-map {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    margin-top: 0;
    /* Optimize for smooth zooming and panning */
    touch-action: pan-x pan-y pinch-zoom;
}

.spot-map .leaflet-container {
    height: 100%;
    width: 100%;
    background-color: #0E0E10;
}

#buttons {
    position: absolute;
    top: 4.2rem;
    left: 1rem;
    right: 1rem;
    z-index: 1000;
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
    -webkit-overflow-scrolling: touch;
    
    color: var(--primary);
}

#buttons::-webkit-scrollbar {
    height: 6px;
}

#buttons::-webkit-scrollbar-track {
    background: transparent;
}

#buttons::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

#buttons::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    padding: 0.5rem 1.25rem;
    border: 1.5px solid var(--secondary);
    border-radius: 50px;
    background: var(--card);
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-family: inherit;
    overflow: hidden;
    flex-shrink: 0;
}

.button svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.button:hover {
    border-color: var(--gradient-1);
    background: rgba(59, 130, 246);
}

.spot-map .leaflet-container {
    height: 100%;
    width: 100%;
    background-color: #0E0E10;
}

/* Map tile brightness and contrast filter - controlled dynamically via JavaScript */
.spot-map .leaflet-tile-container img {
    filter: brightness(0.8) contrast(1);
    transition: filter 0.2s ease;
}

/* Brightness Slider Popup Styles */
.brightness-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.brightness-popup.active {
    pointer-events: all;
}

.brightness-popup-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.brightness-popup.active .brightness-popup-backdrop {
    opacity: 1;
}

.brightness-popup-content {
    position: relative;
    background: var(--card);
    border-radius: 16px;
    padding: 1.5rem;
    min-width: 300px;
    max-width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10;
}

.brightness-popup.active .brightness-popup-content {
    transform: translateY(0);
    opacity: 1;
}

.brightness-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.brightness-header span {
    color: var(--primary);
    font-size: 1.1rem;
    font-weight: 600;
}

.close-brightness-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.close-brightness-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.brightness-control {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.slider-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.slider-label {
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.brightness-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.brightness-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(90deg, var(--gradient-1), var(--gradient-2));
    cursor: pointer;
    border: 2px solid var(--card);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.brightness-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.brightness-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(90deg, var(--gradient-1), var(--gradient-2));
    cursor: pointer;
    border: 2px solid var(--card);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.brightness-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
}

.slider-value {
    text-align: center;
}

.slider-value span {
    color: var(--primary);
    font-size: 1rem;
    font-weight: 500;
}

/* Legacy class name for backwards compatibility */
.brightness-value {
    text-align: center;
}

.brightness-value span {
    color: var(--primary);
    font-size: 1rem;
    font-weight: 500;
}

/* Spot Popup Styles */
.spot-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    pointer-events: none;
}

.spot-popup.active {
    pointer-events: all;
}

.spot-popup-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.spot-popup.active .spot-popup-backdrop {
    opacity: 1;
}

.spot-popup-content {
    position: relative;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    background: var(--card);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.spot-popup.active .spot-popup-content {
    transform: translateY(0);
}

.spot-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--card);
    z-index: 10;
}

.spot-popup-back-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.spot-popup-back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.spot-popup-back-btn svg {
    width: 24px;
    height: 24px;
}

.spot-popup-name {
    flex: 1;
    text-align: center;
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
    padding: 0 1rem;
}

.spot-popup-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.spot-popup-share-btn,
.spot-popup-menu-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
    position: relative;
}

.spot-popup-share-btn:hover,
.spot-popup-menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.spot-popup-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    min-width: 150px;
    z-index: 1000;
    overflow: hidden;
}

.spot-popup-menu-item {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    color: var(--primary);
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease;
}

.spot-popup-menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.spot-popup-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.spot-popup-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    margin: 0 0 1rem 0;
}

.spot-popup-top-posts-section {
    margin-bottom: 2rem;
}

.spot-popup-top-posts {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.spot-popup-top-posts::-webkit-scrollbar {
    height: 6px;
}

.spot-popup-top-posts::-webkit-scrollbar-track {
    background: transparent;
}

.spot-popup-top-posts::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.spot-popup-top-post {
    flex-shrink: 0;
    width: 150px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.spot-popup-top-post:hover {
    transform: scale(1.05);
}

.spot-popup-top-post-image {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.spot-popup-top-post-profile {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.5rem;
}

.spot-popup-top-post-profile-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.spot-popup-all-posts-section {
    margin-top: 2rem;
}

.spot-popup-posts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.spot-popup-filters {
    display: flex;
    gap: 0.5rem;
}

.spot-popup-sort-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s ease;
}

.spot-popup-sort-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.spot-popup-posts-feed {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.spot-popup-post-card {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 12px;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s ease;
}

.spot-popup-post-card:hover {
    transform: scale(1.05);
}

.spot-popup-post-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Custom Leaflet Marker for Spots */
.spot-marker-container {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.spot-marker {
    position: relative;
    width: 120px;
    height: 140px;
    cursor: pointer;
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    
}

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

.spot-marker-image-wrapper {
    position: relative;
    width: 100px;
    height: 120px;
    margin: 0 auto;
    overflow: hidden;
    background: rgba(14, 14, 16, 0.8);

    border: 3px solid;
    border-radius: 12px;
    border-color: #3B82F6;
    
}

.spot-marker::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 8px;
    transform: translateX(-50%) translateY(-72%);
    width: 0;
    height: 0;
    border-left: 35px solid transparent;
    border-right: 35px solid transparent;
    border-top: 14px solid #3B82F6;
    z-index: -1;
    pointer-events: none;
    
}


.spot-marker-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    margin: 0;
    padding: 0;
    
    
}

.spot-marker-name {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.75rem;
    color: #fff;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
    padding: 0 4px;
}

/* Cluster Marker Styles */
.spot-cluster-marker-container {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.spot-cluster-marker {
    position: relative;
    width: 140px;
    height: 180px;
    cursor: pointer;
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

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

.spot-cluster-image-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 2px;
    width: 120px;
    height: 120px;
    margin: 0 auto;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
    position: relative;

    border: 3px solid transparent;
    background-clip: padding-box, border-box;
    background-origin: padding-box, border-box;
    background-image: 
        linear-gradient(rgba(0,0,0,0.1), rgba(0,0,0,0.1)),
        linear-gradient(180deg, #3B82F6 0%, #10B981 100%);
        border-radius: 12px;
}

.spot-cluster-marker::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 8px;
    transform: translateX(-50%) translateY(-280%);
    width: 0;
    height: 0;
    border-left: 35px solid transparent;
    border-right: 35px solid transparent;
    border-top: 14px solid #10B981;
    opacity: 0.92;
    filter: drop-shadow(0 2px 8px rgba(59,130,246,0.25));
    z-index: -1;
    pointer-events: none;
}

.spot-cluster-image-item {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    background: rgba(0, 0, 0, 0.3);
    min-width: 0;
    min-height: 0;
}

.spot-cluster-image-item:empty {
    background: rgba(0, 0, 0, 0.4);
}

.spot-cluster-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    margin: 0;
    padding: 0;
}

.spot-cluster-count-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    z-index: 10;
}

.spot-cluster-marker-name {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.75rem;
    color: #fff;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
    padding: 0 4px;
}

/* Filter Popup Styles (reused from explore) */
.filter-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.filter-popup-content {
    background: var(--card);
    border-radius: 16px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.filter-popup-content h3 {
    margin: 0 0 1.5rem 0;
    color: var(--primary);
    font-size: 1.25rem;
}

.sort-option-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 1rem;
}

.sort-option {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--primary);
    cursor: pointer;
    transition: background 0.2s ease;
}

.sort-option:hover {
    background: rgba(255, 255, 255, 0.15);
}

.sort-direction-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.75rem;
    color: var(--primary);
    cursor: pointer;
    transition: background 0.2s ease;
}

.sort-direction-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.close-popup-btn {
    width: 100%;
    margin-top: 1.5rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--primary);
    cursor: pointer;
    transition: background 0.2s ease;
}

.close-popup-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Responsive Design */
@media (max-width: 768px) {
    .spot-popup-top-post {
        width: 120px;
    }
    
    .spot-popup-top-post-image {
        width: 120px;
        height: 120px;
    }
    
    .spot-popup-posts-feed {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .spot-popup-name {
        font-size: 1.1rem;
    }
    
    /* Adjust map container for bottom navigation bar */
    .spot-map {
        bottom: 4.5rem;
    }
    
    .spot-popup-content {
        max-height: calc(90vh - 4.5rem);
        margin-bottom: 4.5rem;
    }
}

