/* ==========================================================================
   COURSES PAGE - PREMIUM DARK THEME
   - Deep canvas background
   - Glassmorphic card design
   - Precision typography (Archivo + Tenor Sans)
   ========================================================================== */

:root {
    --courses-accent: #3b82f6;
    --courses-accent-glow: #222222;
    --courses-bg: #222222;
    --courses-card-bg: #222222;
    --courses-border: #616161;
    --courses-border-hover: #000000;
}

.courses-page {
    position: relative;
    background-color: var(--courses-bg);
    color: #fff;
    min-height: 100vh;
    padding-bottom: 10rem;
    font-family: 'Tenor Sans', sans-serif;
    z-index: 1;
}

/* Force removal of border-box for the entire course layout */
.courses-page,
.courses-page *,
.courses-page *::before,
.courses-page *::after {
    box-sizing: content-box !important;
}

.courses-page::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(34, 34, 34, 0.25) 0%, rgba(34, 34, 34, 0.5) 100%),
        url('../bg/test.webp');
    background-size: cover;
    background-position: center;
    z-index: -1;
    pointer-events: none;
    transform: translateZ(0);
    /* Hardware Acceleration */
    backface-visibility: hidden;
    will-change: transform;
}

/* Mobile specific: Keep fixed to prevent zoom, ensure smooth viewport scaling */
@media (max-width: 768px) {
    .courses-page::before {
        position: fixed;
        height: 100vh;
    }
}

/* Fix white line issue on mobile (padding-top on main showing body background) */
main.flex-shrink-0 {
    background-color: var(--courses-bg);
}

/* --- Hero Section --- */
.courses-hero {
    padding-top: clamp(4.5rem, 12vw, 11rem);
    padding-left: clamp(0.5rem, 2vw, 1rem);
    padding-right: clamp(0.5rem, 2vw, 1rem);
    padding-bottom: clamp(2.5rem, 5vw, 4rem);
    overflow: visible;
}

.courses-hero-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: clamp(2rem, 5vw, 6rem);
    align-items: center;
    padding: 0;
    overflow: visible;
}

.courses-hero-paragraph {
    font-family: 'Tenor Sans', sans-serif;
    font-size: clamp(1.15rem, 1.5vw, 1.35rem);
    /* Increased font size */
    line-height: 1.7;
    color: #ffffff;
    /* Pure white color */
    margin: 0;
    max-width: 750px;
    width: 100%;
    font-weight: 400;
    transform: translateZ(0);
    will-change: opacity;
}

@media (max-width: 991px) {
    .courses-hero-inner {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .courses-hero-paragraph {
        max-width: 100%;
    }
}

.courses-welcome-heading-block {
    padding-left: 0;
    margin-left: 0;
    width: 100%;
    max-width: 100%;
    text-align: left;
    box-sizing: border-box;
}

.courses-welcome-heading-block .courses-title {
    margin-bottom: clamp(1.1rem, 2.25vw, 1.65rem);
}

/* Title — same as .about-welcome-title */
.courses-title {
    font-family: 'Archivo', sans-serif;
    font-size: 65px;
    font-weight: 500;
    line-height: 1.17;
    letter-spacing: 0.02em;
    text-transform: none;
    margin: 0 0 1.25rem;
    color: #fff;
    transform: translateZ(0);
    /* Acceleration */
    will-change: transform, opacity;
}

/* SplitText (animation__word_come) anchor */
.courses-title.animation__word_come {
    position: relative;
}

/* Kicker — same as .about-welcome-kicker */
.courses-subtitle {
    margin: 0 0 clamp(1rem, 2vw, 1.5rem);
    font-family: 'Archivo', sans-serif;
    font-size: 24px;
    font-weight: 400;
    line-height: 1.4;
    letter-spacing: 0.02em;
    text-transform: none;
    color: var(--courses-accent);
    display: block;
}

/* Responsive — same breakpoints as about.css */
@media only screen and (min-width: 1200px) and (max-width: 1399px) {
    .courses-title {
        font-size: 55px;
    }
}

@media only screen and (min-width: 768px) and (max-width: 991px),
only screen and (min-width: 992px) and (max-width: 1199px) {
    .courses-title {
        font-size: 50px;
    }
}

@media only screen and (min-width: 576px) and (max-width: 767px) {
    .courses-title {
        font-size: 46px;
    }
}

@media (max-width: 575px) {
    .courses-subtitle {
        margin-bottom: clamp(0.85rem, 3vw, 1.15rem);
        font-size: 20px;
    }

    .courses-title {
        font-size: clamp(28px, 9vw, 38px);
        text-align: start;
        white-space: normal;
        word-break: keep-all;
        will-change: transform, opacity;
        /* Force mobile optimization */
    }
}

/* --- Container & Filters --- */
.courses-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 clamp(0.5rem, 2vw, 1rem);
}

