/* ==========================================================
   BLOCK 10: FILTER MODAL - BOTTOM SHEET (MOBILE) & DRAWER (DESKTOP)
   ========================================================== */

/* Base Filter Modal Styles */
.mobile-filter-modal {
    position: fixed;
    background: white;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.3);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Mobile - Bottom Sheet */
@media (max-width: 768px) {
    .mobile-filter-modal {
        bottom: -100vh;
        left: 0;
        right: 0;
        width: 100%;
        height: 85vh;
        max-height: 85vh;
        border-radius: 24px 24px 0 0;
    }

    .mobile-filter-modal.active {
        bottom: 0;
    }
}

/* Desktop & Laptop - Right Drawer */
@media (min-width: 769px) {
    .mobile-filter-modal {
        top: 0;
        right: -500px;
        width: 400px;
        height: 100vh;
        border-radius: 0;
        border-left: 1px solid #e2e8f0;
    }

    .mobile-filter-modal.active {
        right: 0;
    }

    /* Adjust overlay for desktop */
    .mobile-filter-overlay {
        backdrop-filter: blur(2px);
    }

    /* Make drawer slightly narrower on smaller laptops */
    @media (max-width: 1024px) {
        .mobile-filter-modal {
            width: 380px;
        }
    }

    /* Wider drawer on larger screens */
    @media (min-width: 1440px) {
        .mobile-filter-modal {
            width: 450px;
        }
    }
}

/* Header */
.mobile-filter-header {
    padding: 0 20px 12px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    position: relative;
}

/* Drag handle - only visible on mobile */
.mobile-filter-drag-handle {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
}

/* Hide drag handle on desktop */
@media (min-width: 769px) {
    .mobile-filter-drag-handle {
        display: none;
    }
    
    /* Adjust header padding for desktop */
    .mobile-filter-header {
        padding-top: 20px;
    }
}

.mobile-filter-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a202c;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
}

.mobile-filter-title i {
    color: #3287FF;
}

.mobile-filter-count {
    background: #3287FF;
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.mobile-filter-close {
    background: none;
    border: none;
    color: #64748b;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.mobile-filter-close:hover {
    background: #f8fafc;
    color: #1a202c;
}

/* Body */
.mobile-filter-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.mobile-filter-body::-webkit-scrollbar {
    width: 6px;
}

.mobile-filter-body::-webkit-scrollbar-track {
    background: transparent;
}

.mobile-filter-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.mobile-filter-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Filter Sections */
.mobile-filter-section {
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    animation: slideInUp 0.5s ease-out;
}

.mobile-filter-section:last-child {
    border-bottom: none;
}

.mobile-filter-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
}

.mobile-filter-section-title i {
    color: #3287FF;
    width: 16px;
    text-align: center;
}

.mobile-filter-select {
    width: 100%;
    padding: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    font-family: var(--font-primary);
    font-weight: 500;
    color: #334155;
    background: white;
    transition: all 0.3s ease;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
}

.mobile-filter-select:focus {
    outline: none;
    border-color: #3287FF;
    box-shadow: 0 0 0 3px rgba(50, 135, 255, 0.1);
}

.mobile-filter-select:disabled {
    background-color: #f8fafc;
    color: #94a3b8;
    cursor: not-allowed;
    border-color: #e2e8f0;
}

/* Active Filters Display */
.mobile-active-filters {
    background: rgba(50, 135, 255, 0.05);
    border-radius: 12px;
    padding: 16px;
    margin: 16px 20px;
    border-left: 4px solid #3287FF;
    animation: fadeIn 0.5s ease-out;
}

.mobile-active-filters-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mobile-active-filters-list {
    font-size: 0.85rem;
    color: #475569;
    line-height: 1.5;
}

/* Footer */
.mobile-filter-footer {
    padding: 16px 20px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 12px;
    background: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.mobile-filter-btn {
    flex: 1;
    padding: 16px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-primary);
}

.mobile-filter-reset {
    background: rgba(50, 135, 255, 0.1);
    color: #3287FF;
    border: 1px solid rgba(50, 135, 255, 0.2);
}

