/**
 * Premium Filter UI Styles
 * Professional, modern design for charts archive filter
 */

/* ============================================
   PREMIUM FILTER CARD
   ============================================ */

.premium-filter-card {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border-radius: 20px;
    padding: 35px;
    margin-bottom: 40px;
    box-shadow: 
        0 10px 40px rgba(102, 126, 234, 0.2),
        0 2px 10px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.premium-filter-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 200px;
    height: 200px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-radius: 50%;
    transform: translate(30%, -30%);
    pointer-events: none;
}

.premium-filter-card:hover {
    box-shadow: 
        0 15px 50px rgba(102, 126, 234, 0.12),
        0 5px 15px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

/* ============================================
   FILTER HEADER
   ============================================ */

.premium-filter-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.3);
}

.premium-filter-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 22px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.premium-filter-icon::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: rotate(45deg);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.premium-filter-title {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    letter-spacing: -0.5px;
}

/* ============================================
   FILTER FORM
   ============================================ */

.premium-filter-form {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.premium-filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* ============================================
   FILTER FIELDS
   ============================================ */

.premium-filter-field {
    position: relative;
}

.premium-filter-label {
    display: flex;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    gap: 8px;
}

.premium-filter-label i {
    color: #667eea;
    font-size: 16px;
    flex-shrink: 0;
    width: 18px;
    text-align: center;
}

/* ============================================
   PREMIUM SELECT
   ============================================ */

.premium-select-wrapper {
    position: relative;
}

.premium-select {
    width: 100%;
    padding: 14px 50px 14px 16px;
    font-size: 15px;
    font-weight: 500;
    color: #e2e8f0;
    background: #1a202c;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    appearance: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.premium-select:hover {
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
    background: #2d3748;
}

.premium-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 
        0 0 0 4px rgba(102, 126, 234, 0.2),
        0 4px 15px rgba(102, 126, 234, 0.3);
    transform: translateY(-1px);
    background: #2d3748;
}

.premium-select option {
    background: #1a202c;
    color: #e2e8f0;
    padding: 10px;
}

.premium-select-arrow {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #667eea;
    font-size: 16px;
    pointer-events: none;
    transition: transform 0.3s ease;
    z-index: 1;
}

.premium-select-wrapper:hover .premium-select-arrow {
    transform: translateY(-50%) rotate(180deg);
    color: #764ba2;
}

/* ============================================
   DATE RANGE FILTERS
   ============================================ */

.premium-date-range {
    display: flex;
    align-items: flex-end;
    gap: 15px;
    padding: 25px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    border-radius: 16px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    flex-wrap: wrap;
}

/* RTL: Reverse the date range order so "מתאריך" (From) appears on right, "עד תאריך" (To) on left */
[dir="rtl"] .premium-date-range {
    flex-direction: row-reverse;
}

.premium-date-field {
    flex: 1;
    min-width: 200px;
}

.premium-date-wrapper {
    position: relative;
}

.premium-date-input {
    width: 100%;
    padding: 14px 50px 14px 16px;
    font-size: 15px;
    font-weight: 500;
    color: #e2e8f0;
    background: #1a202c;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.premium-date-input::-webkit-calendar-picker-indicator {
    filter: invert(0.5) sepia(1) saturate(5) hue-rotate(220deg);
    cursor: pointer;
    opacity: 0;
    position: absolute;
    right: 0;
    width: 100%;
    height: 100%;
}

.premium-date-input:hover {
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
    background: #2d3748;
}

.premium-date-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 
        0 0 0 4px rgba(102, 126, 234, 0.2),
        0 4px 15px rgba(102, 126, 234, 0.3);
    transform: translateY(-1px);
    background: #2d3748;
}

.premium-date-input::-webkit-datetime-edit-text,
.premium-date-input::-webkit-datetime-edit-month-field,
.premium-date-input::-webkit-datetime-edit-day-field,
.premium-date-input::-webkit-datetime-edit-year-field {
    color: #e2e8f0;
}

.premium-date-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #667eea;
    font-size: 18px;
    pointer-events: none;
    z-index: 1;
}

