* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    /* Telegram header offset (set by JavaScript for fullscreen mode) */
    --tg-header-offset: 0px;
}

/* Lock orientation to portrait - hide content in landscape */
@media screen and (orientation: landscape) {
    body {
        display: none !important;
    }
    body::before {
        content: "↻ Поверните телефон вертикально";
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: #F9FAFB;
        display: flex !important;
        align-items: center;
        justify-content: center;
        font-size: 20px;
        font-weight: 500;
        color: #1F2937;
        z-index: 999999;
        text-align: center;
        padding: 20px;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    background: #FFFFFF;
    position: fixed;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Hide Mapbox logo and attribution */
.mapboxgl-ctrl-logo,
.mapboxgl-ctrl-attrib,
.mapbox-improve-map {
    display: none !important;
}

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

/* Offset for Telegram header + top-panel in fullscreen mode (safe-area + 80px header+spacing + 52px panel) */
body.fullscreen-mode #map {
    top: calc(env(safe-area-inset-top, 0) + 132px) !important;
}

#loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 24px 32px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    text-align: center;
    z-index: 1000;
    display: none;
}

#loading.active { display: block; }

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 12px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #10B981;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

#loading-text {
    color: #1F2937;
    font-size: 14px;
    font-weight: 500;
}

#top-panel {
    position: fixed;
    top: env(safe-area-inset-top, 0);
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px 10px 16px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 100;
    box-shadow: none;
}

/* Offset for Telegram header in fullscreen mode (safe-area + Telegram header ~72px + 8px spacing) */
body.fullscreen-mode #top-panel {
    top: calc(env(safe-area-inset-top, 0) + 80px) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Category chips - horizontal scrollable filter */
#category-chips {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0) + 60px);
    left: 0;
    right: 0;
    display: flex;
    gap: 8px;
    padding: 8px 16px;
    overflow-x: auto;
    scrollbar-width: none;
    z-index: 99;
    -webkit-overflow-scrolling: touch;
}

#category-chips::-webkit-scrollbar {
    display: none;
}

body.fullscreen-mode #category-chips {
    top: calc(env(safe-area-inset-top, 0) + 140px);
}

.category-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-size: 14px;
    font-weight: 500;
    color: #1F2937;
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.08);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.category-chip:active {
    transform: scale(0.95);
}

.category-chip.active {
    background: rgba(16, 185, 129, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    border-color: transparent;
}

/* Status chips (Favorites, Want to go) with SVG icons */
.category-chip.status-chip {
    gap: 6px;
}

.category-chip.status-chip svg {
    width: 14px;
    height: 14px;
    fill: none;
    flex-shrink: 0;
}

.category-chip.status-chip[data-status="favorite"] svg {
    stroke: #EF4444;
}

.category-chip.status-chip[data-status="want_to_go"] svg {
    stroke: #F59E0B;
}

.category-chip.status-chip.active svg {
    stroke: white;
}

/* Map view: more transparency since background is darker */
body.view-map .category-chip {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.15);
}

body.view-map .category-chip.active {
    background: rgba(16, 185, 129, 0.85);
}

.chip-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    margin-left: 4px;
    padding: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    vertical-align: baseline;
    margin-bottom: 1px;
}

.chip-chevron {
    display: inline-block;
    width: 5px;
    height: 5px;
    margin-left: 5px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    vertical-align: middle;
    margin-bottom: 3px;
}

/* Chip wrapper for dropdown positioning */
.chip-wrapper {
    position: relative;
    flex-shrink: 0;
}

/* Subtype dropdown */
.subtype-dropdown {
    position: fixed;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    min-width: 160px;
    z-index: 200;
    animation: dropdownFadeIn 0.15s ease;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.subtype-option {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
    transition: background 0.15s ease;
}

.subtype-option:hover {
    background: #F3F4F6;
}

.subtype-option.selected {
    color: #10B981;
    font-weight: 500;
}

.subtype-option.selected::before {
    content: '✓ ';
}

.subtype-option.remove-filter {
    color: #EF4444;
    border-top: 1px solid #E5E7EB;
    margin-top: 4px;
    padding-top: 12px;
}

/* Friends dropdown */
.friends-dropdown {
    position: fixed;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    min-width: 200px;
    max-width: 280px;
    z-index: 200;
    animation: dropdownFadeIn 0.15s ease;
}

.friend-dropdown-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.friend-dropdown-option:hover {
    background: #F9FAFB;
}

.friend-dropdown-option.selected {
    background: #ECFDF5;
}

.friend-dropdown-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    flex-shrink: 0;
}

.friend-dropdown-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.friend-dropdown-avatar span {
    font-size: 14px;
    font-weight: 600;
    color: #6B7280;
}

.friend-dropdown-name {
    flex: 1;
    font-size: 14px;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.friend-dropdown-check {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.friend-dropdown-option.selected .friend-dropdown-check {
    opacity: 1;
    color: #10B981;
}

/* Hide chips when bottom sheet is active */
.bottom-sheet.active ~ #category-chips {
    opacity: 0;
    pointer-events: none;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #1F2937;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: manipulation;
}

.icon-btn:active {
    transform: scale(0.9);
    opacity: 0.7;
}

#settings-btn.active {
    background: #10B981;
    color: white;
}

#city-selector {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
}

.city-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.city-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

#city-name {
    font-size: 18px;
    font-weight: 700;
    color: #1F2937;
    line-height: 1.2;
}

#places-count-inline {
    font-size: 11px;
    font-weight: 500;
    color: #9CA3AF;
    letter-spacing: 0.3px;
    background: rgba(255, 255, 255, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
}

#city-select {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    font-size: 17px;
}

#city-select option {
    font-size: 17px;
    padding: 12px;
}

/* Filters Chips Container */
#filters-chips-container {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 68px);
    left: 0;
    right: 0;
    z-index: 99;
    background: white;
    padding: 12px 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

#filters-chips-container::-webkit-scrollbar {
    display: none;
}

#filters-chips {
    display: flex;
    gap: 8px;
    min-width: max-content;
}

.filter-chip {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1.5px solid #E5E7EB;
    background: white;
    font-size: 14px;
    font-weight: 500;
    color: #6B7280;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: manipulation;
}

.filter-chip:active {
    transform: scale(0.95);
}

.filter-chip.active {
    background: #10B981;
    border-color: #10B981;
    color: white;
}

.filter-chip.sort {
    display: flex;
    align-items: center;
    gap: 4px;
}

.filter-chip svg {
    width: 12px;
    height: 12px;
}

/* Center City Button */
#center-city-btn {
    position: fixed;
    bottom: calc(40px + env(safe-area-inset-bottom, 0px));
    left: 16px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #1F2937;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: none;
    z-index: 100;
    transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: manipulation;
}

#center-city-btn:active {
    transform: scale(0.95);
}

/* Geolocation Button */
#geolocation-btn {
    position: fixed;
    bottom: calc(40px + env(safe-area-inset-bottom, 0px));
    right: 16px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #1F2937;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: none;
    z-index: 100;
    transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: manipulation;
}

#geolocation-btn:active {
    transform: scale(0.95);
}

#geolocation-btn.active {
    background: #3B82F6;
    color: white;
}

#geolocation-btn.loading {
    opacity: 0.6;
}