.mobile-filter-reset:hover {
    background: rgba(50, 135, 255, 0.15);
    transform: translateY(-1px);
}

.mobile-filter-apply {
    background: linear-gradient(135deg, #3287FF 0%, #2a75e0 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(50, 135, 255, 0.3);
}

.mobile-filter-apply:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(50, 135, 255, 0.4);
}

/* Overlay */
.mobile-filter-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-filter-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Loading State */
.mobile-filter-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #64748b;
    text-align: center;
}

.mobile-filter-loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(50, 135, 255, 0.1);
    border-top: 3px solid #3287FF;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

/* Animations */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 480px) {
    .mobile-filter-modal {
        height: 80vh;
        max-height: 80vh;
    }
    
    .mobile-filter-header {
        padding: 0 16px 8px;
    }
    
    .mobile-filter-section {
        padding: 16px;
    }
    
    .mobile-filter-select {
        padding: 14px;
        font-size: 0.95rem;
    }
    
    .mobile-filter-footer {
        padding: 12px 16px;
    }
    
    .mobile-filter-btn {
        padding: 14px;
        font-size: 0.95rem;
    }
    
    .mobile-active-filters {
        margin: 12px 16px;
        padding: 12px;
    }
}

@media (max-width: 360px) {
    .mobile-filter-modal {
        height: 75vh;
        max-height: 75vh;
    }
    
    .mobile-filter-title {
        font-size: 1.1rem;
    }
    
    .mobile-filter-section-title {
        font-size: 0.95rem;
    }
}

/* Desktop Enhancements */
@media (min-width: 769px) {
    /* Add smooth animation for desktop sections */
    .mobile-filter-section {
        animation: slideInRight 0.5s ease-out;
    }
    
    /* Better scrollbar for desktop */
    .mobile-filter-body::-webkit-scrollbar {
        width: 8px;
    }
    
    .mobile-filter-body::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.3);
        border-radius: 4px;
    }
    
    /* Slightly larger text on desktop */
    .mobile-filter-title {
        font-size: 1.3rem;
    }
    
    .mobile-filter-section-title {
        font-size: 1.1rem;
    }
    
    .mobile-filter-select {
        font-size: 1.05rem;
        padding: 18px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .mobile-filter-modal {
        background: #1a202c;
    }
    
    .mobile-filter-header {
        background: #1a202c;
        border-bottom-color: #2d3748;
    }
    
    .mobile-filter-title {
        color: #f7fafc;
    }
    
    .mobile-filter-close {
        color: #cbd5e0;
    }
    
    .mobile-filter-close:hover {
        background: #2d3748;
        color: #f7fafc;
    }
    
    .mobile-filter-section {
        border-bottom-color: #2d3748;
    }
    
    .mobile-filter-section-title {
        color: #e2e8f0;
    }
    
    .mobile-filter-select {
        background: #2d3748;
        border-color: #4a5568;
        color: #f7fafc;
    }
    
    .mobile-filter-select:focus {
        border-color: #3287FF;
        box-shadow: 0 0 0 3px rgba(50, 135, 255, 0.2);
    }
    
    .mobile-filter-select:disabled {
        background: #2d3748;
        color: #718096;
    }
    
    .mobile-active-filters {
        background: rgba(50, 135, 255, 0.1);
        border-left-color: #3287FF;
    }
    
    .mobile-active-filters-title {
        color: #e2e8f0;
    }
    
    .mobile-active-filters-list {
        color: #cbd5e0;
    }
    
    .mobile-filter-footer {
        background: #1a202c;
        border-top-color: #2d3748;
    }
    
    .mobile-filter-reset {
        background: rgba(50, 135, 255, 0.15);
        color: #90cdf4;
        border-color: rgba(50, 135, 255, 0.3);
    }
    
    /* Desktop dark mode specific */
    @media (min-width: 769px) {
        .mobile-filter-modal {
            border-left-color: #2d3748;
        }
    }
}