/* ==========================================================================
   CourseBond — Catalog page (Udemy-style)
   ========================================================================== */

.cb-catalog {
    background: #fff;
    color: #1c1d1f;
    min-height: 60vh;
}

/* ----- Hero -------------------------------------------------------------- */
.cb-catalog-hero {
    background: linear-gradient(180deg, #f7f9fa 0%, #ffffff 100%);
    border-bottom: 1px solid #e5e7eb;
    padding: 32px 0 36px;
}
.cb-catalog-hero__inner {
    max-width: 1340px;
    margin: 0 auto;
    padding: 0 24px;
}
.cb-catalog-hero__breadcrumb {
    font-size: 13px;
    color: #4b5563;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cb-catalog-hero__breadcrumb a {
    color: #5624d0;
    text-decoration: none;
}
.cb-catalog-hero__breadcrumb a:hover { text-decoration: underline; }
.cb-catalog-hero__breadcrumb span[aria-current] { color: #1c1d1f; }

.cb-catalog-hero__title {
    font-size: 36px;
    font-weight: 800;
    margin: 0 0 8px;
    color: #1c1d1f;
    letter-spacing: -0.5px;
    line-height: 1.15;
}
.cb-catalog-hero__subtitle {
    color: #4b5563;
    font-size: 15px;
    margin: 0 0 20px;
}

.cb-catalog-hero__search {
    display: flex;
    gap: 8px;
    max-width: 720px;
}
.cb-catalog-hero__search-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}
.cb-catalog-hero__search-wrap svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #6b7280;
    pointer-events: none;
}
.cb-catalog-hero__search-wrap input[type="search"] {
    width: 100%;
    height: 48px;
    padding: 0 16px 0 42px;
    border: 1px solid #1c1d1f;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    color: #1c1d1f;
}
.cb-catalog-hero__search-wrap input[type="search"]:focus {
    outline: 2px solid #5624d0;
    outline-offset: 1px;
}

/* ----- Layout grid (sidebar + main) -------------------------------------- */
.cb-catalog__layout {
    max-width: 1340px;
    margin: 0 auto;
    padding: 24px;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
    align-items: flex-start;
}

.cb-catalog__filter-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid #1c1d1f;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    color: #1c1d1f;
    font-size: 14px;
}
.cb-catalog__filter-toggle svg { width: 18px; height: 18px; }

/* ----- Sidebar filters --------------------------------------------------- */
.cb-catalog__sidebar {
    position: sticky;
    top: 132px;
    align-self: flex-start;
}
.cb-catalog-filters {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px 18px;
}
.cb-catalog-filters__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}
.cb-catalog-filters__head h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    color: #1c1d1f;
}
.cb-catalog-filters__clear {
    font-size: 13px;
    color: #5624d0;
    text-decoration: none;
    font-weight: 600;
}
.cb-catalog-filters__clear:hover { text-decoration: underline; }

.cb-catalog-filter {
    padding: 14px 0;
    border-bottom: 1px solid #f0f1f3;
}
.cb-catalog-filter:last-of-type { border-bottom: 0; }
.cb-catalog-filter__title {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 10px;
    color: #1c1d1f;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.cb-catalog-filter__opt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    cursor: pointer;
    font-size: 14px;
    color: #1c1d1f;
}
.cb-catalog-filter__opt input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: #5624d0;
    margin: 0;
    cursor: pointer;
}
.cb-catalog-filter__count {
    color: #4b5563;
    font-size: 13px;
}

.cb-catalog-filters__apply {
    margin-top: 16px;
}

