/* Data page specific styles */

/* Search and Stats Bar */
.search-stats-bar {
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
}

/* Responsive search box wrapper */
.search-box {
    max-width: 500px;
    width: 100%;
}

/* Stats counter */
.stats-counter {
    padding: 8px 16px;
    border-radius: 8px;
    background: #e8f5d0;
    border: 1px solid #c8e4a0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.stats-counter strong {
    color: #3A5A40;
}

/* Keyword filter buttons */
.keyword-filter {
    cursor: pointer;
    transition: all 0.2s ease;
}

.keyword-filter.active {
    background-color: var(--sport-primary);
    color: white;
    border-color: var(--sport-primary);
}

.keyword-filter.active:hover {
    background-color: var(--sport-secondary);
    border-color: var(--sport-secondary);
}

/* Filter section */
.filter-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.filter-section.collapsed #filterContent {
    display: block;
}

.filter-section.collapsed.hide-filters #filterContent {
    display: none;
}

#toggleFilters {
    color: #3A5A40;
    font-weight: 500;
}

#toggleFilters:hover {
    color: #2d4631;
}

#toggleFilters i {
    transition: transform 0.3s ease;
}

.filter-section.hide-filters #toggleFilters i {
    transform: rotate(-90deg);
}

/* Data Page Sidebar Layout */
.data-page-layout {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.filters-sidebar {
    width: 280px;
    min-width: 280px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
    height: fit-content;
    transition: all 0.3s ease;
    overflow: hidden;
    margin-bottom: 30px;
}

.filters-sidebar.collapsed {
    width: 0;
    min-width: 0;
    padding: 0;
    border: none;
    box-shadow: none;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8f9fa;
    border-radius: 10px 10px 0 0;
}

.sidebar-header h5 {
    font-size: 1rem;
    font-weight: 600;
    color: #000000;
}

.sidebar-header button {
    color: #6c757d;
    padding: 4px 8px;
    transition: all 0.2s ease;
}

.sidebar-header button:hover {
    color: #3A5A40;
}

.sidebar-content {
    padding: 15px;
}

.filters-sidebar.collapsed .sidebar-header,
.filters-sidebar.collapsed .sidebar-content {
    display: none;
}

.content-area {
    flex: 1;
    min-width: 0;
    transition: all 0.3s ease;
}

.content-area.expanded {
    margin-left: 0;
}

/* Floating Action Button for reopening sidebar */
.sidebar-toggle-fab {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: #3A5A40;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    transition: all 0.3s ease;
    font-size: 18px;
}

.sidebar-toggle-fab:hover {
    background: #2d4532;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

.sidebar-toggle-fab:active {
    transform: translateY(-50%) scale(0.95);
}

/* Sport Type Multilevel Dropdown */
.sport-type-dropdown {
    position: relative;
}

.sport-type-dropdown .form-select {
    cursor: pointer;
    user-select: none;
}

.dropdown-panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.125rem;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 9999;
}

.sport-type-dropdown.open .dropdown-panel {
    display: block;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    position: relative;
    transition: background-color 0.15s;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
}

.dropdown-item:active {
    background-color: #e9ecef;
}

.dropdown-divider {
    height: 0;
    margin: 0.5rem 0;
    overflow: hidden;
    border-top: 1px solid #dee2e6;
}

.dropdown-item.has-children {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-right: 2rem;
}

.dropdown-item .arrow {
    position: absolute;
    right: 1rem;
    font-size: 1.2rem;
    color: #6c757d;
    transition: transform 0.2s;
}

.dropdown-item.has-children.expanded .arrow {
    transform: rotate(90deg);
}

.dropdown-submenu {
    display: none;
    background: #f8f9fa;
    padding-left: 1rem;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.dropdown-item.has-children.expanded .dropdown-submenu {
    display: block;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
    }
}

/* Desktop styles */
@media (min-width: 768px) {
    .dropdown-submenu {
        position: fixed;
        min-width: 250px;
        background: white;
        border: 1px solid #dee2e6;
        border-radius: 0.25rem;
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
        max-height: 400px;
        overflow-y: auto;
        z-index: 1050;
        padding-left: 0;
        animation: none;
    }
    
    .dropdown-item.has-children:hover .dropdown-submenu {
        display: block;
    }
    
    /* Ensure submenu stays open when hovering over it */
    .dropdown-submenu:hover {
        display: block;
    }
    
    /* Disable expanded state on desktop - hover only */
    .dropdown-item.has-children.expanded .dropdown-submenu {
        display: none;
    }
    
    .dropdown-item.has-children.expanded .arrow {
        transform: none;
    }
}

/* Address selection dialog */
.address-selection-dialog {
    margin-top: 10px;
    margin-bottom: 15px;
    max-width: 100%;
}

.address-selection-dialog .list-group-item {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.address-selection-dialog .list-group-item:hover {
    background-color: #f8f9fa;
}

.address-selection-dialog h6 {
    margin-bottom: 12px;
    color: #0c5460;
}

/* Mobile responsiveness */
@media (max-width: 991px) {
    .data-page-layout {
        flex-direction: column;
    }
    
    .filters-sidebar {
        width: 100%;
        min-width: 100%;
        position: relative;
        top: 0;
    }
    
    .filters-sidebar.collapsed {
        width: 100%;
        min-width: 100%;
        height: 50px;
        border: 1px solid #e2e8f0;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    }
    
    .filters-sidebar.collapsed .sidebar-header {
        display: flex;
        padding: 10px 15px;
    }
    
    .sidebar-content {
        max-height: 70vh;
    }
    
    .sidebar-toggle-fab {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .search-stats-bar {
        flex-direction: column;
        gap: 15px;
    }
    
    .search-stats-bar > div {
        width: 100%;
        max-width: none !important;
    }
    
    .stats-counter {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .filters-sidebar {
        border-radius: 8px;
    }
    
    .sidebar-header h5 {
        font-size: 0.9rem;
    }
    
    .sidebar-content {
        padding: 12px;
    }
}

/* Activity description clamp to keep cards compact on small screens */
.activity-description {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 4.8em; /* fallback .tab-content approximate for non-webkit */
}

#map-view {
    margin: -20px;
    padding: 0;
}