/* Filter Toggle Button Styles */
.filter-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--mainColor, #005092);
    color: white;
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.filter-toggle-btn:hover {
    transform: scale(1.1);
    background-color: var(--mainColorDark, #003d6f);
}

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

.filter-toggle-btn i {
    font-size: 1.2rem;
}

.filter-toggle-btn[aria-expanded="true"] {
    background-color: var(--mainColorDark, #003d6f);
    transform: rotate(180deg);
}

/* Floating Filter Panel Styles */
.filter-floating-panel {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 300px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    padding: 15px;
    z-index: 1200;
    transition: transform 0.3s ease, opacity 0.3s ease;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.filter-floating-panel.filters-hidden {
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
}

/* Tooltip styles - simplified to only show on hover */
.filter-toggle-btn[data-tooltip]:before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 10px;
    padding: 5px 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 0.8rem;
    border-radius: 4px;
    white-space: nowrap;
    /* Always hidden by default */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* Only show on hover, no other cases */
.filter-toggle-btn[data-tooltip]:hover:before {
    opacity: 1;
    visibility: visible;
}

/* Ensure tooltip is ALWAYS hidden when not hovering */
.filter-toggle-btn[data-tooltip]:not(:hover):before,
.filter-toggle-btn[aria-expanded="true"][data-tooltip]:before,
.filter-toggle-btn[aria-expanded="true"][data-tooltip]:hover:before {
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    /* Hide the main filter container on mobile */
    .filter-container {
        display: none !important;
    }
    
    /* Hide the age category buttons on mobile view */
    .age-category-bar {
        display: none !important;
    }

    /* Make the floating panel take up most of the screen width */
    .filter-floating-panel {
        width: calc(100% - 40px);
        max-height: calc(100vh - 180px);
        /* Ensure the panel has the same styling as the original filter container */
        background-color: var(--mainColorLight, #f5f5f5);
        border: 1px solid rgba(0, 0, 0, 0.1);
    }

    /* Ensure the floating panel's filter groups match the original styling */
    .filter-floating-panel .filter-group {
        width: 100%;
        margin-bottom: 10px;
    }

    .filter-floating-panel select,
    .filter-floating-panel input:not([type="checkbox"]) {
        width: 100%;
        max-width: 100%;
    }
    
    /* Use exactly the same CSS as the main filter checkbox */
    .filter-floating-panel .show-running-toggle input[type="checkbox"] {
        display: block;
        margin: 0 auto;
        transform: scale(1.2);
    }

    /* Ensure date pickers are properly styled */
    .filter-floating-panel .date-range-container {
        flex-direction: column;
        gap: 10px;
    }

    .filter-floating-panel .date-picker {
        width: 100%;
    }
    
    /* Style age category buttons in the floating panel */
    .filter-floating-panel .age-category-bar {
        display: flex !important;
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-top: 15px;
        padding-top: 15px;
        border-top: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    .filter-floating-panel .age-category-bar .age-btn {
        font-size: 0.9rem;
        padding: 0.2em 0.7em;
    }
    
    /* Special handling for tooltips on mobile devices */
    /* Completely disable tooltip on mobile devices to avoid hover artifacts after touch */
    .filter-toggle-btn[data-tooltip]:before {
        display: none !important;
    }
}

/* Extra touch device handling for tooltips */
@media (hover: none) {
    /* For devices that don't support hover (touch devices) */
    .filter-toggle-btn[data-tooltip]:before {
        display: none !important;
    }
}

/* Scrollbar styling for the floating panel */
.filter-floating-panel::-webkit-scrollbar {
    width: 6px;
}

.filter-floating-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.filter-floating-panel::-webkit-scrollbar-thumb {
    background: var(--mainColor, #005092);
    border-radius: 3px;
}

.filter-floating-panel {
    scrollbar-width: thin;
    scrollbar-color: var(--mainColor, #005092) #f1f1f1;
}

/* Animation for the filter button */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.filter-toggle-btn.pulse {
    animation: pulse 1s ease infinite;
} 