/* Main Search Button - More Prominent */
.search-main-btn {
    background: linear-gradient(135deg, #0056b3, #0171E9);
    border: none;
    border-radius: 50px;
    padding: 12px 24px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.search-main-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
    background: linear-gradient(135deg, #0056b3, #004085);
}

.search-main-btn:active {
    transform: translateY(0);
}

/* Dropdown Menu - Simple Inline Expansion */
.filter-dropdown-menu {
    display: none;
    position: relative;
    width: 100%;
    border: 2px solid #0171E9;
    border-radius: 12px;
    background: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    animation: dropdownSlide 0.3s ease-out;
    padding: 0;
}

.filter-dropdown-content {
    padding: 0;
}

.filter-header {
    background: linear-gradient(135deg, #0056b6, #0171E9);
    color: white;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.filter-header-content {
    flex: 1;
}

.filter-header h5 {
    font-weight: 600;
    margin: 0;
    font-size: 1.1rem;
}

/* Select All Section - Orange Toggle Button */
.select-all-section {
    display: flex;
    align-items: center;
}

.select-all-btn {
    background: linear-gradient(135deg, #ff6b35, #e55a2b);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 10px 20px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.select-all-btn:hover {
    background: linear-gradient(135deg, #e55a2b, #cc4a24);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
}

.select-all-btn:active {
    transform: translateY(0);
}

.select-all-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.5);
}

/* When all are selected - "取消全選" state */
.select-all-btn.all-selected {
    background: linear-gradient(135deg, #28a745, #20c997);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.select-all-btn.all-selected:hover {
    background: linear-gradient(135deg, #218838, #1e9e8a);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

/* Checkbox icon styling */
.select-all-btn .bi-check-all {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.select-all-btn:hover .bi-check-all {
    transform: scale(1.1);
}

/* When all selected, change icon */
.select-all-btn.all-selected .bi-check-all::before {
    content: "\f633";
    /* Bootstrap Icons 'x-square' */
}

/* Text animation */
.select-all-text {
    transition: all 0.3s ease;
    font-size: 1.2em;
}

/* UPDATED: Filter Body with Responsive Grid */
.filter-body {
    padding: 10px;
}

.filter-body .row {
    margin: -5px;
    /* Counteract the column padding */
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
}

.filter-body .col-12.col-sm-6.col-md-4.col-lg-3 {
    padding: 5px;
}

/* Enhanced Form Elements */
.filter-body .form-check {
    background: white;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    word-break: break-word;
}

/* .filter-body .form-check:hover {
    background-color: #f8f9fa;
    border-color: #0171E9;
} */

.filter-body .form-check-input {
    width: 18px;
    height: 18px;
    margin-top: 0;
    flex-shrink: 0;
    border: 1px solid;
}

.filter-body .form-check-input:checked {
    background-color: #0171E9;
    border-color: #0171E9;
}

.filter-body .form-check-label {
    font-weight: 500;
    margin-left: 10px;
    cursor: pointer;
    flex: 1;
    font-size: 0.85em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.filter-footer {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

/* Selected state for checkboxes */
.filter-body .form-check-input:checked~.form-check-label {
    font-weight: 600;
    color: #0171E9;
}

/* Animations */
@keyframes dropdownSlide {
    from {
        opacity: 0;
        max-height: 0;
    }

    to {
        opacity: 1;
        max-height: 1000px;
    }
}

/* Responsive Design */
@media (max-width: 575.98px) {
    .filter-body .col-12 {
        margin-bottom: 8px;
    }

    .filter-body .form-check {
        /* min-height: 35px; */
        /* padding: 6px 10px; */
    }
}

@media (max-width: 768px) {
    .search-main-btn {
        padding: 10px 18px;
        font-size: 14px;
        margin-left: 20px !important;
    }

    .filter-header {
        padding: 12px 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .filter-header-content {
        width: 100%;
    }

    .select-all-section {
        width: 100%;
        justify-content: center;
    }

    .select-all-btn {
        padding: 8px 16px;
        font-size: 0.9rem;
        width: 100%;
        justify-content: center;
    }

    .filter-body {
        padding: 15px;
    }

    .filter-footer {
        padding: 12px 15px;
    }

    /* Mobile landscape - 2 columns */
    .filter-body .col-sm-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .filter-body .form-check {
        /* padding: 10px 8px; */
        /* margin-bottom: 8px; */
    }

    .filter-body .form-check-input {
        width: 20px;
        height: 20px;
    }

    .filter-body .form-check-label {
        margin-left: 12px;
        font-size: 0.8em;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {

    /* Tablet - 3 columns */
    .filter-body .col-md-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }
}

@media (min-width: 992px) {

    /* Desktop - 4 columns */
    .filter-body .col-lg-3 {
        flex: 0 0 25%;
        max-width: 25%;
    }
}

@media (max-width: 480px) {
    .search-main-btn {
        margin-left: 15px !important;
        padding: 8px 16px;
    }

    .filter-header h5 {
        font-size: 1rem;
    }

    .select-all-btn {
        font-size: 0.85rem;
        padding: 6px 14px;
    }

    /* Single column on very small screens */
    .filter-body .col-sm-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

.label-text {
    font-size: 1.25em;
}

/* Active state for button when dropdown is open */
.search-main-btn.active {
    background: linear-gradient(135deg, #0056b3, #004085);
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.5);
}

/* Title spacing */
.page-title {
    margin-right: auto;
}

.filter-header h5 {
    font-weight: 600;
    margin: 0;
    font-size: 1em;
    color: white;
    display: flex;
    align-items: center;
}

.filter-header h5 .bi-funnel {
    color: white;
    font-size: 1em;
    margin-right: 0.5em;
}

/* View Toggle Buttons */
.view-toggle-buttons {
    text-align: right;
}

.view-toggle-buttons .btn-group {
    border-radius: 8px;
    overflow: hidden;
    /* border: 1px solid #0171E9; */
}

.view-toggle-buttons .btn {
    border: none;
    padding: 8px 16px;
    font-size: 0.9rem;
}

.view-toggle-buttons .btn.active {
    background: #0171E9;
    color: white;
}

/* List View Styles */
.list-view {
    border-radius: 8px;
    overflow: hidden;
}

.list-view-item {
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s ease;
    padding: 15px;
}

.list-view-item:hover {
    background-color: #f8f9fa;
}

.list-view-item:last-child {
    border-bottom: none;
}

.list-view-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.list-view-image {
    flex: 0 0 80px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    padding: 0px;
}

.list-view-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}


.list-view-title {
    margin: 0 0 5px 0;
    font-size: 1.6rem;
    font-weight: 600;
    color: #333;
}

.list-view-meta {
    font-size: 1.2rem;
    color: #6c757d;
}

.list-view-time {
    display: flex;
    align-items: center;
    gap: 5px;
}

.list-view-action {
    flex: 0 0 auto;
}

.list-view-btn {
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
}

.div_online_course {
    margin: unset;
}

body .mainContent h2 {
    margin-bottom: 0px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .view-toggle-buttons {
        text-align: center;
    }

    .list-view-content {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .list-view-image {
        flex: 0 0 auto;
        width: 33.33333333%;
    }

    .list-view-details {
        width: 100%;
    }

    .list-view-action {
        width: 100%;
    }

    .list-view-btn {
        width: 100%;
        text-align: center;
    }
}

/* Filter Container Styles */
.filter-container {
    padding: 0px 18px;
    /* display: flex; */
    /* flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    justify-content: flex-start; */
}

.filter-dropdown-container {
    padding: 0px 30px;
}

/* Desktop View - All items side by side */
.filter-container .filter-item {
    flex: 0 0 auto;
}

.grid-view,
.list-view {
    display: none;
}

.paginator {
    padding: 0 1.5rem;
}

.btn:hover{
    background-color: #0171E9;
}


/* Mobile View - First item full width, last two items underneath */
@media (max-width: 768px) {
    .filter-container {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 0px;
    }

    .filter-container .filter-item:first-child {
        order: 1;
        width: 100%;
    }

    .filter-container .filter-item:not(:first-child) {
        order: 2;
        display: flex;
        gap: 10px;
        justify-content: space-between;
    }

    .filter-container .filter-item:not(:first-child)>* {
        flex: 1;
    }
}

/* Alternative Mobile Layout - More compact */
@media (max-width: 768px) {
    .filter-container.compact-layout {
        display: grid;
        grid-template-areas:
            "first-item first-item"
            "second-item third-item";
        gap: 10px;

    }

    .filter-container.compact-layout .filter-item:nth-child(1) {
        grid-area: first-item;
    }

    .filter-container.compact-layout .filter-item:nth-child(2) {
        grid-area: second-item;
    }

    .filter-container.compact-layout .filter-item:nth-child(3) {
        grid-area: third-item;
    }
}

@media (max-width: 576px) {
    .control{
        padding: 0;
    }
    .filter-dropdown-container{
        padding:0;
    }
}
@media (max-width:360px){
    .bi-funnel::before{
        display:none;
    }
    .me-2{
        margin-right: 0 !important;
    }
}