/**
 * Search and Filter Styles
 * Beautiful, modern UI for task search and filtering
 */

/* Main container */
.search-filter-bar {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    padding: 6px 10px;
    margin-left: auto;
}

/* Search container */
.search-container {
    position: relative;
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 0 8px;
    transition: all 0.3s ease;
    flex: 0 1 auto;
    min-width: 200px;
    max-width: 280px;
    height: 32px;
    overflow: hidden;
    box-sizing: border-box;
}

.search-container:focus-within {
    border-color: #4A6CF7;
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.1);
}

.search-icon {
    color: #6c757d;
    font-size: 12px;
    margin-right: 6px;
    margin-left: -16px;
    transition: color 0.3s ease;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
}

.search-container:focus-within .search-icon {
    color: #4A6CF7;
}

/* Ensure icon is properly contained */
.search-container .search-icon {
    flex-shrink: 0;
    line-height: 1;
    vertical-align: middle;
}

.task-search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 6px 4px 6px 2px;
    font-size: 12px;
    background: transparent;
    color: #2c3e50;
    height: 100%;
    margin-left: 12px;
}

.task-search-input::placeholder {
    color: #adb5bd;
}

.clear-search-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: none;
    background: #e9ecef;
    color: #6c757d;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 10px;
}

.clear-search-btn:hover {
    background: #dee2e6;
    color: #495057;
    transform: scale(1.1);
}

.clear-search-btn:active {
    transform: scale(0.95);
}

/* Filters container */
.filters-container {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    flex-shrink: 0;
}

/* Filter dropdown */
.filter-dropdown {
    position: relative;
}

.filter-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    border: 1px solid #dee2e6;
    background: white;
    color: #495057;
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    height: 32px;
}

.filter-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.filter-btn:active {
    transform: translateY(0);
}

.filter-btn.active {
    background: linear-gradient(135deg, #4A6CF7 0%, #5a7cf8 100%);
    color: white;
    border-color: #4A6CF7;
    box-shadow: 0 2px 8px rgba(74, 108, 247, 0.3);
}

.filter-btn.active:hover {
    background: linear-gradient(135deg, #5a7cf8 0%, #6a8cf9 100%);
}

.filter-btn i {
    font-size: 12px;
}

/* Filter menu */
.filter-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 180px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    overflow: hidden;
    animation: menuFadeIn 0.2s ease;
}

@keyframes menuFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.filter-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    color: #495057;
}

.filter-menu-item:hover {
    background: #f8f9fa;
    color: #212529;
}

.filter-menu-item.active {
    background: linear-gradient(90deg, rgba(74, 108, 247, 0.1) 0%, transparent 100%);
    color: #4A6CF7;
    font-weight: 600;
}

.filter-menu-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.filter-menu-item i {
    font-size: 12px;
    width: 16px;
    text-align: center;
}

/* Labels filter specific */
.labels-filter-menu {
    /* Height will be set dynamically by JavaScript */
    overflow-y: auto;
    /* Enable scrolling only when content exceeds available space */
}

.label-filter-item {
    padding: 8px 12px;
}

.label-checkbox {
    cursor: pointer;
    width: 16px;
    height: 16px;
    margin: 0;
}

.filter-label-badge {
    flex: 1;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    border-radius: 4px;
    display: inline-block;
}

/* Clear all filters button */
.clear-all-filters-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    border: 1px solid #dee2e6;
    background: white;
    color: #6c757d;
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 32px;
}

.clear-all-filters-btn:hover {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(255, 193, 7, 0.2);
}

.clear-all-filters-btn:active {
    transform: translateY(0);
}

.clear-all-filters-btn i {
    font-size: 12px;
}

/* Scrollbar styling for labels menu */
.labels-filter-menu::-webkit-scrollbar {
    width: 6px;
}

.labels-filter-menu::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.labels-filter-menu::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.labels-filter-menu::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive design */
@media (max-width: 1024px) {
    .search-filter-bar {
        flex-wrap: wrap;
        padding: 6px 8px;
    }
    
    .search-container {
        max-width: 100%;
        flex: 1 1 100%;
        min-width: 180px;
    }
    
    .filters-container {
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .search-filter-bar {
        padding: 6px 8px;
        gap: 6px;
    }
    
    .filters-container {
        gap: 5px;
        width: 100%;
    }
    
    .filter-btn,
    .clear-all-filters-btn {
        padding: 5px 8px;
        font-size: 11px;
        height: 30px;
    }
    
    .search-container {
        height: 30px;
        min-width: 160px;
    }
    
    .filter-btn i {
        display: none;
    }
    
    .filter-menu {
        min-width: 160px;
    }
    
    .clear-all-filters-btn {
        margin-left: 0;
    }
}

/* Active filters indicator */
.filter-btn.active::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: #28a745;
    border: 2px solid white;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* Empty state in filter menus */
.filter-menu-item.disabled {
    text-align: center;
    font-style: italic;
    padding: 16px;
}

/* Smooth transitions */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