.bottom-sheet.active ~ #geolocation-btn,
.bottom-sheet.active ~ #center-city-btn {
    opacity: 0;
    pointer-events: none;
}

/* Mapbox marker wrapper - ensure avatar overflow is visible */
.mapboxgl-marker {
    overflow: visible !important;
}

.custom-marker {
    font-size: 20px;
    width: 36px;
    height: 36px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                height 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    user-select: none;
    line-height: 1;
    /* REMOVED: position: relative - breaks Mapbox marker positioning! */
}

.custom-marker.active {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

/* Friend's spot marker - colors set via JS inline styles */
.custom-marker.friend-marker {
    /* bg and box-shadow set inline per friend */
}

.custom-marker.friend-marker.overlap {
    box-shadow: 0 0 0 3px #10B981, 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* User marker that overlaps with friend's spot - subtle border */
.custom-marker.has-friend-overlap {
    /* Gold ring around marker to indicate overlap */
    box-shadow: 0 0 0 3px #F5A623, 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

/* Single friend avatar on friend markers */
.friend-marker-avatar {
    position: absolute;
    bottom: 0;
    right: 0;
    transform: translate(30%, 30%);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    overflow: hidden;
    border: 1.5px solid white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    z-index: 10;
    pointer-events: none;
}

.friend-marker-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Stacked avatars for overlap markers (user + friend) */
.overlap-avatar-stack {
    position: absolute;
    bottom: 0;
    right: 0;
    transform: translate(35%, 35%);
    width: 22px;
    height: 18px;
    pointer-events: none;
    z-index: 10;
}

.overlap-avatar {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    overflow: hidden;
    border: 1.5px solid white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.overlap-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Friend avatar - back, slightly left */
.overlap-avatar-back {
    left: 0;
    top: 0;
    z-index: 1;
}

/* User avatar - front, slightly right */
.overlap-avatar-front {
    right: 0;
    bottom: 0;
    z-index: 2;
    border-color: white;
}

/* Counter for additional friends on marker */
.overlap-avatar-stack.has-counter {
    width: 32px;
}

.overlap-avatar-counter {
    position: absolute;
    right: -2px;
    top: -2px;
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
    background: #10B981;
    color: white;
    font-size: 9px;
    font-weight: 600;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Marker label - Google Maps style */
.marker-label {
    position: absolute;
    left: 42px;
    top: 50%;
    transform: translateY(-50%);
    display: block;
    font-size: 13px;
    font-weight: 400;
    color: #1a1a1a;
    width: 120px;
    max-height: 2.6em;
    line-height: 1.3;
    overflow: hidden;
    white-space: normal;
    word-wrap: break-word;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
    text-shadow:
        -1px -1px 0 white,
        1px -1px 0 white,
        -1px 1px 0 white,
        1px 1px 0 white;
}

.marker-label.visible {
    opacity: 1;
}

.user-location-marker {
    width: 18px;
    height: 18px;
    background: #3B82F6;
    border: 4px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.2);
    animation: pulse 2s infinite;
}

/* Cluster marker (white circle with count) */
.cluster-marker {
    width: 40px;
    height: 40px;
    background: white;
    border: 2px solid #E5E7EB;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: #1F2937;
    cursor: pointer;
    transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                height 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    user-select: none;
}

.cluster-marker:hover {
    width: 44px;
    height: 44px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Spider marker (smaller emoji markers) */
.spider-marker {
    font-size: 18px;
    width: 32px;
    height: 32px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                height 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    user-select: none;
    line-height: 1;
}

/* Animation only on appear */
.spider-marker.appearing {
    animation: spiderAppear 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.spider-marker:hover {
    width: 36px;
    height: 36px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

@keyframes spiderAppear {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.2); }
    50% { box-shadow: 0 0 0 12px rgba(59, 130, 246, 0.1); }
}

.bottom-sheet {
    position: fixed;
    bottom: 110px;
    left: 0;
    right: 0;
    background: transparent;
    border-radius: 20px;
    box-shadow: none;
    z-index: 1000;
    transform: translateY(calc(100% + 110px));
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-radius 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 200px;
    display: none;
    overflow: visible;
    padding: 0 8px;
    will-change: transform;
}

.bottom-sheet.active {
    display: block;
    transform: translateY(0);
}

.bottom-sheet.expanded {
    height: 100vh;
    bottom: 0;
    left: 0 !important;
    right: 0 !important;
    border-radius: 0;
    padding: 0 !important; /* Force remove all padding for full-width expanded card */
    margin: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden;
}

.sheet-handle {
    display: none;
}

.sheet-close {
    position: absolute;
    top: -48px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: #374151;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    touch-action: manipulation;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    padding: 0 0 2px 0;
}

.sheet-close:active {
    background: #1F2937;
    transform: scale(0.9);
}

.bottom-sheet.expanded .sheet-close {
    position: absolute;
    top: calc(48vh - 56px);
    right: 20px;
    width: 36px;
    height: 36px;
    background: #374151;
    color: white;
    border-radius: 18px;
    backdrop-filter: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1003;
}

.direction-btn {
    position: absolute;
    bottom: 12px;
    right: 16px;
    height: 40px;
    padding: 0 6px 0 16px;
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    z-index: 30;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    overflow: hidden;
}

.direction-btn:active {
    transform: scale(0.95);
    background: #F9FAFB;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.direction-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.direction-btn-icon {
    position: relative;
    flex-shrink: 0;
}

.direction-btn-icon-circle {
    width: 40px;
    height: 40px;
    margin: -6px;
    border-radius: 50%;
    background: #F3F4F6;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.direction-btn-rating {
    font-size: 15px;
    font-weight: 600;
    color: #000000;
    white-space: nowrap;
    line-height: 40px;
    display: flex;
    align-items: center;
    z-index: 1;
}

.bottom-sheet.expanded .direction-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    height: 48px;
    padding: 0 18px;
    z-index: 1002;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.bottom-sheet.expanded .direction-btn svg {
    width: 20px;
    height: 20px;
}

.bottom-sheet.expanded .direction-btn-rating {
    font-size: 16px;
}

/* Bookmark button */
.bookmark-btn {
    position: absolute;
    bottom: 12px;
    left: 164px;
    width: 40px;
    height: 40px;
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.bookmark-btn:active {
    transform: scale(0.95);
    background: #FFFBF0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.bookmark-btn svg {
    width: 20px;
    height: 20px;
    stroke: #E5C687;
    stroke-width: 1.5;
    fill: #F5DEB3;
}

/* Heart icon for favorites - red on white */
.bookmark-btn[data-status="favorite"] svg {
    fill: #EF4444;
    stroke: #EF4444;
    stroke-width: 1.5;
}

.bottom-sheet.expanded .bookmark-btn {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 56px;
    height: 56px;
    z-index: 1002;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.bottom-sheet.expanded .bookmark-btn svg {
    width: 24px;
    height: 24px;
}

/* Status menu */
.status-menu {
    position: absolute;
    bottom: 55px;
    left: 14px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 8px;
    z-index: 40;
    min-width: 180px;
    opacity: 1;
    transform: translateY(0) scale(1);
    transform-origin: bottom left;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.status-menu.hidden {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    pointer-events: none;
}

.status-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: none;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    touch-action: manipulation;
    transition: background 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    font-size: 14px;
    color: #1F2937;
    position: relative;
}

.status-option:active {
    background: #F3F4F6;
}

.status-option svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke: #6B7280;
    fill: none;
}

.status-option[data-status="want_to_go"] svg {
    fill: rgba(212, 175, 55, 0.2);
    stroke: #D4AF37;
}

.status-option[data-status="favorite"] svg {
    fill: none;
    stroke: #6B7280;
}

.status-option.active {
    background: #F0F9FF;
}

.status-option.active svg {
    stroke: #3B82F6;
}

.status-option.active[data-status="want_to_go"] svg {
    fill: #D4AF37;
    stroke: #D4AF37;
}

.status-option.active[data-status="favorite"] svg {
    fill: #EF4444;
    stroke: #EF4444;
}

.status-check {
    margin-left: auto;
    color: #3B82F6;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.status-option.active .status-check {
    opacity: 1;
}

.bottom-sheet.expanded .status-menu {
    bottom: 88px;
    left: 24px;
}

/* Status menu when inside expanded-card */
.expanded-card > .status-menu {
    position: absolute;
    bottom: 88px;
    left: 24px;
    z-index: 20;
}

.carousel-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: visible;
    z-index: 1;
}

.carousel-track {
    display: flex;
    height: 100%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 8px;
    will-change: transform;
}

.carousel-slide {
    width: 100%;
    flex-shrink: 0;
    height: 100%;
    position: relative;
    overflow: visible;
}

.compact-card {
    position: relative;
    width: 100%;
    height: 100%;
    cursor: pointer;
    overflow: visible;
    border-radius: 20px;
    display: flex;
    flex-direction: row;
    background: white;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.compact-chips-row {
    position: absolute;
    top: -48px;
    left: 8px;
    right: 60px;
    height: 36px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 29;
    pointer-events: none;
}

.compact-chips-row .compact-subtypes {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    pointer-events: auto;
}

.compact-image-wrapper {
    position: relative;
    width: 140px;
    min-width: 140px;
    height: 100%;
}

.compact-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.compact-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f5f5f5 0%, #e5e5e5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 56px;
}

.compact-overlay {
    position: relative;
    flex: 1;
    background: white;
    padding: 12px 16px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.compact-title {
    font-size: 17px;
    font-weight: 600;
    color: #1F2937;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    padding-right: 50px;
    margin-bottom: 4px;
}

.compact-meta {
    margin-top: 4px;
    margin-bottom: 6px;
    line-height: 1.4;
    font-size: 12px;
    color: #6B7280;
}

.compact-rating {
    font-size: 12px;
    font-weight: 500;
    color: #9CA3AF;
    display: flex;
    align-items: center;
    gap: 0;
    white-space: nowrap;
}

.compact-rating::before {
    content: '★ ';
    font-size: 11px;
    margin-right: 2px;
}

.compact-hours {
    font-size: 12px;
    font-weight: 500;
    color: #9CA3AF;
    line-height: inherit;
}

.compact-hours-open {
    color: #10B981 !important;
}

.compact-hours-closing-soon {
    color: #F59E0B !important;
}

.compact-hours-closed {
    color: #EF4444 !important;
}

.compact-price {
    font-size: 12px;
    font-weight: 500;
    color: #6B7280;
    margin-top: 2px;
}

.compact-distance {
    font-size: 12px;
    font-weight: 500;
    color: #6B7280;
}

.compact-subtypes {
    display: flex;
    gap: 8px;
    margin-bottom: 0;
    flex-wrap: wrap;
}

.compact-chip {
    font-size: 13px;
    font-weight: 500;
    color: #1F2937;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(0, 0, 0, 0.15);
    padding: 0 12px;
    height: 36px;
    display: flex;
    align-items: center;
    border-radius: 20px;
    white-space: nowrap;
}

.compact-description {
    font-size: 13px;
    color: #4B5563;
    line-height: 1.4;
    margin-top: 4px;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    padding-right: 55px;
}

.compact-description-short {
    -webkit-line-clamp: 2;
}

.compact-summary {
    font-size: 13px;
    color: #6B7280;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    padding-right: 55px;
}

.compact-address {
    display: none;
}

.compact-distance-inline {
    font-size: 13px;
    color: #6B7280;
}

.expanded-card {
    display: none;
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Expanded-card when moved to body */
body > .expanded-card {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: white;
    z-index: 1001;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    pointer-events: auto !important;
}

/* Ensure all interactive elements in expanded-card accept pointer events */
body > .expanded-card * {
    pointer-events: auto;
}

/* Sheet-close when in body */
body > .sheet-close {
    position: fixed;
    top: calc(48vh - 56px);
    right: 20px;
    width: 36px;
    height: 36px;
    background: #374151;
    color: white;
    border-radius: 18px;
    border: none;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1003;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    padding: 0 0 2px 0;
}

.photo-gallery {
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    height: 48vh;
    overflow: hidden;
    width: 100% !important;
    z-index: 5;
}

.gallery-track {
    display: flex;
    height: 100%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: pan-x;
    will-change: transform;
}

.gallery-image {
    min-width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-placeholder {
    min-width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f5f5f5 0%, #e5e5e5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 80px;
}

.gallery-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    background: rgba(0, 0, 0, 0.6);
    padding: 15px 16px;
    border-radius: 18px;
    height: 36px;
    align-items: center;
    z-index: 20;
}

.gallery-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                width 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                border-radius 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-dot.active {
    background: white;
    width: 24px;
    border-radius: 3px;
}

.gallery-counter {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 9px 14px;
    border-radius: 18px;
    font-size: 14px;
    font-weight: 500;
    height: 36px;
    display: flex;
    align-items: center;
    z-index: 20;
}

/* Gallery slide wrapper for set-cover button */
.gallery-slide {
    flex-shrink: 0;
    width: 100%;
    min-width: 100%;
    height: 100%;
    position: relative;
}

/* Изображение внутри слайда - абсолютное позиционирование */
.gallery-slide .gallery-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Set cover photo button */
.set-cover-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 25;
    padding: 0;
    transition: transform 0.15s ease, background 0.15s ease;
}

.set-cover-btn:active {
    transform: scale(0.92);
}

.set-cover-btn svg {
    width: 18px;
    height: 18px;
    fill: rgba(255, 255, 255, 0.5);
    transition: fill 0.15s ease, background 0.15s ease;
}

/* Active state - белый фон, тёмная иконка */
.set-cover-btn.active {
    background: rgba(255, 255, 255, 0.95);
}

.set-cover-btn.active svg {
    fill: #333;
}

.gallery-overlay {
    display: none;
}

.expanded-content {
    position: absolute;
    top: 48vh;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    border-radius: 24px 24px 0 0;
    padding: 24px 20px 80px 20px;
    padding-bottom: calc(80px + env(safe-area-inset-bottom));  /* Добавлен safe-area */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 1;
}

.expanded-title {
    font-size: 24px;
    font-weight: 700;
    color: #1F2937;
    line-height: 1.3;
    margin-bottom: 12px;
    padding-right: 0;
}

.expanded-chips {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.expanded-chip {
    font-size: 13px;
    font-weight: 500;
    color: #6B7280;
    background: #F3F4F6;
    padding: 6px 14px;
    border-radius: 14px;
    white-space: nowrap;
}

.expanded-rating {
    font-size: 15px;
    font-weight: 600;
    color: #F59E0B;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 16px;
}

.expanded-summary {
    font-size: 16px;
    color: #6B7280;
    line-height: 1.6;
    margin-bottom: 18px;
}

.expanded-address-separator {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #E5E7EB;
}

.expanded-address {
    font-size: 15px;
    color: #9CA3AF;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.delete-spot-container {
    display: flex;
    justify-content: center;
    padding-bottom: 20px;
    position: relative;
    z-index: 5;
}

.delete-spot-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: #ff3b30;
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

.delete-spot-btn svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.delete-spot-btn:active {
    opacity: 0.8;
}

.controls-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #FAFAFA;
    border: 1px solid #E5E7EB;
    border-bottom: none;
    border-radius: 20px 20px 0 0;
    padding: 14px 20px 26px 20px;
    display: none; /* Hidden by default (compact view) */
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    z-index: 50;
}

/* Show controls-bar only in expanded view */
.bottom-sheet.expanded .controls-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1002;
}

/* Controls-bar when inside expanded-card */
.expanded-card > .controls-bar {
    display: flex;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    background: #FAFAFA;
    border: 1px solid #E5E7EB;
    border-bottom: none;
    border-radius: 20px 20px 0 0;
    padding: 14px 20px 26px 20px;
    gap: 12px;
    pointer-events: auto;
}

/* Hide original buttons in expanded view */
.bottom-sheet.expanded .direction-btn {
    display: none;
}

.bottom-sheet.expanded .bookmark-btn {
    display: none;
}

.direction-btn-expanded {
    position: static;
    height: 40px;
    padding: 0 6px 0 16px;
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    overflow: hidden;
}

.direction-btn-expanded:active {
    transform: scale(0.95);
    background: #F9FAFB;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.direction-btn-rating-expanded {
    font-size: 15px;
    font-weight: 600;
    color: #000000;
    white-space: nowrap;
    line-height: 40px;
    display: flex;
    align-items: center;
    z-index: 1;
}

.direction-btn-icon-expanded {
    position: relative;
    flex-shrink: 0;
}

.bookmark-btn-expanded {
    position: static;
    width: 40px;
    height: 40px;
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.bookmark-btn-expanded:active {
    transform: scale(0.95);
    background: #FFFBF0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.bookmark-btn-expanded svg {
    width: 20px;
    height: 20px;
    stroke: #E5C687;
    stroke-width: 1.5;
    fill: #F5DEB3;
}

.bookmark-btn-expanded[data-status="favorite"] svg {
    fill: #EF4444;
    stroke: #EF4444;
    stroke-width: 1.5;
}

.bookmark-btn-expanded[data-status="hidden"] svg {
    fill: transparent;
    stroke: #9CA3AF;
    stroke-width: 1.5;
}

/* Add-to-collection button (friend's spot) */
.bookmark-btn-expanded.add-to-collection-mode {
    background: white;
    border: 1px solid #10B981;
}

.bookmark-btn-expanded.add-to-collection-mode svg {
    stroke: #10B981;
    stroke-width: 2;
    fill: none;
}

.bookmark-btn-expanded.add-to-collection-mode:active {
    background: #F0FDF4;
    transform: scale(0.95);
}

.bookmark-btn-expanded.add-to-collection-mode:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.bookmark-btn-expanded.add-to-collection-mode:disabled:active {
    transform: none;
}

/* Contact buttons container */
.contact-buttons-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* Individual contact button */
.contact-btn {
    width: 40px;
    height: 40px;
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
}

.contact-btn:active {
    transform: scale(0.95);
    background: #F9FAFB;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.contact-btn img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

/* Phone toast notification */
.phone-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    text-align: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}

.phone-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.working-hours-table {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #E5E7EB;
}

.hours-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
}

.hours-day {
    font-weight: 500;
    color: #9CA3AF;
}

.hours-time {
    font-weight: 500;
    color: #9CA3AF;
}

.hours-row-today .hours-day,
.hours-row-today .hours-time {
    font-weight: 600;
    color: #374151;
}

.expanded-button {
    display: none;
}

.carousel-indicators {
    display: none;
}

/* Align carousel with close button and counter in expanded mode */
.bottom-sheet.expanded ~ .carousel-indicators {
    bottom: auto;
    top: calc(60vh - 35px);
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.carousel-indicators.hidden { display: none; }

.indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #D1D5DB;
    transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                width 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                border-radius 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.indicator.active {
    background: #10B981;
    width: 24px;
    border-radius: 3px;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
    display: none;
    animation: fadeIn 0.2s ease;
}

/* Overlay only visible in expanded mode */
.bottom-sheet.expanded ~ .overlay { display: block; }

/* Filters Modal */
.filters-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.filters-modal.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.filters-modal-content {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(1);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.filters-modal.hidden .filters-modal-content {
    transform: scale(0.95);
}

.filters-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
}

.filters-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1F2937;
    flex: 1;
}

.filters-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filters-reset-link {
    color: #9CA3AF;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filters-reset-link svg {
    width: 22px;
    height: 22px;
}

.filters-close {
    background: none;
    border: none;
    color: #9CA3AF;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filters-close svg {
    width: 22px;
    height: 22px;
}

.filters-modal-body {
    padding: 0;
    overflow-y: auto;
    flex: 1;
}

/* Filter Section */
.filter-section {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.filter-section:last-child {
    border-bottom: none;
}

.filter-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

/* Toggle Switch (Open Now) */
.filter-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.filter-toggle-label {
    font-size: 15px;
    color: #1F2937;
}

.filter-toggle {
    position: relative;
    width: 48px;
    height: 28px;
    background: #E5E7EB;
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.filter-toggle.active {
    background: #10B981;
}

.filter-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

.filter-toggle.active::after {
    transform: translateX(20px);
}

/* Lists Filter (Chips style with icons) */
.filter-lists {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-list-chip {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 20px;
    font-size: 14px;
    color: #4B5563;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-list-chip svg {
    width: 16px;
    height: 16px;
    margin-right: 6px;
    fill: none;
}

/* Цветные иконки для списков */
.filter-list-chip[data-list="want_to_go"] svg {
    stroke: #F59E0B;
}

.filter-list-chip[data-list="favorite"] svg {
    stroke: #EF4444;
}

.filter-list-chip[data-list="hidden"] svg {
    stroke: #9CA3AF;
}

.filter-list-chip.active {
    background: #10B981;
    border-color: #10B981;
    color: white;
}

.filter-list-chip.active svg {
    stroke: white;
}

/* Friends filter in modal */
.filter-friends-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-friend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 6px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 20px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s ease;
}

.filter-friend-item:active {
    transform: scale(0.97);
}

.filter-friend-item.active {
    background: #ECFDF5;
    border-color: #10B981;
    color: #065F46;
}

.filter-friend-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    flex-shrink: 0;
}

.filter-friend-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.filter-friend-avatar span {
    font-size: 12px;
    font-weight: 600;
    color: #6B7280;
}

.filter-friend-name {
    font-weight: 500;
    white-space: nowrap;
}

/* Expandable Categories */
.filter-category-expandable {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.filter-category-expandable:last-child {
    border-bottom: none;
}

.filter-category-header {
    display: flex;
    align-items: center;
    padding: 14px 0;
    cursor: pointer;
}

.filter-category-arrow {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    transition: transform 0.2s;
}

.filter-category-arrow svg {
    width: 12px;
    height: 12px;
    stroke: #9CA3AF;
}

.filter-category-expandable.expanded .filter-category-arrow {
    transform: rotate(90deg);
}

.filter-category-name {
    flex: 1;
    font-size: 15px;
    color: #1F2937;
}

.filter-category-expandable.has-selection .filter-category-name {
    color: #10B981;
    font-weight: 500;
}

.filter-category-check {
    width: 22px;
    height: 22px;
    border: 2px solid #D1D5DB;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.filter-category-check.active {
    background: #10B981;
    border-color: #10B981;
}

.filter-category-check svg {
    display: none;
    stroke: white;
    width: 14px;
    height: 14px;
}

.filter-category-check.active svg {
    display: block;
}

/* Subtypes List */
.filter-subtypes {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}

.filter-category-expandable.expanded .filter-subtypes {
    max-height: 500px;
}

.filter-subtype-item {
    display: flex;
    align-items: center;
    padding: 10px 0 10px 30px;
    cursor: pointer;
}

.filter-subtype-check {
    width: 18px;
    height: 18px;
    border: 2px solid #D1D5DB;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    flex-shrink: 0;
}

.filter-subtype-check.active {
    background: #10B981;
    border-color: #10B981;
}

.filter-subtype-check svg {
    display: none;
    stroke: white;
    width: 12px;
    height: 12px;
}

.filter-subtype-check.active svg {
    display: block;
}

.filter-subtype-name {
    font-size: 14px;
    color: #4B5563;
}

.filter-subtype-item:has(.filter-subtype-check.active) .filter-subtype-name {
    color: #10B981;
    font-weight: 500;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-height: 700px) {
    .bottom-sheet { height: 160px; }
    .photo-gallery { height: 250px; }
}

/* List View */
.list-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding-top: 52px;
    background: #F9FAFB;
    z-index: 50;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.list-view.hidden {
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
    display: none;
}

/* Map Button */
.map-btn {
    position: fixed;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(31, 41, 55, 0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: white;
    border: none;
    border-radius: 24px;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: manipulation;
}

.map-btn:active {
    transform: translateX(-50%) scale(0.95);
}

body.view-list .map-btn {
    display: flex;
}

body.view-map .map-btn {
    display: none;
}

/* List Button */
.list-btn {
    position: fixed;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(31, 41, 55, 0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: white;
    border: none;
    border-radius: 24px;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: manipulation;
}

.list-btn:active {
    transform: translateX(-50%) scale(0.95);
}

body.view-list .list-btn {
    display: none;
}

body.view-map .list-btn {
    display: flex;
}

.list-btn.hidden {
    display: none !important;
}

#list-container {
    padding: 16px;
    padding-top: calc(env(safe-area-inset-top, 0px) + 70px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 160px;
}

.list-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    touch-action: manipulation;
    display: flex !important;
    flex-direction: row !important;
    height: 168px;
}

.list-card:active {
    transform: scale(0.99);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.list-card-image-wrapper {
    position: relative;
    width: 168px;
    min-width: 168px;
    height: 168px;
    background: linear-gradient(135deg, #f5f5f5 0%, #e5e5e5 100%);
    overflow: hidden;
    border-radius: 20px 0 0 20px;
}

.list-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.list-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 72px;
    background: linear-gradient(135deg, #f5f5f5 0%, #e5e5e5 100%);
}

/* Actions bar at bottom of list card */
.list-card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px 12px 16px;
    gap: 12px;
}

/* Bookmark button at bottom of list card */
.list-card-bookmark-bottom {
    width: 34px;
    height: 34px;
    background: white;
    border: 1px solid #F3F4F6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: none;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.list-card-bookmark-bottom:active {
    transform: scale(0.95);
    background: #FFFBF0;
}

.list-card-bookmark-bottom svg {
    width: 17px;
    height: 17px;
    stroke: #E5C687;
    stroke-width: 1.5;
    fill: #F5DEB3;
}

/* Heart icon for favorites - red on white */
.list-card-bookmark-bottom[data-status="favorite"] svg {
    fill: #EF4444;
    stroke: #EF4444;
    stroke-width: 1.5;
}

/* Add button for friend spots in list view */
.list-card-add-btn {
    width: 34px;
    height: 34px;
    background: #10B981;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
    transition: transform 0.15s ease, background 0.15s ease;
}

.list-card-add-btn:active {
    transform: scale(0.95);
    background: #059669;
}

.list-card-add-btn svg {
    width: 17px;
    height: 17px;
    stroke: white;
    stroke-width: 2;
    fill: none;
}

.list-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}

.list-card-info {
    padding: 12px 16px 0 16px;
}

.list-card-title {
    font-size: 17px;
    font-weight: 600;
    color: #1F2937;
    margin-bottom: 4px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.list-card-distance {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 500;
    color: #6B7280;
    white-space: nowrap;
    flex-shrink: 0;
}

.list-card-description {
    font-size: 13px;
    color: #6B7280;
    line-height: 1.4;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.list-card-address {
    font-size: 12px;
    color: #9CA3AF;
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-card-category {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(255, 255, 255, 0.95);
    padding: 3px 6px;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 500;
    color: #1F2937;
    text-transform: capitalize;
    letter-spacing: 0;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* List card meta row - contains hours and rating */
.list-card-meta {
    margin-top: 4px;
    margin-bottom: 6px;
    line-height: 1.4;
    font-size: 12px;
    color: #6B7280;
}

/* Working hours in list cards (matching compact view style) */
.list-card-hours {
    font-size: 12px;
    font-weight: 500;
    color: #9CA3AF;
    line-height: inherit;
}

.list-card-hours-open {
    color: #10B981 !important;
}

.list-card-hours-closing-soon {
    color: #F59E0B !important;
}

.list-card-hours-closed {
    color: #EF4444 !important;
}

.list-card-price {
    font-size: 12px;
    font-weight: 500;
    color: #6B7280;
    margin-top: 2px;
}

.list-card-distance-inline {
    font-size: 12px;
    font-weight: 500;
    color: #6B7280;
}

/* Rating badge at bottom of list card (matching direction-btn from compact view) */
.list-card-rating-bottom {
    height: 34px;
    padding: 0 4px 0 12px;
    background: white;
    border: 1px solid #F3F4F6;
    border-radius: 17px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    box-shadow: none;
    flex-shrink: 0;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.list-card-rating-bottom:active {
    transform: scale(0.95);
    background: #F9FAFB;
}

.list-card-rating-value {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}

.list-card-rating-icon {
    width: 28px;
    height: 28px;
    margin: -2px;
    border-radius: 50%;
    background: #F3F4F6;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.list-card-rating-icon svg {
    width: 14px;
    height: 14px;
}

/* Hide geolocation and center-city buttons in list view */
.list-view:not(.hidden) ~ #geolocation-btn,
.list-view:not(.hidden) ~ #center-city-btn {
    opacity: 0;
    pointer-events: none;
}


/* Profile Sidebar */
.profile-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: white;
    z-index: 1200;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0) 0;
    will-change: transform;
}

.profile-sidebar.active {
    transform: translateX(0);
}

.profile-close {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 16px);
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: #F3F4F6;
    border-radius: 50%;
    color: #6B7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.profile-close:hover {
    background: #E5E7EB;
}

.profile-header {
    padding: calc(env(safe-area-inset-top, 0px) + 60px) 24px 24px;
    border-bottom: 1px solid #F3F4F6;
    text-align: center;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.profile-greeting {
    font-size: 18px;
    font-weight: 600;
    color: #1F2937;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
}

.profile-menu {
    flex: 1;
    padding: 8px 0;
    overflow-y: auto;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    color: #1F2937;
    text-decoration: none;
    transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.profile-menu-item:hover,
.profile-menu-item:active {
    background: #F9FAFB;
}

.profile-menu-item svg {
    flex-shrink: 0;
    color: #6B7280;
}

.profile-menu-item span {
    font-size: 15px;
    font-weight: 500;
}

/* Overlay for sidebar */
.overlay.profile-active {
    display: block;
    z-index: 1199;
}

/* Filter Panel */
.filter-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1100;
    display: none;
    animation: fadeIn 0.2s ease;
}

.filter-overlay.active {
    display: block;
}

.filter-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 24px 24px 0 0;
    z-index: 1101;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.2);
}

.filter-panel.active {
    transform: translateY(0);
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 16px;
    border-bottom: 1px solid #F3F4F6;
}

.filter-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: #1F2937;
    margin: 0;
}

.filter-close {
    width: 36px;
    height: 36px;
    background: #F3F4F6;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6B7280;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: manipulation;
}

.filter-close:active {
    background: #E5E7EB;
    transform: scale(0.9);
}

.filter-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
}

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

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #1F2937;
    margin-bottom: 12px;
}

.filter-slider-container {
    background: #F9FAFB;
    padding: 16px;
    border-radius: 12px;
}

.filter-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #E5E7EB;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.filter-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #10B981;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-slider::-webkit-slider-thumb:active {
    transform: scale(1.2);
}

.filter-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #10B981;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-slider::-moz-range-thumb:active {
    transform: scale(1.2);
}

.filter-slider-value {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    font-size: 16px;
    font-weight: 600;
    color: #1F2937;
}

.filter-slider-icon {
    font-size: 18px;
}

.filter-select {
    width: 100%;
    padding: 14px 16px;
    background: #F9FAFB;
    border: 2px solid transparent;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    color: #1F2937;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.filter-select:focus {
    border-color: #10B981;
    background-color: white;
}

.filter-select option:disabled {
    color: #9CA3AF;
}

.enable-location-btn {
    width: 100%;
    padding: 14px 16px;
    background: #F0FDF4;
    border: 2px solid #10B981;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    color: #10B981;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.enable-location-btn:active {
    transform: scale(0.98);
    background: #DCFCE7;
}

.enable-location-btn.active {
    background: #10B981;
    color: white;
}

.filter-actions {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #F3F4F6;
    background: white;
}

.filter-btn {
    flex: 1;
    padding: 16px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: manipulation;
}

.filter-btn-secondary {
    background: #F3F4F6;
    color: #6B7280;
}

.filter-btn-secondary:active {
    background: #E5E7EB;
    transform: scale(0.98);
}

.filter-btn-primary {
    background: #10B981;
    color: white;
}

.filter-btn-primary:active {
    background: #059669;
    transform: scale(0.98);
}

/* Categories Filter */
.categories-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-item {
    display: flex;
    align-items: center;
    background: #F9FAFB;
    padding: 14px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: manipulation;
}

.category-item:active {
    background: #F3F4F6;
    transform: scale(0.98);
}

.category-item input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: #10B981;
}

.category-item label {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
    color: #1F2937;
    cursor: pointer;
    user-select: none;
}

/* List view bookmark menu */
.list-bookmark-menu {
    position: fixed;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 8px;
    z-index: 10001;
    min-width: 180px;
    opacity: 1;
    transform: translateY(0) scale(1);
    transform-origin: top left;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.list-bookmark-menu.hidden {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    pointer-events: none;
}

/* ========================================
   Bottom Tab Bar Navigation - Floating Pill
   ======================================== */

#tab-bar {
    position: fixed;
    bottom: calc(40px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    height: 50px;
    padding: 0 6px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    border: none;
    border-radius: 25px;
    display: flex;
    gap: 2px;
    align-items: center;
    z-index: 500;
}

/* Map/List segment toggle - iOS style */
.tab-segment {
    display: flex;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 19px;
    padding: 3px;
    margin-right: 2px;
    position: relative;
}

/* Sliding indicator */
.tab-segment::before {
    content: '';
    position: absolute;
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 17px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    left: 3px;
    top: 3px;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}

.tab-segment.list-active::before {
    transform: translateX(38px);
}

.segment-option {
    width: 38px;
    height: 38px;
    border-radius: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
}

.segment-option svg {
    stroke: #6B7280;
    transition: stroke 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.segment-option.active svg {
    stroke: #10B981;
}

.segment-option:active {
    transform: scale(0.95);
}

/* Tab items */
.tab-item {
    width: 44px;
    height: 44px;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s ease, background 0.2s ease;
}

.tab-item:active {
    transform: scale(0.9);
    background: rgba(0, 0, 0, 0.05);
}

.tab-item svg {
    stroke: #6B7280;
    fill: none;
    transition: stroke 0.2s ease;
}

.tab-item.active svg {
    stroke: #10B981;
}

/* Hide tab bar when expanded card is open */
body.card-expanded #tab-bar {
    display: none;
}

/* Segment always visible - clicking returns to explore tab */

/* ========================================
   Placeholder Pages
   ======================================== */

.page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #F9FAFB;
    z-index: 90;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.page:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.page.hidden {
    visibility: hidden;
}

.page-content {
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.page-placeholder {
    text-align: center;
    max-width: 280px;
}

.page-placeholder svg {
    margin-bottom: 24px;
    opacity: 0.6;
}

.page-placeholder h2 {
    font-size: 22px;
    font-weight: 600;
    color: #1F2937;
    margin-bottom: 8px;
}

.page-placeholder p {
    font-size: 15px;
    color: #6B7280;
    margin-bottom: 20px;
    line-height: 1.5;
}

.page-placeholder .coming-soon {
    display: inline-block;
    padding: 8px 16px;
    background: #10B981;
    color: white;
    font-size: 13px;
    font-weight: 600;
    border-radius: 20px;
}

/* ===== COLLECTIONS PAGE (Pinterest style) ===== */

#page-collections .page-content {
    align-items: flex-start;
    justify-content: flex-start;
    flex-direction: column;
    padding: 0;
}

.collections-header {
    padding: 20px 20px 16px;
    width: 100%;
}

.collections-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: #1F2937;
}

.collections-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0 16px 20px;
    width: 100%;
}

.collection-tile {
    aspect-ratio: 4/5;
    border-radius: 16px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.collection-tile:active {
    transform: scale(0.97);
}

/* Subscribe button on friend collection tiles */
.collection-subscribe-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    color: #6B7280;
}

.collection-subscribe-btn:active {
    transform: scale(0.9);
}

.collection-subscribe-btn.subscribed {
    background: #10B981;
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.collection-subscribe-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Cover photo */
.collection-tile-cover {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    background-color: #E5E7EB;
}

/* Fallback градиенты для коллекций без фото */
.collection-tile-cover.no-photo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.collection-tile-cover.gradient-1 { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.collection-tile-cover.gradient-2 { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.collection-tile-cover.gradient-3 { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.collection-tile-cover.gradient-4 { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.collection-tile-cover.gradient-5 { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }
.collection-tile-cover.gradient-6 { background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%); }
.collection-tile-cover.gradient-7 { background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%); }
.collection-tile-cover.gradient-8 { background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%); }

.collection-tile-emoji {
    font-size: 56px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Info overlay at bottom */
.collection-tile-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 14px 14px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.4) 50%, transparent 100%);
}

.collection-tile-name {
    font-size: 17px;
    font-weight: 600;
    color: white;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.collection-tile-count {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
}

/* Create Collection tile */
.create-collection-tile {
    cursor: default;
    border: 2px dashed #D1D5DB;
    position: relative;
}

.create-collection-tile:active {
    transform: none;
}

.create-collection-tile .collection-tile-cover {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 60px;
    background: #E5E7EB;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.create-collection-tile .collection-tile-info {
    background: #E5E7EB;
}

.create-collection-tile .collection-tile-name {
    color: #1F2937;
}

.create-collection-tile .collection-tile-count {
    color: #4B5563;
}

.create-collection-icon {
    font-size: 36px;
    font-weight: 200;
    color: #9CA3AF;
    line-height: 1;
}

.coming-soon-badge {
    background: #10B981;
    color: white;
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

.collection-edit-btn {
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.2s;
    padding: 0;
}

.collection-edit-btn:hover {
    opacity: 1;
}

.collection-edit-btn svg {
    stroke: #1F2937;
    width: 20px;
    height: 20px;
}

.collection-filter-btn {
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.2s;
    padding: 0;
}

.collection-filter-btn:hover {
    opacity: 1;
}

.collection-filter-btn.active {
    background: #10B981;
    opacity: 1;
    border-radius: 50%;
}

.collection-filter-btn.active svg {
    stroke: white;
    color: white;
}

.collection-filter-btn svg {
    stroke: #1F2937;
    color: #1F2937;
    width: 20px;
    height: 20px;
}

/* Collection Cover Upload Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 0;
    max-width: 280px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1F2937;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6B7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #F3F4F6;
    color: #1F2937;
}

.modal-body {
    padding: 20px;
}

/* Collection Cover Card (in modal) - styled like collection tile */
.collection-cover-card {
    aspect-ratio: 4/5;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    margin: 0 auto 20px;
    max-width: 180px;
    position: relative;
}

.collection-cover-card-image {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.collection-cover-card-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 14px 14px;
    background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.7));
}

.cover-card-city {
    font-size: 17px;
    font-weight: 600;
    color: white;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cover-card-spots {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
}

.upload-btn-wrapper {
    text-align: center;
}

.upload-photo-btn {
    padding: 12px 20px;
    background: #10B981;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.upload-photo-btn:hover {
    background: #059669;
}

.upload-photo-btn:disabled {
    background: #D1D5DB;
    cursor: not-allowed;
}

.upload-photo-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.collections-empty {
    text-align: center;
    padding: 60px 20px;
    width: 100%;
}

.collections-empty.hidden {
    display: none;
}

.collections-empty svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.collections-empty p {
    font-size: 18px;
    font-weight: 600;
    color: #6B7280;
    margin-bottom: 8px;
}

.collections-empty span {
    font-size: 14px;
    color: #9CA3AF;
}

/* ===== COLLECTION SPOTS VIEW ===== */

#collection-spots-view {
    background: #F9FAFB;
}

.collection-spots-header {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10;
}

.collection-spots-header .back-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.collection-spots-header .back-btn svg {
    color: #1F2937;
}

.collection-title h2 {
    font-size: 20px;
    font-weight: 700;
    color: #1F2937;
    margin: 0;
}

.collection-title span {
    font-size: 13px;
    color: #6B7280;
}

.collection-header-spacer {
    flex: 1;
}

.collection-filters-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: transparent;
    position: sticky;
    top: 72px;
    z-index: 9;
}

