/* Responsive Sidebar Styles */
@media (max-width: 697px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 50;
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
    }
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    .main-content {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
    .right-sidebar {
        display: none !important;
    }
    /* Hide auth links when logged in on mobile */
    body .auth-links-hidden #auth-links-container,
    .auth-links-hidden #auth-links-container {
        display: none !important;
        visibility: hidden !important;
    }
    /* Show mobile logo button */
    .mobile-logo-btn {
        display: flex !important;
        visibility: visible !important;
    }
    /* Sidebar overlay when open on mobile */
    .sidebar-overlay {
        display: none;
    }
    .sidebar-overlay.active {
        display: block;
    }
}

/* Hide mobile logo button on larger screens */
.mobile-logo-btn {
    display: none;
}

/* Sidebar overlay (hidden by default) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
    transition: opacity 0.3s ease;
}

@media (max-width: 697px) {
    .sidebar-overlay.active {
        display: block;
    }
}

/* Sidebar: Icon-only with hover tooltips (like Threads/Instagram) */
@media (min-width: 698px) {
    .header-bar {
        left: 60px; /* Align with sidebar width */
    }
    .header-bar > div {
        padding-left: 100px; /* Clear gap so header content isn't under sidebar (profile, venues, support, events) */
    }
    .sidebar {
        width: 60px !important;
        z-index: 100 !important;
        overflow: visible !important;
    }
    .sidebar-text {
        display: none !important;
    }
    .main-content {
        margin-left: 60px !important;
        width: calc(100% - 60px) !important;
        max-width: calc(100% - 60px) !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
    
    /* Tooltip styling */
    .sidebar-tooltip {
        position: absolute;
        left: 100%;
        margin-left: 12px;
        padding: 6px 12px;
        background-color: rgba(0, 0, 0, 0.8);
        color: white;
        font-size: 0.875rem;
        white-space: nowrap;
        border-radius: 6px;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
        z-index: 99999 !important;
        top: 50%;
        transform: translateY(-50%);
    }
    
    /* Ensure sidebar nav items and bottom links allow tooltips to overflow */
    .sidebar-nav-item,
    .sidebar-bottom-link {
        overflow: visible !important;
    }
    
    .sidebar-nav-item:hover .sidebar-tooltip,
    .sidebar-bottom-link:hover .sidebar-tooltip {
        opacity: 1;
    }
    
    /* Tooltip arrow */
    .sidebar-tooltip::before {
        content: '';
        position: absolute;
        right: 100%;
        top: 50%;
        transform: translateY(-50%);
        border: 6px solid transparent;
        border-right-color: rgba(0, 0, 0, 0.8);
    }
}

/* Base Styles */
body {
    font-family: Verdana, Geneva, Tahoma, sans-serif;
}

/* Ensure main content containers don't overflow */
.main-content {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
    padding-top: 60px; /* Space for fixed header bar */
}

main {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.header-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    z-index: 10;
    background: #f9fafb;
}

/* Masonry Grid with fixed card width */
.masonry {
    column-width: 225px;
    column-gap: 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.masonry-item {
    break-inside: avoid;
    margin-bottom: 8px;
    width: 225px;
    box-sizing: border-box;
    display: inline-block;
    vertical-align: top;
}

/* Virtualization placeholder - reserves space when card is virtualized out */
.masonry-item-slot.masonry-slot-placeholder {
    background: #f3f4f6;
    min-height: 350px;
}

/* Legal attribution: Image: Venue Name (shown on hover, excludes ads) */
.image-card-wrapper {
    position: relative;
}
.image-venue-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4px 8px;
    font-size: 0.75rem;
    line-height: 1rem;
    color: white;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}
.image-card-wrapper:hover .image-venue-caption {
    opacity: 1;
}

/* Sentinel for infinite scroll - must span full width */
.feed-sentinel {
    column-span: all;
    break-inside: avoid;
}

/* Mobile: ensure 2 cards side by side on small screens (iPhone SE 375px, iPhone 15 Pro 393px, etc.) */
@media (max-width: 768px) {
    .masonry {
        column-width: 165px;
        column-gap: 8px;
    }
    .masonry-item {
        width: 100%;
    }
}

/* Empty state inside masonry - span full width to avoid column fragmentation */
.masonry-empty-state {
    column-span: all;
    break-inside: avoid;
}

/* Search Bar Styles - Threads-style compact and premium */
.search-bar-container {
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    padding: 12px 16px;
    position: relative;
    z-index: 10;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transform: translateY(-10px);
    transition: max-height 0.3s ease, opacity 0.3s ease, transform 0.3s ease, padding 0.3s ease;
    padding-top: 0;
    padding-bottom: 0;
}

.search-bar-container.active {
    max-height: 100px;
    opacity: 1;
    transform: translateY(0);
    padding-top: 12px;
    padding-bottom: 12px;
}

.search-bar-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
}