/* ----- Star ratings ------------------------------------------------------ */
.cb-catalog-stars {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    color: #d1d5db;
    font-size: 13px;
    line-height: 1;
}
.cb-catalog-stars__star { color: #d1d5db; }
.cb-catalog-stars__star.is-on { color: #b8860b; }
.cb-catalog-stars__star.is-half {
    background: linear-gradient(90deg, #b8860b 50%, #d1d5db 50%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ----- Main column toolbar ---------------------------------------------- */
.cb-catalog__main { min-width: 0; }

.cb-catalog-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
    flex-wrap: wrap;
}
.cb-catalog-toolbar__count {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    color: #1c1d1f;
}
.cb-catalog-toolbar__sort {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}
.cb-catalog-toolbar__sort label {
    color: #4b5563;
}
.cb-catalog-toolbar__sort select {
    height: 38px;
    padding: 0 32px 0 12px;
    border: 1px solid #1c1d1f;
    border-radius: 6px;
    background: #fff;
    color: #1c1d1f;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%231c1d1f' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

/* ----- Active filter chips ---------------------------------------------- */
.cb-catalog-chips {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.cb-catalog-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px 6px 12px;
    background: #f3eefb;
    border: 1px solid #d6c6f5;
    border-radius: 999px;
    font-size: 13px;
    color: #1c1d1f;
}
.cb-catalog-chip__label {
    color: #4b5563;
    font-weight: 600;
}
.cb-catalog-chip__value {
    color: #5624d0;
    font-weight: 700;
}
.cb-catalog-chip__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: transparent;
    color: #5624d0;
    text-decoration: none;
    font-size: 14px;
    line-height: 1;
    margin-left: 2px;
    transition: background 0.15s;
}
.cb-catalog-chip__remove:hover {
    background: #5624d0;
    color: #fff;
}

/* ----- Empty state ------------------------------------------------------- */
.cb-catalog-empty {
    text-align: center;
    padding: 60px 24px;
    background: #f9fafb;
    border-radius: 10px;
    border: 1px dashed #d1d5db;
}
.cb-catalog-empty h2 {
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 8px;
}
.cb-catalog-empty p { color: #4b5563; margin: 0 0 16px; }

/* ----- Course grid ------------------------------------------------------- */
.cb-catalog-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

.cb-cat-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    border: 1px solid transparent;
}
.cb-cat-card:hover {
    border-color: #e5e7eb;
    box-shadow: 0 12px 28px rgba(0,0,0,0.10);
    transform: translateY(-2px);
}
.cb-cat-card__link {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
}
.cb-cat-card__image {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #1c1d1f;
}
.cb-cat-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.cb-cat-card__image-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 64px;
    font-weight: 800;
    letter-spacing: -2px;
}

.cb-cat-card__body {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}
.cb-cat-card__title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 4px;
    color: #1c1d1f;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cb-cat-card__instructor {
    font-size: 12px;
    color: #6a6f73;
    margin: 0 0 6px;
}
.cb-cat-card__rating {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    margin: 0 0 6px;
    color: #1c1d1f;
}
.cb-cat-card__rating strong {
    color: #b4690e;
    font-weight: 700;
}
.cb-cat-card__review-count {
    color: #6a6f73;
    font-size: 12px;
    font-weight: 400;
}
.cb-cat-card__meta {
    font-size: 12px;
    color: #6a6f73;
    margin: 0 0 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    line-height: 1.4;
}
.cb-cat-card__meta span[aria-hidden] { color: #c4c7ca; }

.cb-cat-card__price-row {
    margin: auto 0 0;
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}
.cb-cat-card__price {
    font-size: 18px;
    font-weight: 800;
    color: #1c1d1f;
}
.cb-cat-card__price-was {
    color: #6a6f73;
    font-size: 14px;
    text-decoration: line-through;
}
.cb-cat-card__price-free {
    font-size: 16px;
    font-weight: 800;
    color: #1e7d32;
}
.cb-cat-card__badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #eceb98;
    color: #3d3c0a;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    z-index: 2;
}

/* ----- Pagination -------------------------------------------------------- */
.cb-catalog-pagination {
    margin-top: 32px;
    display: flex;
    justify-content: center;
}
.cb-catalog-pagination ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.cb-catalog-pagination li { display: flex; }
.cb-catalog-pagination a,
.cb-catalog-pagination__current,
.cb-catalog-pagination__disabled {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #1c1d1f;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}
.cb-catalog-pagination a:hover {
    background: #f5f5f7;
    border-color: #1c1d1f;
}
.cb-catalog-pagination__current {
    background: #1c1d1f;
    color: #fff;
    border-color: #1c1d1f;
}
.cb-catalog-pagination__disabled {
    color: #c4c7ca;
    background: #f9fafb;
}
.cb-catalog-pagination__ellipsis {
    color: #6a6f73;
    padding: 0 6px;
    align-self: center;
}

/* ----- Mobile filter backdrop -------------------------------------------- */
.cb-catalog__backdrop {
    position: fixed;
    inset: 0;
    z-index: 8999;
    background: rgba(0,0,0,.5);
    cursor: pointer;
}

/* ----- Responsive -------------------------------------------------------- */
@media (max-width: 1100px) {
    .cb-catalog__layout {
        grid-template-columns: 240px 1fr;
        gap: 24px;
    }
    .cb-catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 880px) {
    .cb-catalog__layout {
        grid-template-columns: 1fr;
    }
    .cb-catalog__filter-toggle {
        display: inline-flex;
        margin-bottom: 16px;
    }
    .cb-catalog__sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(360px, 86vw);
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        z-index: 9000;
        background: #fff;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 16px;
        padding-bottom: 32px;
        box-shadow: 6px 0 24px rgba(0,0,0,0.18);
    }
    .cb-catalog__sidebar.is-open {
        transform: translateX(0);
    }

    .cb-catalog-hero { padding: 24px 0; }
    .cb-catalog-hero__title { font-size: 28px; }
    .cb-catalog-hero__search { flex-direction: column; }
    .cb-catalog-hero__search .cb-btn { width: 100%; }
}

@media (max-width: 540px) {
    .cb-catalog-grid {
        grid-template-columns: 1fr;
    }
    .cb-catalog-toolbar {
        gap: 8px;
    }
    .cb-catalog-toolbar__count { font-size: 16px; }
}
