/* Floating Filter Bar - Reusable Component */

.floating-filter-bar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    padding: 0.75rem 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 80px;
    z-index: 500;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-bar-filters {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    flex: 1;
}

.filter-bar-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Filter Pills/Buttons */
.filter-pill {
    padding: 0.4rem 0.9rem;
    border: none;
    border-radius: 20px;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    font-weight: 500;
    color: #495057;
    white-space: nowrap;
}

.filter-pill:hover {
    background: rgba(0, 0, 0, 0.05);
}

.filter-pill.active {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-info) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(var(--color-primary-rgb), 0.3);
}

/* Filter Selects */
.filter-select {
    padding: 0.4rem 0.9rem;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    background: white;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    padding-right: 2rem;
}

.filter-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.1);
}

/* Search Input */
.filter-search {
    padding: 0.4rem 1rem;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    background: white;
    font-size: 0.85rem;
    min-width: 180px;
    transition: all 0.2s ease;
}

.filter-search:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.1);
}

/* Action Buttons */
.filter-action-btn {
    padding: 0.4rem 0.9rem;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    background: white;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-action-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.filter-action-btn.primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-info) 100%);
    border-color: transparent;
    color: white;
}

.filter-action-btn.primary:hover {
    box-shadow: 0 2px 8px rgba(var(--color-primary-rgb), 0.3);
}

/* Results Count Badge */
.filter-results-badge {
    background: var(--bs-gray-light);
    color: #495057;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 992px) {
    .floating-filter-bar {
        top: 60px;
        padding: 0.5rem 1rem;
        border-radius: 30px;
    }

    .filter-bar-filters {
        order: 2;
        width: 100%;
        justify-content: flex-start;
    }

    .filter-bar-actions {
        order: 1;
    }
}

@media (max-width: 768px) {
    .floating-filter-bar {
        border-radius: 20px;
        flex-direction: column;
        gap: 0.75rem;
    }

    .filter-bar-filters {
        width: 100%;
        justify-content: center;
    }

    .filter-search {
        width: 100%;
        min-width: unset;
    }

    .filter-bar-actions {
        width: 100%;
        justify-content: center;
    }
}

/* Inline pill row inside the floating bar (unit-page topic navigator).
   Horizontal scroll on narrow viewports so the pill train never wraps
   awkwardly under the syllabus selector. */
.floating-filter-bar .filter-bar-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    flex: 1;
    min-width: 0;
}
.floating-filter-bar .filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 3px 10px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.floating-filter-bar .filter-pill:hover {
    background: #ccfbf1;
    border-color: var(--color-primary);
    color: var(--color-primary-hover);
    text-decoration: none;
}
.floating-filter-bar .filter-pill.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}
.floating-filter-bar .filter-pill-num {
    font-weight: 700;
    font-size: 0.82rem;
}
.floating-filter-bar .filter-pill-name {
    overflow: hidden;
    text-overflow: ellipsis;
}
.floating-filter-bar .filter-pill.locked {
    opacity: 0.5;
    cursor: not-allowed;
}
.floating-filter-bar .filter-pill-overview {
    background: white;
    border-color: var(--jmaths-gray-300);
    color: #6b7280;
    font-weight: 600;
}

/* View toggle (Course / By topic) — pill segmented control inside the
   floating bar. Active option fills teal; inactive stays muted. */
.floating-filter-bar .view-toggle {
    display: inline-flex;
    background: #f3f4f6;
    border-radius: 999px;
    padding: 2px;
    gap: 2px;
}
.floating-filter-bar .view-toggle-btn {
    padding: 4px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #6b7280;
    text-decoration: none;
    border-radius: 999px;
    transition: background 0.12s ease, color 0.12s ease;
    white-space: nowrap;
}
.floating-filter-bar .view-toggle-btn:hover {
    color: var(--color-primary-hover);
    text-decoration: none;
}
.floating-filter-bar .view-toggle-btn.active {
    background: white;
    color: var(--color-primary-hover);
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