.courses-filter-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4rem;
    padding: 3rem 0;
    border-top: 1px solid var(--courses-border);
    gap: 2rem;
}

.courses-filter {
    display: flex;
    align-items: center;
    position: relative;
    z-index: 1001;
    /* Above header if sticky */
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.filter-label {
    font-family: 'Archivo', sans-serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.4);
}

.custom-dropdown {
    position: relative;
    min-width: 260px;
    font-family: 'Archivo', sans-serif;
    z-index: 1001;
}

.dropdown-trigger {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 0.85rem 1.5rem;
    border-radius: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    position: relative;
    width: 100%;
    /* Ensure button expands to container */
    outline: none;
}

.dropdown-trigger * {
    pointer-events: none;
    /* Ensure click always hits the parent trigger */
}

.dropdown-trigger:hover {
    border-color: var(--courses-accent);
    background: rgba(255, 255, 255, 0.08);
}

.custom-dropdown.is-open .dropdown-trigger {
    border-color: var(--courses-accent);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.15);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    width: 100%;
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 0.75rem;
    margin: 0;
    list-style: none;
    display: none;
    /* Hidden by default, shown when .is-open */
    transform: translateY(-10px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    max-height: 350px;
    overflow-y: auto;
    z-index: 2000;

    /* Hide native scrollbar but keep functionality */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
}

.dropdown-menu::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.custom-dropdown.is-open .dropdown-menu {
    display: block;
    transform: translateY(0);
}

.dropdown-item {
    padding: 0.85rem 1.25rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.dropdown-item:last-child {
    margin-bottom: 0;
}

.dropdown-item:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--courses-accent);
    padding-left: 1.5rem;
}

.dropdown-item.is-active {
    background: var(--courses-accent);
    color: #fff;
}

/* --- Search Bar Styles --- */
.courses-search {
    flex-grow: 1;
    max-width: 450px;
    position: relative;
    z-index: 10;
    /* Lower than dropdown */
}