.collection-filters-bar .icon-btn {
    flex-shrink: 0;
}

#collection-category-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    flex: 1;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

#collection-category-chips::-webkit-scrollbar {
    display: none;
}


.collection-spots-list {
    padding: 16px;
    padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

/* Pinterest-style spot cards with overlay */
.collection-spot-card {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    /* Fallback for browsers without aspect-ratio support (iOS < 15) */
    padding-bottom: 125%; /* 5/4 = 1.25 = 125% */
    height: 0;
}

/* Modern browsers with aspect-ratio support */
@supports (aspect-ratio: 4/5) {
    .collection-spot-card {
        aspect-ratio: 4/5;
        padding-bottom: 0;
        height: auto;
    }
}

.collection-spot-card:active {
    transform: scale(0.98);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.collection-spot-card img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #F3F4F6;
}

.collection-spot-card-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f5f5f5 0%, #e5e5e5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
}

.collection-spot-card-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 12px 12px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.4) 50%, transparent 100%);
}

.collection-spot-card-name {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.3;
    color: white;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.collection-spot-card-desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== FRIENDS PAGE ===== */
#page-friends .page-content {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    min-height: 100%;
    padding: 20px;
    padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
}

.friends-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    width: 100%;
}

.friends-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: #1F2937;
    margin: 0;
}

