/**
 * تنسيقات الفلاتر - نادي أدِيب
 * تصميم متطور وعصري لنظام الفلاتر
 */

/* ===== شريط الفلاتر الرئيسي ===== */
.filters-bar {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem;
    background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(248,250,252,0.9));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(61, 143, 214, 0.12);
    border-radius: 14px;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(39, 64, 96, 0.04), 0 4px 12px rgba(39, 64, 96, 0.02);
    flex-wrap: nowrap;
}

/* عند الحاجة لصف ثاني: البحث يأخذ صف كامل */
.filters-bar.filters-bar--wrap {
    flex-wrap: wrap;
}
.filters-bar.filters-bar--wrap .filter-group {
    flex: 1 1 100%;
    min-width: 0;
}

/* ===== حقل البحث ===== */
.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.875rem;
    height: 40px;
    background: rgba(255, 255, 255, 0.85);
    border: 1.5px solid rgba(61, 143, 214, 0.1);
    border-radius: 10px;
    flex: 1;
    min-width: 180px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.filter-group:hover {
    border-color: rgba(61, 143, 214, 0.2);
    background: white;
}

.filter-group:focus-within {
    background: white;
    border-color: var(--main-blue, #3d8fd6);
    box-shadow: 0 0 0 3px rgba(61, 143, 214, 0.1), 0 2px 8px rgba(61, 143, 214, 0.08);
}

.filter-group i {
    color: var(--main-blue, #3d8fd6);
    font-size: 0.8rem;
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.filter-group:focus-within i {
    opacity: 1;
}

.filter-group input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.8125rem;
    color: #1e293b;
    font-family: inherit;
    height: 100%;
    min-width: 0;
}

.filter-group input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

/* ===== القوائم المنسدلة ===== */
.filter-select {
    height: 40px;
    padding: 0 0.875rem;
    background: rgba(255, 255, 255, 0.85);
    border: 1.5px solid rgba(61, 143, 214, 0.1);
    border-radius: 10px;
    font-size: 0.8125rem;
    color: #334155;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    min-width: 130px;
    flex-shrink: 0;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%233d8fd6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 0.75rem center;
    padding-left: 2rem;
}

.filter-select:hover {
    background-color: white;
    border-color: rgba(61, 143, 214, 0.25);
}

.filter-select:focus {
    outline: none;
    background-color: white;
    border-color: var(--main-blue, #3d8fd6);
    box-shadow: 0 0 0 3px rgba(61, 143, 214, 0.1), 0 2px 8px rgba(61, 143, 214, 0.08);
}

/* ===== أزرار الفلتر ===== */
.filter-button {
    height: 40px;
    padding: 0 1rem;
    background: rgba(255, 255, 255, 0.85);
    border: 1.5px solid rgba(61, 143, 214, 0.1);
    border-radius: 10px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.filter-button:hover {
    background: white;
    border-color: rgba(61, 143, 214, 0.25);
    color: var(--main-blue, #3d8fd6);
}

.filter-button:active {
    transform: scale(0.97);
}

.filter-button.active {
    background: linear-gradient(135deg, var(--main-blue, #3d8fd6), #2563eb);
    border-color: transparent;
    color: white;
    box-shadow: 0 2px 8px rgba(61, 143, 214, 0.3);
}

.filter-button i {
    font-size: 0.8rem;
}

/* ===== شرائح الفلتر (Filter Chips) ===== */
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3rem 0.625rem;
    background: linear-gradient(135deg, rgba(61, 143, 214, 0.08), rgba(61, 143, 214, 0.04));
    border: 1px solid rgba(61, 143, 214, 0.15);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--main-blue, #3d8fd6);
    transition: all 0.2s ease;
}

.filter-chip:hover {
    background: rgba(61, 143, 214, 0.12);
}

.filter-chip-remove {
    background: transparent;
    border: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--main-blue, #3d8fd6);
    transition: all 0.2s ease;
    padding: 0;
    margin: 0;
}

.filter-chip-remove:hover {
    background: rgba(61, 143, 214, 0.15);
}

.filter-chip-remove i {
    font-size: 0.5625rem;
}

/* حاوية شرائح الفلتر */
.filter-chips-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.filter-chips-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748b;
}

.filter-chips-clear {
    background: transparent;
    border: none;
    color: #ef4444;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.filter-chips-clear:hover {
    background: #fee2e2;
}

/* ===== فلتر التاريخ ===== */
.filter-date-range {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-date-input {
    height: 40px;
    padding: 0 0.75rem;
    background: rgba(255, 255, 255, 0.85);
    border: 1.5px solid rgba(61, 143, 214, 0.1);
    border-radius: 10px;
    font-size: 0.8125rem;
    color: #334155;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

.filter-date-input:focus {
    outline: none;
    background: white;
    border-color: var(--main-blue, #3d8fd6);
    box-shadow: 0 0 0 3px rgba(61, 143, 214, 0.1);
}

.filter-date-separator {
    color: #94a3b8;
    font-size: 0.8125rem;
}

/* ===== فلتر متقدم قابل للطي ===== */
.filter-advanced {
    background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(248,250,252,0.9));
    backdrop-filter: blur(12px);
    border: 1px solid rgba(61, 143, 214, 0.12);
    border-radius: 14px;
    margin-bottom: 1.5rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(39, 64, 96, 0.04);
}

.filter-advanced-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-advanced-header:hover {
    background: rgba(61, 143, 214, 0.03);
}

.filter-advanced-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #334155;
}

.filter-advanced-title i {
    color: var(--main-blue, #3d8fd6);
}

.filter-advanced-toggle {
    color: #94a3b8;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-advanced.expanded .filter-advanced-toggle {
    transform: rotate(180deg);
}

.filter-advanced-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-advanced.expanded .filter-advanced-body {
    max-height: 1000px;
}

.filter-advanced-content {
    padding: 0 1rem 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

/* ===== شريط الفلاتر المدمج ===== */
.filters-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filters-inline .filter-group,
.filters-inline .filter-select,
.filters-inline .filter-button {
    margin: 0;
}

/* ===== عداد النتائج ===== */
.filter-results-count {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.875rem;
    background: linear-gradient(135deg, rgba(61, 143, 214, 0.06), rgba(61, 143, 214, 0.02));
    border: 1px solid rgba(61, 143, 214, 0.12);
    border-radius: 10px;
    font-size: 0.8125rem;
    color: var(--main-blue, #3d8fd6);
    margin-bottom: 1rem;
}

.filter-results-count i {
    color: var(--main-blue, #3d8fd6);
    opacity: 0.7;
}

.filter-results-count strong {
    font-weight: 600;
}

/* ===== حالة الفلتر الفارغة ===== */
.filter-empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #94a3b8;
}

.filter-empty-state i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    color: rgba(61, 143, 214, 0.25);
}

.filter-empty-state h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.375rem;
}

.filter-empty-state p {
    font-size: 0.8125rem;
    color: #94a3b8;
    margin: 0;
}

/* ===== زر إعادة التعيين ===== */
.filter-reset {
    height: 40px;
    padding: 0 0.875rem;
    background: transparent;
    border: 1.5px solid rgba(61, 143, 214, 0.1);
    border-radius: 10px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.filter-reset:hover {
    background: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.filter-reset:active {
    transform: scale(0.97);
}

/* ===== البحث المتقدم ===== */
.filter-search-advanced {
    position: relative;
}

.filter-search-suggestions {
    position: absolute;
    top: calc(100% + 0.375rem);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid rgba(61, 143, 214, 0.12);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(39, 64, 96, 0.12), 0 2px 8px rgba(39, 64, 96, 0.04);
    max-height: 280px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.filter-search-advanced.active .filter-search-suggestions {
    display: block;
    animation: filterDropIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-suggestion-item {
    padding: 0.625rem 0.875rem;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    border-bottom: 1px solid #f1f5f9;
}

.filter-suggestion-item:last-child {
    border-bottom: none;
}

.filter-suggestion-item:hover {
    background: rgba(61, 143, 214, 0.04);
}

.filter-suggestion-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(61, 143, 214, 0.1), rgba(61, 143, 214, 0.05));
    color: var(--main-blue, #3d8fd6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.filter-suggestion-content {
    flex: 1;
    min-width: 0;
}

.filter-suggestion-title {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #1e293b;
    margin-bottom: 0.0625rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-suggestion-meta {
    font-size: 0.6875rem;
    color: #94a3b8;
}

/* ===== التوافق مع الشاشات الصغيرة ===== */
@media (max-width: 900px) {
    .filters-bar {
        flex-wrap: wrap;
    }
    
    .filters-bar .filter-group {
        flex: 1 1 100%;
        min-width: 0;
        order: -1;
    }
    
    .filters-bar .filter-select {
        flex: 1 1 auto;
        min-width: 0;
    }
}

@media (max-width: 576px) {
    .filters-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .filter-group,
    .filter-select,
    .filter-button,
    .filter-reset {
        width: 100%;
        min-width: auto;
    }

    .filter-advanced-content {
        grid-template-columns: 1fr;
    }

    .filter-date-range {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-date-input {
        width: 100%;
    }
}

/* ===== تأثيرات الحركة ===== */
@keyframes filterDropIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
