/**
 * Compact Filters Bar - تنسيقات شريط الفلاتر المدمج
 * تم إنشاؤه: أكتوبر 2, 2025
 * الهدف: تصميم بسيط ونظيف للفلاتر في صف واحد
 */

/* ==========================================================================
   الحاوية الرئيسية
   ========================================================================== */

.compact-filters-bar {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.3s ease;
}

.compact-filters-bar:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}

/* ==========================================================================
   حقول الإدخال و Select
   ========================================================================== */

.compact-filters-bar input[type="text"],
.compact-filters-bar select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
    outline: none;
    background: white;
}

/* Focus State */
.compact-filters-bar input[type="text"]:focus,
.compact-filters-bar select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: #fafbff;
}

/* Hover State */
.compact-filters-bar input[type="text"]:hover,
.compact-filters-bar select:hover {
    border-color: #9ca3af;
}

/* Filled State */
.compact-filters-bar input[type="text"]:not(:placeholder-shown),
.compact-filters-bar select:not([value=""]) {
    background: #f0f9ff;
    border-color: #3b82f6;
    font-weight: 500;
}

/* ==========================================================================
   Grid Layout للفلاتر
   ========================================================================== */

.filters-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    align-items: center;
}

.direct-access-field {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.direct-access-field input {
    font-weight: 600;
    letter-spacing: 0.5px;
    padding-inline-end: 16px !important;
    padding-inline-start: 88px !important;
}

.direct-access-field .direct-access-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    min-width: 52px;
    border-radius: 999px;
    padding: 4px 12px;
    background: linear-gradient(135deg, #f97316 0%, #fb7185 100%);
    box-shadow: 0 6px 18px rgba(249, 115, 22, 0.25);
    animation: directAccessPulse 1.6s ease-in-out infinite alternate;
    position: absolute;
    top: 12px;
    inset-inline-start: 16px;
    pointer-events: none;
    z-index: 1;
}

.direct-access-hint {
    font-size: 12px;
    color: #475569;
}

@keyframes directAccessPulse {
    from {
        transform: translateY(0) scale(1);
        box-shadow: 0 6px 18px rgba(249, 115, 22, 0.25);
    }
    to {
        transform: translateY(-2px) scale(1.07);
        box-shadow: 0 10px 24px rgba(251, 113, 133, 0.35);
    }
}

.filters-controls-row {
    display: grid;
    grid-template-columns: 2fr 2fr 1fr;
    gap: 10px;
    margin-top: 10px;
    align-items: center;
}

/* ==========================================================================
   زر مسح الفلاتر
   ========================================================================== */

.clear-filters-btn {
    padding: 8px 16px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.clear-filters-btn:hover {
    background: #dc2626;
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
    transform: translateY(-1px);
}

.clear-filters-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

.clear-filters-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
}

/* ==========================================================================
   شريط الإحصائيات
   ========================================================================== */

.filter-stats-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.filter-stats-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 6px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

#filter-stats-percentage {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
    backdrop-filter: blur(10px);
}

/* ==========================================================================
   الفلاتر النشطة (Chips)
   ========================================================================== */

.active-filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
    min-height: 30px;
}

.chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(102, 126, 234, 0.3);
    animation: chipSlideIn 0.3s ease;
}

.filter-chip .chip-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-chip .chip-remove:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

@keyframes chipSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .filters-row {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .filters-controls-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

/* Mobile (< 768px) */
@media (max-width: 768px) {
    .compact-filters-bar {
        padding: 10px;
    }
    
    .filters-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .compact-filters-bar input[type="text"],
    .compact-filters-bar select {
        font-size: 13px;
        padding: 7px 10px;
    }
    
    .clear-filters-btn {
        width: 100%;
        justify-content: center;
    }
    
    .filter-stats-bar {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .filter-stats-card {
        justify-content: center;
    }
}

/* Extra Small Mobile (< 480px) */
@media (max-width: 480px) {
    .filters-row {
        grid-template-columns: 1fr;
    }
    
    .compact-filters-bar input[type="text"],
    .compact-filters-bar select {
        font-size: 12px;
    }
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .compact-filters-bar {
        background: #1f2937;
        border-color: #374151;
    }
    
    .compact-filters-bar input[type="text"],
    .compact-filters-bar select {
        background: #111827;
        border-color: #374151;
        color: #f9fafb;
    }
    
    .compact-filters-bar input[type="text"]:focus,
    .compact-filters-bar select:focus {
        background: #1f2937;
        border-color: #667eea;
    }
    
    .compact-filters-bar input[type="text"]::placeholder,
    .compact-filters-bar select option:first-child {
        color: #9ca3af;
    }

    .direct-access-hint {
        color: #9ca3af;
    }
    
    .filter-stats-bar {
        border-top-color: #374151;
    }
}

/* ==========================================================================
   تأثيرات إضافية
   ========================================================================== */

/* Loading State للحقول */
.compact-filters-bar .loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.compact-filters-bar .loading::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    border: 2px solid #667eea;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: translateY(-50%) rotate(360deg); }
}

/* Empty State */
.compact-filters-bar.no-data {
    opacity: 0.5;
    pointer-events: none;
}

/* Print Styles */
@media print {
    .compact-filters-bar {
        display: none !important;
    }
}