/* Share icon button in header */
.share-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #34D399 0%, #10B981 100%);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.share-icon-btn:active {
    transform: scale(0.95);
}

.share-icon-btn svg {
    stroke: white;
}

/* Friends list */
.friends-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

/* Add friend button at bottom of list */
.add-friend-btn {
    width: 100%;
    max-width: 150px;
    margin: 16px auto 0;
    padding: 9px 18px;
    background: linear-gradient(135deg, #34D399 0%, #10B981 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: block;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.add-friend-btn:active {
    transform: scale(0.98);
}

.friend-item {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.friend-item-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
}

.friend-item-content:active {
    background: #F9FAFB;
}

.friend-item.swiped .friend-item-content {
    transform: translateX(-80px);
}

.friend-delete-btn {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 80px;
    background: #EF4444;
    color: white;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.friend-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #E5E7EB 0%, #D1D5DB 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.friend-avatar svg {
    width: 24px;
    height: 24px;
    stroke: #6B7280;
}

.friend-info {
    flex: 1;
    min-width: 0;
}

.friend-name {
    font-size: 16px;
    font-weight: 600;
    color: #1F2937;
    margin: 0 0 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.friend-username {
    font-size: 13px;
    color: #6B7280;
}

.friend-arrow {
    flex-shrink: 0;
    color: #9CA3AF;
}

.friend-arrow svg {
    width: 20px;
    height: 20px;
}

/* Friends empty state */
.friends-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    width: 100%;
}

.friends-empty.hidden {
    display: none;
}

.friends-empty svg {
    margin-bottom: 16px;
}

.friends-empty p {
    font-size: 17px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 8px 0;
}

.friends-empty span {
    font-size: 14px;
    color: #6B7280;
}

/* ===== COLLECTION SPOT EXPANDED ===== */
#collection-spot-expanded {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    background: white;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    pointer-events: auto !important;
}

