:root {
    --page-bg: #f5f5f5;
    --white: #ffffff;
    --section-title: #464646;
    --category-border: #f3f3f3;
    --overlay-bg: rgba(0, 0, 0, 0.45);
    --filter-title: #5a5555;
    --close-color: #666;
    --filter-border: #bababa;
    --filter-text: #333;
    --btn-dark: #111;
    --btn-light: #fff;
    --font-main: "Plus Jakarta Sans", sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
}

body {
    background: var(--page-bg);
}


.search-page {
    padding: 0 1.25rem 1.25rem 1.25rem;
    transition: filter 0.3s ease;
    margin-bottom: 40px;
     height: 100vh; 
}

.search-page.blur {
    filter: blur(6px);
}

.search-back-btn {
    margin-top:16px;
    background: none;
    border: none;
    cursor: pointer;
    /* padding: 8px; */
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.search-back-btn img {
    width: 24px;
    height: 24px;
}

.search-header {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 0; 
}

.search-input-wrapper {
    flex: 1;
    position: relative;
}

.search-input-wrapper input {
    height: 56px;
    width: 100%;
    padding: 14px 18px 14px 40px;
    border-radius: 35px;
    border: none;
    outline: none;
    font-size: 14px;
    background: var(--white);
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    opacity: 0.6;
}

/* Filter button */
.filter-btn {
    height: 56px;
    width: 80px;
    padding: 14px;
    border-radius: 30px;
    border: none;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.nav-icon {
    width: 20px;
    height: 20px;
}

/* Section title */
.section-title {
    font-size: 18px;
    font-weight: 600;
    
    color: var(--section-title);
    margin-bottom: 16px;
}

/* Popular tags */
.popular-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.popular-tags span {
    display: flex;
    align-items: center;
    height: 44px;
    background: var(--white);
    padding: 10px 16px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

/* Category list */
.category-list {
    background: var(--white);
    border-radius: 19px;
    padding: 27px;
    margin-top: 20px;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 10px;
    border-bottom: 1px solid var(--category-border);
    cursor: pointer;
}



.category-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.category-left img,
.category-left svg {
    width: 22px;
    height: 22px;
}

.category-left span {
    font-size: 14px;
    font-weight: 600;
    color: var(--section-title);
}

.category-right img,
.category-right svg {
    width: 20px;
    height: 20px;
}

/* ================= OVERLAY ================= */
.overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 100;
}

.overlay.show {
    opacity: 1;
    pointer-events: auto;
}

/* ================= FILTER SHEET ================= */
.filter-sheet {
    position: fixed;
    bottom: -100%;
    left: 0;
    right: 0;
    background: var(--white);
    border-radius: 37px 37px 0 0;
    padding: 43px 37px;
    z-index: 101;
    transition: bottom 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.filter-sheet.show {
    bottom: 0;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    
}

.filter-title {
    display: flex;
    gap: 6px;
    font-weight: 600;
    font-size: 15px;
    align-items: center;
    color: var(--filter-title);
}

.filter-title img,
.filter-title svg {
    width: 16px;
    height: 14px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--close-color);
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-options {
    border-top: 1px solid var(--filter-border);
    /* margin-top: 30px; 
    padding-top: 18px;  */
}


.filter-item {
    padding: 16px 0;
    /* padding-top: 16px; */
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--filter-text);
}

.filter-left {
    display: flex;
    align-items: center;
    gap: 9px;
}
.arrow-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.filter-item.active .arrow-icon {
    transform: rotate(180deg);
}



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


.view-btn {
    margin-top: 24px;
    width: 100%;
    padding: 24px 55px;
    border-radius: 32px;
    border: none;
    background: #3A356B;
    color: var(--btn-light);
    font-weight: 600;
    cursor: pointer;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.view-btn img{
    margin-left: 5px;
}
.filter-header{
    margin-bottom: 24px;
}

.filter-item:last-child {
    margin-bottom: 200px;
}

/* ================= LOADING & ERROR STATES ================= */
.loading-state, .error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: var(--white);
    border-radius: 19px;
    margin-top: 20px;
    min-height: 200px;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--btn-dark);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
}

.loading-state span {
    color: var(--section-title);
    font-size: 14px;
    font-weight: 500;
}

.error-state {
    gap: 12px;
}

.error-icon {
    width: 48px;
    height: 48px;
    opacity: 0.6;
}

.error-state span {
    color: #d32f2f;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}

.retry-btn {
    background: var(--btn-dark);
    color: var(--btn-light);
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.retry-btn:hover {
    opacity: 0.9;
}

/* ================= SEARCH RESULTS ================= */
.search-results {
    margin-top: 20px;
}

.search-results .section-title {
    margin-bottom: 0;
}

.no-results {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

/* ================= ENHANCED CATEGORY STYLES ================= */
.category-item:hover {
    background: #f8f8f8;
    border-radius: 8px;
}

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

.course-count {
    color: #666;
    font-size: 12px;
    font-weight: 400;
    margin-left: 4px;
}

.category-icon {
    flex-shrink: 0;
}

/* ================= POPULAR TAGS ENHANCEMENTS ================= */
.popular-tags span:hover {
    background: #f0f0f0;
    transform: translateY(-1px);
    transition: all 0.2s ease;
}

.popular-tags span:active {
    transform: translateY(0);
}

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

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

.category-list, .search-results {
    animation: fadeIn 0.3s ease;
}

/* ================= FILTER DROPDOWNS ================= */
.filter-dropdown {
    /* border-top: 1px solid var(--filter-border); */
    background: var(--white);
    margin: 0 -37px;
    padding: 0 37px;
    max-height: 50vh;
    overflow-y: auto;
}

.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid #f0f0f0;
}

.dropdown-header span {
    font-size: 14px;
    font-weight: 600;
    color: var(--filter-text);
}

.clear-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.clear-btn:hover {
    background: #f0f0f0;
}

.dropdown-content {
    padding: 8px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background: #f8f8f8;
}

.dropdown-item input[type="checkbox"] {
    margin-right: 12px;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.dropdown-item span {
    flex: 1;
    font-size: 14px;
    color: var(--filter-text);
}

.dropdown-item .count {
    color: #666;
    font-size: 12px;
    font-weight: 400;
}

.dropdown-footer {
    padding: 16px 0;
    border-top: 1px solid #f0f0f0;
}

.apply-btn {
    width: 100%;
    padding: 12px;
    background: var(--btn-dark);
    color: var(--btn-light);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.apply-btn:hover {
    opacity: 0.9;
}

.dropdown-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #666;
}

.dropdown-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--btn-dark);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 8px;
}

.dropdown-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #d32f2f;
    text-align: center;
}

.dropdown-error span {
    margin-bottom: 12px;
    font-size: 14px;
}

/* ================= ENHANCED FILTER ITEM STYLES ================= */
.filter-item.active {
    color: var(--btn-dark);
    font-weight: 700;
}

.filter-item.active .arrow-icon {
    transform: rotate(180deg);
}

/* Hide back arrow on desktop, show only on mobile */
@media (min-width: 768px) {
    .search-back-btn {
        display: none;
    }
    .section-title{
        margin-top: 28px;
    }
}

/* Hide mobile-hidden elements on small screens */
@media (max-width: 767px) {
    .mobile-hidden {
        display: none;
    }
}