.premium-date-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    color: white;
    font-size: 18px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    flex-shrink: 0;
}

.premium-date-hint {
    display: flex;
    align-items: center;
    color: #a0aec0;
    font-size: 12px;
    font-weight: 500;
    margin-top: 10px;
    width: 100%;
    gap: 6px;
}

.premium-date-hint i {
    font-size: 14px;
    color: #667eea;
    flex-shrink: 0;
}

/* ============================================
   PREMIUM BUTTONS
   ============================================ */

.premium-filter-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 2px solid rgba(102, 126, 234, 0.3);
}

.premium-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-transform: none;
    letter-spacing: 0.3px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    gap: 8px;
}

.premium-btn i {
    font-size: 16px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.premium-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.premium-btn:hover::before {
    width: 300px;
    height: 300px;
}

.premium-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.premium-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.premium-btn-primary:active {
    transform: translateY(0);
}

.premium-btn-secondary {
    background: #374151;
    color: #e2e8f0;
    border: 2px solid rgba(102, 126, 234, 0.3);
}

.premium-btn-secondary:hover {
    background: #4b5563;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
    color: #ffffff;
}

.premium-btn-secondary i {
    color: #a0aec0;
    transition: color 0.3s ease;
}

.premium-btn-secondary:hover i {
    color: #ffffff;
}

.premium-btn-loader {
    display: inline-flex;
    align-items: center;
}

/* ============================================
   LOADING STATES
   ============================================ */

.premium-filter-card.filtering {
    opacity: 0.7;
    pointer-events: none;
}

.premium-filter-card.filtering .premium-filter-icon {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ============================================
   ANIMATIONS
   ============================================ */

.premium-date-range {
    animation: slideDown 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.premium-filter-field {
    animation: fadeInUp 0.5s ease forwards;
    animation-delay: calc(var(--field-index, 0) * 0.1s);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   RTL SUPPORT
   ============================================ */

[dir="rtl"] .premium-filter-card::before {
    right: auto;
    left: 0;
    transform: translate(-30%, -30%);
}

/* RTL: Arrow points left (←) showing flow from earlier date (מתאריך on right) to later date (עד תאריך on left) */
[dir="rtl"] .premium-date-separator {
    transform: none;
}

/* LTR: Arrow points right (→) showing flow from earlier date (left) to later date (right) */
[dir="ltr"] .premium-date-separator i.bi-arrow-left {
    transform: rotate(180deg);
}

[dir="rtl"] .premium-filter-actions {
    flex-direction: row-reverse;
}

[dir="rtl"] .premium-select-arrow {
    right: auto;
    left: 16px;
}

[dir="rtl"] .premium-date-icon {
    right: auto;
    left: 16px;
}

[dir="rtl"] .premium-select {
    padding: 14px 16px 14px 50px;
}

[dir="rtl"] .premium-date-input {
    padding: 14px 16px 14px 50px;
}

[dir="rtl"] .premium-filter-label {
    flex-direction: row-reverse;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .premium-filter-card {
        padding: 25px 20px;
        border-radius: 16px;
    }
    
    .premium-filter-row {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .premium-date-range {
        flex-direction: column;
        align-items: stretch;
    }
    
    .premium-date-separator {
        transform: rotate(90deg);
        margin: 10px 0;
    }
    
    [dir="rtl"] .premium-date-separator {
        transform: rotate(90deg);
    }
    
    .premium-filter-actions {
        flex-direction: column;
    }
    
    [dir="rtl"] .premium-filter-actions {
        flex-direction: column;
    }
    
    .premium-btn {
        width: 100%;
    }
}

/* ============================================
   DARK MODE SUPPORT (Optional)
   ============================================ */

@media (prefers-color-scheme: dark) {
    .premium-filter-card {
        background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
        border-color: rgba(102, 126, 234, 0.2);
    }
    
    .premium-select,
    .premium-date-input {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .premium-filter-label {
        color: #cbd5e0;
    }
    
    .premium-date-range {
        background: rgba(102, 126, 234, 0.1);
        border-color: rgba(102, 126, 234, 0.2);
    }
}