#collection-spot-expanded * {
    pointer-events: auto;
}

#collection-spot-expanded .expanded-card {
    display: flex !important;
    flex-direction: column;
    min-height: 100%;
}

#collection-spot-expanded .photo-gallery {
    width: 100%;
    height: 48vh;
    flex-shrink: 0;
    pointer-events: auto !important;
}

#collection-spot-expanded .gallery-track {
    height: 100%;
    touch-action: pan-x;
    pointer-events: auto !important;
}

#collection-spot-expanded .gallery-image {
    height: 100%;
    object-fit: cover;
}

#collection-spot-expanded .expanded-content {
    padding: 24px 20px 80px 20px;
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
}


/* Debug Logger Button */
.debug-logger-btn {
    position: fixed;
    bottom: 120px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.9);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 99999;
    cursor: pointer;
    transition: transform 0.2s;
}

.debug-logger-btn:active {
    transform: scale(0.95);
}

.debug-logger-btn svg {
    color: white;
}

/* Debug Logger Modal */
.debug-logger-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 100000;
    display: flex;
    flex-direction: column;
}

.debug-logger-modal.hidden {
    display: none;
}

.debug-logger-header {
    padding: 16px 20px;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #F9FAFB;
}

.debug-logger-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.debug-logger-controls {
    display: flex;
    gap: 8px;
}

