/* Modern Filter System - Improved Design following dashboard.css patterns */

/* Base Filter Section */
.filters-section {
    margin-bottom: 32px;
    width: 100%;
}

.filter-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
    width: 100%;
}

.filter-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* Filter Toggle Header - Following dashboard section-title pattern */
.filter-toggle {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
    padding: 24px 32px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    border: none;
    outline: none;
}

.filter-toggle:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: none; /* Prevent double transform with card hover */
}

/* Filter Title - Following dashboard section-title pattern */
.filter-title {
    margin: 0 !important;
    font-size: 24px !important;
    font-weight: 700 !important;
    color: white !important;
    display: flex;
    align-items: center;
    gap: 12px;
    line-height: 1.2;
}

.filter-title i {
    font-size: 20px !important;
    color: white !important;
    opacity: 1 !important;
}

/* Filter Arrow */
.filter-arrow {
    font-size: 18px !important;
    color: white !important;
    transition: transform 0.3s ease;
    opacity: 0.9;
}

.filter-arrow:hover {
    opacity: 1;
}

.filter-arrow.rotated {
    transform: rotate(180deg);
}

/* Filter Content */
.filter-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease;
    background: white;
}

.filter-content.expanded {
    max-height: 1000px;
    padding: 32px;
    overflow: visible;
}

/* Filter Grid Layout */
.filter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: flex-end;
}

@media (min-width: 768px) {
    .filter-grid {
        align-items: flex-end;
    }
    
    .filter-group {
        flex: 1;
        margin-bottom: 0;
    }
    
    .filter-actions {
        flex: 0 0 auto;
        margin-bottom: 0;
    }
}

/* Filter Groups */
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 200px;
}

.filter-group > * {
    margin: 0;
    padding-bottom: 0;
    margin-bottom: 0;
}

/* Filter Labels - Following dashboard style */
.filter-label {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #1e293b !important;
    margin-bottom: 8px !important;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-label i {
    font-size: 14px !important;
    color: #64748b !important;
}

/* Form Container */
.modern-filter-form {
    width: 100%;
    margin: 0;
}

.filter-label i {
    color: #667eea;
    width: 16px;
}

.modern-select {
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 0.95em;
    background: white;
    transition: all 0.3s ease;
    outline: none;
    width: 100%;
    min-width: 200px;
    white-space: nowrap;
    overflow: visible;
    text-overflow: ellipsis;
    height: auto;
    min-height: 44px;
    line-height: 1.4;
    vertical-align: top;
    box-sizing: border-box;
}

.modern-select:hover {
    border-color: #9ca3af;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.modern-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.modern-select option {
    padding: 8px 12px;
    white-space: nowrap;
    line-height: 1.4;
    min-height: 32px;
    display: block;
}

.custom-date-picker {
    position: relative;
    display: flex;
    align-items: center;
    height: auto;
}

/* Modern Input Styles - Following dashboard form patterns */
.modern-text-input,
.modern-select-input,
.modern-date-input {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    color: #1e293b;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
    min-height: 44px;
    outline: none;
}

.modern-text-input:focus,
.modern-select-input:focus,
.modern-date-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    transform: translateY(-1px);
}

.modern-text-input:hover,
.modern-select-input:hover,
.modern-date-input:hover {
    border-color: #cbd5e1;
}

.modern-text-input::placeholder {
    color: #94a3b8;
}

.modern-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 12px 0;
}

.modern-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
}

.modern-checkbox label {
    font-size: 0.95em;
    color: #374151;
    margin: 0;
    cursor: pointer;
}

.date-icon {
    position: absolute !important;
    right: 16px !important;
    top: 50% !important;
    bottom: auto !important;
    transform: translateY(-50%) !important;
    color: #667eea;
    pointer-events: none;
    font-size: 1.1em;
    z-index: 10;
    line-height: 1;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.custom-date-picker .date-icon,
.filter-group .custom-date-picker .date-icon {
    position: absolute !important;
    top: 50% !important;
    right: 16px !important;
    transform: translateY(-50%) !important;
    bottom: auto !important;
}

.custom-date-picker i.date-icon {
    position: absolute !important;
    top: 50% !important;
    right: 16px !important;
    transform: translateY(-50%) !important;
    z-index: 999 !important;
    pointer-events: none !important;
    color: #667eea !important;
    font-size: 1.1em !important;
    line-height: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Filter Actions */
.filter-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
    min-width: 200px;
}

@media (min-width: 768px) {
    .filter-actions {
        flex-direction: row;
        gap: 16px;
        align-items: center;
        min-width: auto;
    }
}

.filter-actions > * {
    margin: 0;
    padding-bottom: 0;
    margin-bottom: 0;
}

/* Filter Buttons - Following dashboard button patterns */
.btn-filter-apply {
    background: linear-gradient(45deg, #2563eb, #3b82f6);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-height: 44px;
}

.btn-filter-apply:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3);
}

