/* Dynamic Layout for Exam List Page */
/* Only layout-specific styles for dynamic filter toggle */

/* Base transitions */
.layout-transition {
    transition: all 0.3s ease-in-out;
}

.filter-container {
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.3s ease-in-out;
    position: relative;
}

.filter-container.show {
    opacity: 1;
    transform: translateX(0);
}

.search-control-section {
    transition: all 0.3s ease-in-out;
}

.exam-cards {
    transition: all 0.3s ease-in-out;
}

/* Filter toggle button - override existing styles for dynamic layout */
.filter-toggle-btn {
    min-width: 100px;
    transition: all 0.3s ease-in-out;
    height: 40px !important; /* Ensure consistent height */
    display: flex !important;
    align-items: center !important;
    box-sizing: border-box !important;
    font-size: var(--edtt-font-size-lg);
}

.layout-no-filter .filter-toggle-btn.active,
.layout-with-filter .filter-toggle-btn.active {
    border-color: var(--edtt-color-primary, #ea4c89) !important;
    color: var(--edtt-color-primary, #ea4c89) !important;
    background-color: rgba(234, 76, 137, 0.1) !important;
}

.filter-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: var(--edtt-font-size-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-close-btn:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
}


.sort-dropdown-toggle {
    font-size: var(--edtt-font-size-sm);
}

/* Layout: No Filter State */
.layout-no-filter .search-control-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.layout-no-filter .filter-toggle-section {
    flex: 0 0 auto;
}

.layout-no-filter .search-section {
    flex: 1;
}

.layout-no-filter .search-section .input-group {
    height: 40px !important; /* Ensure consistent height */
}

.layout-no-filter .sort-section {
    flex: 0 0 auto;
    font-size: var(--edtt-font-size-sm);
}

.layout-no-filter .sort-section .btn {
    height: 40px !important; /* Ensure consistent height */
    display: flex !important;
    align-items: center !important;
    box-sizing: border-box !important;
}

/* Layout: With Filter State */
.layout-with-filter .main-content {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.layout-with-filter .filter-sidebar {
    flex: 0 0 300px;
}

.layout-with-filter .content-area {
    flex: 1;
    min-width: 0; /* Prevent flex item from overflowing */
}

.layout-with-filter .search-control-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.layout-with-filter .search-section {
    flex: 2;
}

.layout-with-filter .search-section .input-group {
    height: 40px !important; /* Ensure consistent height */
}

.layout-with-filter .sort-section {
    flex: 0 0 auto;
    font-size: var(--edtt-font-size-sm);
}

.layout-with-filter .sort-section .btn {
    height: 40px !important; /* Ensure consistent height */
    display: flex !important;
    align-items: center !important;
    box-sizing: border-box !important;
}

/* Responsive adjustments */
@media (max-width: 1199.98px) {
    .layout-with-filter .filter-sidebar {
        flex: 0 0 280px; /* Slightly smaller on medium screens */
    }
}

@media (max-width: 991.98px) {
    .layout-with-filter .main-content {
        flex-direction: column;
    }
    
    .layout-with-filter .filter-sidebar {
        flex: none;
        order: 1;
        margin-bottom: 1.5rem;
    }
    
    .layout-with-filter .content-area {
        order: 2;
    }
    
    /* Ensure consistent height on tablet */
    .layout-with-filter .search-section .input-group,
    .layout-no-filter .search-section .input-group {
        height: 40px !important;
    }
    
    .layout-with-filter .sort-section .btn,
    .layout-no-filter .sort-section .btn {
        height: 40px !important;
    }
    
    .filter-toggle-btn {
        height: 40px !important;
    }
}

@media (max-width: 1399.98px) {
    .layout-with-filter .main-content {
        gap: 1.5rem; /* Smaller gap on smaller screens */
    }
}

@media (max-width: 767.98px) {
    .layout-with-filter .search-control-row {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .layout-with-filter .search-section,
    .layout-with-filter .sort-section {
        flex: none;
        width: 100%;
    }
    
    .filter-close-btn {
        top: 10px;
        right: 10px;
        padding: 2px 6px;
        font-size: var(--edtt-font-size-xs);
    }
    
    /* Ensure consistent height on mobile for both layouts */
    .layout-with-filter .search-section .input-group,
    .layout-no-filter .search-section .input-group {
        height: 40px !important;
    }
    
    .layout-with-filter .sort-section .btn,
    .layout-no-filter .sort-section .btn {
        height: 40px !important;
    }
    
    .filter-toggle-btn {
        height: 40px !important;
    }
}

@media (max-width: 576px) {
    .layout-with-filter .filter-container {
        margin: 0;
        border-radius: 0;
    }
    
    .layout-with-filter .main-content {
        gap: 1rem;
    }
    
    /* Ensure consistent height on small mobile */
    .layout-with-filter .search-section .input-group,
    .layout-no-filter .search-section .input-group {
        height: 40px !important;
    }
    
    .layout-with-filter .sort-section .btn,
    .layout-no-filter .sort-section .btn {
        height: 40px !important;
    }
    
    .filter-toggle-btn {
        height: 40px !important;
    }
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

.fade-out {
    animation: fadeOut 0.3s ease-in-out;
}

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

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

/* Ensure proper spacing for applied filters above exercise cards */
.layout-with-filter .exam-cards .applied-filters {
    margin-bottom: 1rem;
}

.layout-no-filter .exam-cards .applied-filters {
    margin-bottom: 1rem;
}

/* Accessibility improvements */
.filter-close-btn:focus {
    outline: 2px solid var(--edtt-color-primary, #ea4c89);
    outline-offset: 2px;
}

.filter-toggle-btn:focus {
    outline: 2px solid var(--edtt-color-primary, #ea4c89);
    outline-offset: 2px;
}

/* Loading states */
.layout-transition.loading {
    opacity: 0.8;
    pointer-events: none;
}

/* Enhanced filter container styling */
.layout-with-filter .filter-container {
    background: var(--edtt-color-bg-default);
    border-radius: 8px;
    border: 1px solid var(--edtt-color-border-default);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Search box improvements in filter layout */
.layout-with-filter .search-box .input-group {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