.debug-btn {
    padding: 6px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    cursor: pointer;
}

.debug-btn:active {
    background: #F3F4F6;
}

.debug-logger-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    font-family: "Monaco", "Courier New", monospace;
    font-size: 11px;
    line-height: 1.4;
    background: #1F2937;
    color: #F3F4F6;
}

.debug-log-entry {
    padding: 6px 8px;
    margin-bottom: 4px;
    border-radius: 4px;
    background: rgba(255,255,255,0.05);
    border-left: 3px solid #6B7280;
    word-wrap: break-word;
}

.debug-log-entry.error {
    border-left-color: #EF4444;
    background: rgba(239, 68, 68, 0.1);
}

.debug-log-entry.warn {
    border-left-color: #F59E0B;
    background: rgba(245, 158, 11, 0.1);
}

.debug-log-entry.info {
    border-left-color: #3B82F6;
    background: rgba(59, 130, 246, 0.1);
}

.debug-log-timestamp {
    color: #9CA3AF;
    font-size: 10px;
    margin-right: 8px;
}

/* ===== FRIENDS FILTER MODAL ===== */

/* Modal overlay */
.filter-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.filter-modal-overlay.closing {
    animation: fadeOut 0.2s ease forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
    }
}

.filter-modal-content {
    background: white;
    border-radius: 20px;
    padding: 0;
    max-width: 320px;
    width: 90%;
    max-height: 70vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.filter-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1F2937;
}