.search-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.search-field {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    padding: 0.85rem 3.5rem 0.85rem 1.5rem;
    color: #fff;
    font-family: 'Archivo', sans-serif;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-field:focus {
    outline: none;
    border-color: var(--courses-accent);
    /* Switched to blue for consistency */
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}

.search-btn {
    position: absolute;
    right: 5px;
    background: var(--courses-accent);
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    box-sizing: border-box !important;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-btn:hover {
    transform: scale(1.1);
    background: #2563eb;
    /* Darker blue on hover */
}

@media (max-width: 768px) {
    .courses-filter-wrap {
        flex-direction: column;
        align-items: stretch;
        gap: 1.5rem;
        padding: 2rem 0;
    }

    .courses-search {
        max-width: 100%;
    }
}

/* --- Grid & Cards --- */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.course-card {
    position: relative;
    background: rgba(34, 34, 34, 0.45);
    /* Solid semi-transparent background */
    border: 1px solid var(--courses-border);
    border-radius: 45px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateZ(0);
    /* Hardware Acceleration */
    backface-visibility: hidden;
    will-change: transform;
}

.course-thumb-wrap {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    border-radius: 30px;
    margin: 1rem 1rem 0 1rem;
    background: #1a1a2e;
    z-index: 2;
}

.course-card-link-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
}

.cert-badge-card {
    position: absolute;
    bottom: 0.85rem;
    right: 0.85rem;
    width: auto;
    height: auto;
    padding: 6px 14px;
    background: rgba(34, 197, 94, 0.2);
    backdrop-filter: blur(8px);
    color: #4ade80;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50px;
    border: 1px solid rgba(34, 197, 94, 0.3);
    z-index: 3;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

/* Per-card distinct backgrounds — auto via course ID % 8 */
.thumb-bg-1 {
    background: linear-gradient(135deg, #2d1b69, #170d3a);
}

/* Purple — React */
.thumb-bg-2 {
    background: linear-gradient(135deg, #1565c0, #0d2744);
}

/* Blue — Node */
.thumb-bg-3 {
    background: linear-gradient(135deg, #1e5c2a, #0a2b12);
}

/* Green — Python */
.thumb-bg-4 {
    background: linear-gradient(135deg, #6b2d00, #3a1800);
}

/* Amber — Flutter */
.thumb-bg-5 {
    background: linear-gradient(135deg, #8b1a1a, #4a0a0a);
}

/* Crimson — Kali */
.thumb-bg-6 {
    background: linear-gradient(135deg, #005f5f, #003030);
}

/* Teal — Figma */
.thumb-bg-7 {
    background: linear-gradient(135deg, #4a1565, #25083a);
}

/* Violet */
.thumb-bg-8 {
    background: linear-gradient(135deg, #1a3a5c, #0a1e30);
}

/* Slate Blue */

/* Main SVG icon — bottom-left of thumb area */
.course-svg-main {
    position: absolute;
    bottom: 0.85rem;
    left: 0.85rem;
    width: 52px;
    height: 52px;
    object-fit: contain;
    z-index: 3;
    /* Simplified shadow for performance */
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5));
}

.course-badge {
    display: none;
}

.course-discount-tag {
    position: absolute;
    top: 0;
    right: 0;
    background: #e11d48;
    color: #fff;
    padding: 0.45rem 0.9rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    z-index: 4;
    border-radius: 0 8px 0 8px;
}

.course-content {
    padding: 2.25rem 2rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.course-meta-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    gap: 8px;
    width: 100%;
    flex-wrap: nowrap;
}

.course-cat {
    font-family: 'Archivo', sans-serif;
    font-size: 0.72rem;
    text-transform: capitalize;
    letter-spacing: 0.12em;
    color: var(--courses-accent);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex-shrink: 1;
}

.course-expiry {
    font-family: 'Archivo', sans-serif;
    font-size: 0.68rem;
    font-weight: 700;
    color: #10b981;
    background: rgba(16, 185, 129, 0.12);
    padding: 4px 10px;
    border-radius: 50px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.course-expiry.expired {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.course-name {
    font-family: 'Archivo', sans-serif;
    font-size: 1.65rem;
    font-weight: 500;
    margin-bottom: 1rem;
    line-height: 1.2;
    color: #f1f1f1;
}

.course-desc {
    color: rgba(255, 255, 255, 0.5);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 3rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.course-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 2rem;
    border-top: 1px solid var(--courses-border);
}

.course-price-wrap {
    display: flex;
    flex-direction: column;
}

.course-price-original {
    font-family: 'Archivo', sans-serif;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.3);
    text-decoration: line-through;
}

.course-price-current {
    font-family: 'Archivo', sans-serif;
    font-size: 1.8rem;
    font-weight: 600;
    color: #fff;
    line-height: 1;
}

.course-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: #000;
    padding: 0.9rem 1.8rem;
    text-decoration: none !important;
    font-family: 'Archivo', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    border-radius: 30px;
    transition: all 0.3s ease;
}

.course-btn:hover {
    background: var(--courses-accent);
    color: #fff;
}

.no-courses {
    grid-column: 1 / -1;
    text-align: center;
    padding: 10rem 0;
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.2);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* --- Responsive --- */
@media (max-width: 1400px) {
    .courses-grid {
        gap: 2rem;
    }
}

@media (max-width: 992px) {
    .courses-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    }
}

@media (max-width: 768px) {
    .courses-grid {
        grid-template-columns: 1fr;
    }

    .filter-select {
        min-width: 100%;
    }

    .filter-group {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
}