.btn-filter-apply i {
    font-size: 14px;
}

.btn-filter-clear {
    background: #f8fafc;
    color: #64748b;
    border: 2px solid #e2e8f0;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    transition: all 0.2s ease;
    min-height: 44px;
    box-sizing: border-box;
}

.btn-filter-clear:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #475569;
    text-decoration: none;
    transform: translateY(-1px);
}

/* Força as regras para sobrescrever outros estilos */
.filter-group .modern-select,
.modern-filter-form .modern-select,
select.modern-select {
    height: 44px !important;
    min-height: 44px !important;
    line-height: 1.2 !important;
    padding: 10px 16px !important;
    vertical-align: top !important;
    overflow: visible !important;
    font-size: 0.95em !important;
    border-radius: 12px !important;
    border: 2px solid #e5e7eb !important;
    background: white !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    box-sizing: border-box !important;
}

.custom-date-picker .modern-date-input,
.filter-group .modern-date-input,
input.modern-date-input {
    border-radius: 12px !important;
    border: 2px solid #e5e7eb !important;
    background: white !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    box-sizing: border-box !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 10px 45px 10px 16px !important;
    line-height: 1.2 !important;
}

.filter-group .modern-text-input,
input.modern-text-input {
    border-radius: 12px !important;
    border: 2px solid #e5e7eb !important;
    background: white !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    box-sizing: border-box !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 10px 16px !important;
    line-height: 1.2 !important;
}

.filter-actions .btn-filter-apply,
button.btn-filter-apply {
    border-radius: 12px !important;
    height: 44px !important;
    min-height: 44px !important;
    border: none !important;
    line-height: 1.2 !important;
    padding: 10px 24px !important;
}

.filter-actions .btn-filter-clear,
a.btn-filter-clear {
    border-radius: 12px !important;
    height: 44px !important;
    min-height: 44px !important;
    border: 2px solid #e5e7eb !important;
    line-height: 1.2 !important;
    padding: 8px 20px !important;
}

/* Custom Date Picker Styles */
.flatpickr-calendar {
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: none;
}

.flatpickr-day.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
}

.flatpickr-day:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: #667eea;
}

.flatpickr-months .flatpickr-month {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.flatpickr-current-month .flatpickr-monthDropdown-months {
    background: white;
    color: #374151;
}

/* Hide any additional Flatpickr icons and ensure our icon is centered */
.flatpickr-input[readonly] + .flatpickr-toggle {
    display: none !important;
}

.custom-date-picker .flatpickr-input {
    padding-right: 45px !important;
}

/* Mobile Responsive for Filters */
@media (max-width: 768px) {
    .filter-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .filter-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn-filter-apply,
    .btn-filter-clear {
        justify-content: center;
        width: 100%;
    }
    
    .filter-toggle {
        padding: 16px 20px;
    }
    
    .filter-title {
        font-size: 18px !important;
    }
    
    .filter-content.expanded {
        padding: 20px 16px;
    }
    
    .btn-filter-apply,
    .btn-filter-clear {
        padding: 14px 20px;
        font-size: 15px;
    }
}

/* Additional responsive rules */
@media (max-width: 768px) {
    .filter-toggle {
        padding: 20px 24px;
    }
    
    .filter-title {
        font-size: 20px !important;
    }
    
    .filter-title i {
        font-size: 18px !important;
    }
    
    .filter-content.expanded {
        padding: 24px 20px;
    }
    
    .filter-grid {
        flex-direction: column;
        gap: 20px;
    }
    
    .filter-group {
        min-width: auto;
        width: 100%;
    }
    
    .filter-actions {
        width: 100%;
        min-width: auto;
    }
}

/* Force styles to override any conflicting CSS */
.filter-title,
.filter-title *,
.filter-arrow {
    color: white !important;
}

/* Ensure proper z-index for dropdowns and overlays */
.filter-card {
    position: relative;
    z-index: 10;
}

.filter-content.expanded {
    z-index: 11;
}