.filter-modal-close {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #6B7280;
}

.filter-modal-actions {
    padding: 16px 20px;
    border-top: 1px solid #E5E7EB;
    display: flex;
    gap: 12px;
}

.filter-modal-clear,
.filter-modal-apply {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
}

.filter-modal-clear {
    background: #F3F4F6;
    color: #6B7280;
}

.filter-modal-apply {
    background: #10B981;
    color: white;
}

.friends-modal-content {
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}

.friend-filter-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.friend-filter-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    gap: 12px;
}

.friend-filter-item:active {
    background: rgba(0, 0, 0, 0.05);
}

.friend-filter-item.selected {
    background: rgba(16, 185, 129, 0.08);
}

.friend-filter-color {
    width: 4px;
    height: 32px;
    border-radius: 2px;
    flex-shrink: 0;
}

.friend-filter-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.friend-filter-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.friend-filter-avatar span {
    font-size: 16px;
    font-weight: 600;
    color: #6B7280;
}

.friend-filter-info {
    flex: 1;
    min-width: 0;
}

.friend-filter-name {
    font-size: 15px;
    font-weight: 600;
    color: #1F2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.friend-filter-spots {
    font-size: 13px;
    color: #6B7280;
    margin-top: 2px;
}

.friend-filter-check {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease;
    color: #10B981;
}