.search-bar {
    flex: 1;
    position: relative;
    max-width: 500px;
}

.search-input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    background: #ffffff;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
    font-family: inherit;
}

.search-input:focus {
    background: #ffffff;
    border-color: #000000;
    box-shadow: 0 0 0 1px #000000;
}

.search-icon-wrapper {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 1;
}

.search-icon-wrapper svg {
    width: 16px;
    height: 16px;
    color: #9ca3af;
}

.search-bar:focus-within .search-icon-wrapper svg {
    color: #000000;
}

/* Search Suggestions Dropdown */
.search-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 400px;
    overflow-y: auto;
    z-index: 101;
    display: none;
}

.search-suggestions.active {
    display: block;
}

.search-suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-suggestion-item:last-child {
    border-bottom: none;
}

.search-suggestion-item:hover,
.search-suggestion-item.selected {
    background: #f9fafb;
}

.suggestion-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #6b7280;
}

.suggestion-content {
    flex: 1;
    min-width: 0;
}

.suggestion-title {
    font-size: 14px;
    font-weight: 500;
    color: #000000;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.suggestion-subtitle {
    font-size: 12px;
    color: #6b7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.suggestion-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #f3f4f6;
    color: #6b7280;
    text-transform: capitalize;
    flex-shrink: 0;
}

/* Calendar Filter Wrapper */
.calendar-filter-wrapper {
    position: relative;
    flex-shrink: 0;
}

/* Calendar Filter Button */
.calendar-filter-btn {
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    background: #ffffff;
    font-size: 13px;
    color: #000000;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    position: relative;
    z-index: 1002;
}

.calendar-filter-btn {
    padding-right: 30px;
}

.calendar-clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 999px;
    background: #e5e7eb;
    color: #111827;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1003;
}

.calendar-filter-wrapper.has-date .calendar-clear-btn {
    display: flex;
}

.calendar-filter-wrapper.has-date .calendar-clear-btn:hover {
    background: #d1d5db;
}

.calendar-filter-btn.active + .calendar-clear-btn {
    background: #ffffff;
    color: #111827;
}

.calendar-filter-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.calendar-filter-btn.active {
    background: #000000;
    color: #ffffff;
    border-color: #000000;
}

.calendar-filter-btn svg {
    width: 16px;
    height: 16px;
}

/* Calendar Dropdown */
.calendar-dropdown {
    position: fixed;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 99999;
    display: none;
    min-width: 280px;
    overflow: hidden;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.calendar-dropdown.active {
    display: block;
    visibility: visible;
    opacity: 1;
}

.calendar-options {
    padding: 8px;
}

.calendar-option {
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    color: #000000;
    transition: background 0.15s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.calendar-option:hover {
    background: #f9fafb;
}

.calendar-option.selected {
    background: #f3f4f6;
    font-weight: 500;
}

.calendar-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 8px 0;
}

.calendar-compact {
    padding: 12px;
}

.calendar-compact-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.calendar-compact-title {
    font-size: 14px;
    font-weight: 600;
    color: #000000;
}

.calendar-compact-nav {
    display: flex;
    gap: 8px;
}

.calendar-compact-nav-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.calendar-compact-nav-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.calendar-compact-nav-btn svg {
    width: 14px;
    height: 14px;
    color: #000000;
}

.calendar-compact-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-compact-day-header {
    text-align: center;
    font-size: 11px;
    font-weight: 500;
    color: #6b7280;
    padding: 6px 0;
}

.calendar-compact-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #000000;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.calendar-compact-day:hover {
    background: #f9fafb;
}

.calendar-compact-day.other-month {
    color: #d1d5db;
}

.calendar-compact-day.today {
    background: #000000;
    color: #ffffff;
    font-weight: 600;
}

.calendar-compact-day.selected {
    background: #f3f4f6;
    font-weight: 500;
}

/* Tab Styles */
.tablist {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-button {
    padding: 10px 18px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tab-button:hover {
    color: #000000;
    background-color: #f9fafb;
}

.tab-button[aria-selected="true"] {
    color: #000000;
    border-bottom-color: #000000;
    font-weight: 600;
}

.tab-panel {
    display: none;
}

.tab-panel[aria-hidden="false"] {
    display: block;
}

.tab-panel-content {
    font-size: 13px;
}

/* Utility Classes */
.no-scrollbar {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}
