/* Exercise Search Modal */
.exercise-search-modal .modal-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Search input row with filter button */
.exercise-search-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.exercise-search-input-row .exercise-search-input-wrapper {
    flex: 1;
    margin-bottom: 0;
}

.exercise-search-input-wrapper {
    position: relative;
    flex-shrink: 0;
}

.exercise-search-input-wrapper i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.exercise-search-input-wrapper .form-input {
    padding-left: 2.25rem;
}

/* Filter toggle button */
.btn-filter-toggle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    flex-shrink: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    font-size: 1rem;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-filter-toggle:hover,
.btn-filter-toggle.active {
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.08));
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: var(--primary-color);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}

/* Filter panel */
.exercise-filter-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease, padding 0.25s ease;
    flex-shrink: 0;
    padding: 0 0.25rem;
}

.exercise-filter-panel.open {
    max-height: 400px;
    padding: 0 0.25rem 0.5rem;
}

.filter-section {
    margin-bottom: 0.5rem;
}

.filter-section:last-of-type {
    margin-bottom: 0.25rem;
}

.filter-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    max-height: 5.5rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.6rem;
    border-radius: 99px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    white-space: nowrap;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-appearance: none;
    appearance: none;
}

.filter-chip:hover {
    border-color: var(--primary-color);
    color: var(--text-primary);
}

.filter-chip.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.btn-clear-filters {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.6rem;
    margin-top: 0.35rem;
    border: none;
    border-radius: 99px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-family: inherit;
    cursor: pointer;
    transition: color 0.15s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-clear-filters:hover {
    color: var(--primary-color);
}

/* Exercise detail subtitle in search results */
.exercise-search-detail {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

/* Results */
.exercise-search-results {
    overflow-y: auto;
    flex: 1;
    min-height: 150px;
    -webkit-overflow-scrolling: touch;
}

.exercise-search-section-header {
    padding: 0.5rem 0.75rem;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.exercise-search-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    padding: 0.85rem 0.75rem;
    cursor: pointer;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
    background: var(--bg-secondary);
    transition: background 0.15s, border-color 0.15s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
    user-select: none;
    font-family: inherit;
    text-align: left;
    -webkit-appearance: none;
    appearance: none;
}

.exercise-search-item:hover,
.exercise-search-item:active {
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.08));
    border-color: var(--primary-color);
}

.exercise-search-name {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.exercise-search-footer {
    border-top: 1px solid var(--border-color);
    justify-content: center !important;
}

@media (max-width: 480px) {
    .filter-chips {
        max-height: 4.5rem;
    }
}