.friend-filter-item.selected .friend-filter-check {
    opacity: 1;
}

.friend-filter-empty {
    padding: 40px 16px;
    text-align: center;
    color: #6B7280;
    font-size: 14px;
}

/* Friends chip styling */
.category-chip.friends-chip {
    display: flex;
    align-items: center;
    gap: 6px;
}

.category-chip.friends-chip svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: white;
    color: #1F2937;
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    font-size: 15px;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;
    pointer-events: none;
    max-width: 300px;
    text-align: center;
}

.toast.active {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.toast-success {
    background: #10B981;
    color: white;
}

.toast.toast-error {
    background: #EF4444;
    color: white;
}

.toast.toast-info {
    background: #3B82F6;
    color: white;
}

/* ===== FRIEND SPOTS IN COMPACT CARDS ===== */

/* Friend badge (avatar) on compact card - top right corner */
.friend-card-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid;
    background: white;
    overflow: hidden;
    z-index: 15;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}

.friend-card-badge img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.friend-card-badge .friend-initials {
    font-size: 13px;
    font-weight: 600;
    color: #6B7280;
}

/* Overlap badge - on USER's card when it overlaps with friend's spot */
.overlap-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid;
    background: white;
    overflow: hidden;
    z-index: 15;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}

.overlap-badge img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.overlap-badge .overlap-initials {
    font-size: 11px;
    font-weight: 600;
    color: #6B7280;
}

/* Stacked overlap badge - shows both user and friend avatars */
.overlap-badge-stack {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 44px;
    height: 28px;
    z-index: 15;
}

.overlap-badge-avatar {
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.overlap-badge-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Friend avatar - back, left */
.overlap-badge-back {
    left: 0;
    top: 0;
    z-index: 1;
}

/* User avatar - front, right */
.overlap-badge-front {
    right: 0;
    bottom: 0;
    z-index: 2;
}

/* Counter for additional friends on card badge */
.overlap-badge-stack.has-counter {
    width: 54px;
}

.overlap-badge-counter {
    position: absolute;
    right: -4px;
    top: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: #10B981;
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Counter badge for friend-card-badge (used with gold border overlap) */
.friend-badge-count {
    position: absolute;
    bottom: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    padding: 0 3px;
    background: #10B981;
    color: white;
    font-size: 10px;
    font-weight: 600;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Overlap avatar on map markers - no special border, gold is on the marker */
.friend-marker-avatar.overlap-avatar-gold {
    overflow: visible;
}

/* Counter on overlap marker avatar - to the right, gray */
.overlap-avatar-count {
    position: absolute;
    top: 50%;
    right: -18px;
    transform: translateY(-50%);
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
    background: #6B7280;
    color: white;
    font-size: 9px;
    font-weight: 600;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Add friend spot button - replaces bookmark for friend spots (compact view) */
#add-friend-spot-btn {
    position: absolute;
    bottom: 12px;
    left: 164px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #10B981;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 30;
    box-shadow: 0 2px 12px rgba(16, 185, 129, 0.4);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: manipulation;
}

#add-friend-spot-btn:active {
    transform: scale(0.95);
    background: #059669;
}

#add-friend-spot-btn svg {
    width: 18px;
    height: 18px;
}

#add-friend-spot-btn.added {
    background: #059669;
}

/* Add friend spot button - expanded view (in controls bar) */
.add-friend-spot-btn-expanded {
    position: static;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #10B981;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(16, 185, 129, 0.4);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: manipulation;
}

.add-friend-spot-btn-expanded:active {
    transform: scale(0.95);
    background: #059669;
}

.add-friend-spot-btn-expanded svg {
    width: 18px;
    height: 18px;
}

.add-friend-spot-btn-expanded.added {
    background: #059669;
}

