/* === COURSES PAGE STYLES (Figma Design) === */

/* Courses Hero Section - Full bleed with background image */
.courses-hero {
    position: relative;
    min-height: 100vh;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

/* Background image layer */
.courses-hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.courses-hero-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Dark overlay */
.courses-hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(4, 26, 49, 0.60) 0%, rgba(4, 26, 49, 0.75) 100%);
    z-index: 1;
}

/* Dot pattern overlay */
.courses-hero-dots {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    background-image: radial-gradient(rgba(255, 255, 255, 0.15) 2px, transparent 2px);
    background-size: 58px 58px;
    pointer-events: none;
}

/* Hero content container */
.courses-hero-content {
    position: relative;
    z-index: 3;
    width: 100%;
    max-width: 1200px;
    padding: 140px 40px 80px;
    margin: 0 auto;
}

/* Hero text section */
.courses-hero-text {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 48px;
}

.courses-hero-title {
    font-family: 'Onest', sans-serif;
    font-size: var(--fluid-h1); /* 28px → 64px fluid */
    font-weight: 400;
    line-height: 1.1;
    color: #FFFFFF;
    margin-bottom: var(--spacing-4); /* 16px fixed */
}

.courses-hero-subtitle {
    font-family: 'Onest', sans-serif;
    font-size: var(--fluid-body); /* 16px → 18px fluid - meets WCAG minimum */
    font-weight: 400;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.75);
    max-width: 600px;
    margin: 0 auto;
}

/* Category Tabs - Glassmorphism Container */
.courses-tabs-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.courses-category-tabs {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0;
    padding: 8px;
    border-radius: 20px;
    background: rgb(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.courses-category-tab {
    position: relative;
    padding: var(--fluid-space-sm); /* Equal padding all sides */
    border-radius: 10px;
    font-family: var(--font-family-base);
    font-size: var(--fluid-small); /* 14px → 16px fluid */
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.courses-category-tab:hover {
    color: rgba(255, 255, 255, 0.8);
}

.courses-category-tab.active {
    color: #FFFFFF;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-top-color: transparent;
    -webkit-box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    -moz-box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}


/* Search & Filters */
.courses-filters {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.courses-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.courses-search-icon {
    position: absolute;
    right: 16px;
    color: rgba(255, 255, 255, 0.5);
    pointer-events: none;
    transition: color 0.3s ease;
}

.courses-search-wrapper:focus-within .courses-search-icon {
    color: rgba(255, 255, 255, 0.8);
}

.courses-search-input {
    width: 400px;
    max-width: 100%;
    padding: var(--fluid-space-sm) 48px var(--fluid-space-sm) 20px; /* 8px-16px fluid */
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    font-family: var(--font-family-base);
    font-size: var(--fluid-input); /* 16px min (prevents iOS zoom) */
    background: rgb(255, 255, 255, 0.05);
    color: white;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.courses-search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.courses-search-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.courses-filter-wrapper {
    position: relative;
}

.courses-filter-dropdown {
    width: 400px;
    max-width: 100%;
    padding: var(--fluid-space-sm) 48px var(--fluid-space-sm) 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    font-family: var(--font-family-base);
    font-size: var(--fluid-input); /* 16px min (prevents iOS zoom) */
    background: rgb(255, 255, 255, 0.05);
    color: white;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6,9 12,15 18,9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.courses-filter-dropdown:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.courses-filter-dropdown option {
    background: #1a1a2e;
    color: white;
}

.courses-clear-btn {
    padding: var(--fluid-space-sm) var(--fluid-space-xs);
    font-family: var(--font-family-base);
    font-size: var(--fluid-small); /* 14px → 16px fluid */
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.courses-clear-btn:hover {
    color: white;
}

/* Custom Dropdown - Frosted Glass Style */
.custom-dropdown {
    position: relative;
    width: 400px;
    max-width: 100%;
}

.custom-dropdown-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--fluid-space-sm) 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    font-family: var(--font-family-base);
    font-size: var(--fluid-input); /* 16px min (prevents iOS zoom) */
    background: rgb(255, 255, 255, 0.05);
    color: white;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.custom-dropdown-trigger:hover,
.custom-dropdown-trigger:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.custom-dropdown.open .custom-dropdown-trigger {
    border-radius: 10px 10px 0 0;
    border-bottom-color: transparent;
}

.custom-dropdown-value {
    flex: 1;
    text-align: left;
}

.custom-dropdown-icon {
    flex-shrink: 0;
    opacity: 0.5;
    transition: transform 0.3s ease;
}

.custom-dropdown.open .custom-dropdown-icon {
    transform: rotate(180deg);
}

.custom-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    background: rgb(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-top: none;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 100;
    max-height: min(60vh, 400px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.custom-dropdown.open .custom-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-dropdown-option {
    padding: var(--fluid-space-sm) 20px;
    font-family: var(--font-family-base);
    font-size: var(--fluid-small); /* 14px → 16px fluid */
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.custom-dropdown-option:last-child {
    border-bottom: none;
}

.custom-dropdown-option:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.custom-dropdown-option.active {
    color: white;
    background: rgba(255, 255, 255, 0.08);
}

/* Multi-Select Dropdown Styles */
.custom-dropdown-multi .custom-dropdown-menu {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px 0;
}

.custom-dropdown-multi .dropdown-group {
    padding: 0;
}

.custom-dropdown-multi .dropdown-group-header {
    padding: 12px 20px 8px;
    font-size: var(--fluid-xs);
    font-weight: 600;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.custom-dropdown-multi .dropdown-group:first-child .dropdown-group-header {
    border-top: none;
}

.custom-dropdown-multi .custom-dropdown-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: none;
}

.custom-dropdown-multi .custom-dropdown-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.custom-dropdown-multi .custom-dropdown-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.custom-dropdown-multi .checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 4px;
    background: transparent;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.custom-dropdown-multi .custom-dropdown-option:hover .checkbox-custom {
    border-color: rgba(255, 255, 255, 0.6);
}

.custom-dropdown-multi .custom-dropdown-option input[type="checkbox"]:checked + .checkbox-custom {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.custom-dropdown-multi .custom-dropdown-option input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.custom-dropdown-multi .custom-dropdown-option span:last-child {
    flex: 1;
    color: rgba(255, 255, 255, 0.85);
    font-size: var(--fluid-small);
}

/* Selected count badge */
.custom-dropdown-value .filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    margin-left: 8px;
    background: var(--color-primary);
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

/* NEW label for dropdown options */
.custom-dropdown-option .new-label {
    font-style: normal;
    font-size: 10px;
    font-weight: 600;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-left: 4px;
}

/* Coming Soon label and disabled state */
.custom-dropdown-option .coming-soon-label {
    font-style: italic;
    font-size: 10px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    margin-left: 4px;
}

.custom-dropdown-option.option-coming-soon {
    opacity: 0.6;
    cursor: not-allowed;
}

.custom-dropdown-option.option-coming-soon:hover {
    background: transparent;
}

.custom-dropdown-option.option-coming-soon .checkbox-custom {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Courses Grid Section */
.courses-grid-section {
    padding: var(--fluid-space-lg) 0 var(--fluid-space-xl); /* 24px-64px / 32px-80px fluid */
    background: #FFFFFF;
}

.courses-grid-section .container {
    max-width: 1640px;
    padding: 0 40px;
}

/* Courses Grid - 4 columns */
.courses-card-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 380px));
    gap: 36px;
    justify-content: center;
    margin-bottom: 50px;
}

/* Center last visible card when alone in its row */
/* Note: Uses .last-visible-card class managed by JS since :last-child doesn't account for hidden elements */
.courses-card.last-visible-card.center-last {
    grid-column: 1 / -1;
    justify-self: center;
    max-width: 380px;
}

/* Course Card */
.courses-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0px 2px 8px 0px rgba(0, 0, 0, 0.25);
    mix-blend-mode: plus-darker;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative; /* Required for stretched link */
}

.courses-card:hover {
    transform: translateY(-4px);
    box-shadow: 0px 4px 16px 0px rgba(0, 0, 0, 0.3);
}

/* Hidden state for load more functionality */
.courses-card.hidden {
    display: none;
}

/* Card Image Container */
.courses-card-image {
    position: relative;
    width: 100%;
    height: 285px;
    overflow: hidden;
    border-radius: 10px;
}

.courses-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.courses-card:hover .courses-card-image img {
    transform: scale(1.05);
}

/* Fading frosted gradient overlay - light/transparent version */
.courses-card-image::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;

    /* The Blur Effect */
    backdrop-filter: blur(12px) saturate(120%);
    -webkit-backdrop-filter: blur(12px) saturate(120%);

    /* Light/Transparent Gradient Tint */
    background: linear-gradient(
        to top,
        rgba(255, 255, 255, 0.25) 0%,
        rgba(255, 255, 255, 0.1) 25%,
        rgba(255, 255, 255, 0) 55%
    );

    /* The Fade Mask - solid at bottom, transparent at top */
    mask-image: linear-gradient(to top, black 0%, black 15%, transparent 45%);
    -webkit-mask-image: linear-gradient(to top, black 0%, black 15%, transparent 45%);

    border-radius: 10px;
    pointer-events: none;
}

/* Tags on image - positioned above the frosted overlay */
.courses-card-tags {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    padding: 16px;
}

.courses-card-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: 'Onest', sans-serif;
    font-size: var(--fluid-body); /* 16px → 18px fluid */
    font-weight: 400;
    color: #FFFFFF;
}

.courses-card-tag-icon {
    display: none;
}

/* Card Content */
.courses-card-content {
    padding: 20px 16px 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
    text-align: center;
    /* MH Glass Morphism Effect */
    background: rgba(244, 246, 254, 0.25);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
}

.courses-card-category {
    font-family: 'Onest', sans-serif;
    font-size: var(--fluid-body); /* 16px → 18px fluid */
    font-weight: 400;
    color: #041A31;
    margin-bottom: var(--fluid-space-xs); /* 4px → 8px fluid */
}

.courses-card-title {
    font-family: 'Onest', sans-serif;
    font-size: var(--fluid-body-lg); /* 18px → 22px fluid */
    font-weight: 500;
    color: #041A31;
    line-height: 1.4;
    margin-bottom: var(--fluid-space-md); /* 16px → 32px fluid */
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.courses-card-footer {
    margin-top: auto;
}

.courses-card-link {
    display: inline-block;
    font-family: 'Onest', sans-serif;
    font-size: var(--fluid-body-lg); /* 18px → 22px fluid */
    font-weight: 500;
    color: #2D368F;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: underline;
}

.courses-card-link:hover {
    color: var(--color-primary);
}

/* Legacy button styles (for backwards compatibility) */
.courses-card-btn {
    display: none;
}

.courses-card-readmore {
    display: none;
}

/* Empty State - Coming Soon */
.courses-empty-state {
    width: 100%;
    padding: var(--fluid-space-xl) var(--fluid-space-md);
    text-align: center;
}

.courses-empty-text {
    font-family: 'Onest', sans-serif;
    font-size: var(--fluid-h3);
    font-weight: 500;
    color: var(--color-text-light);
}

/* Load More Button - styled like "More info" link */
.courses-load-more-wrapper {
    display: flex;
    justify-content: center;
}

.courses-load-more-btn {
    background: none;
    border: none;
    padding: 0;
    font-family: 'Onest', sans-serif;
    font-size: var(--fluid-body-lg); /* 18px → 22px fluid */
    font-weight: 500;
    color: var(--color-secondary);
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.3s ease;
}

.courses-load-more-btn:hover {
    color: var(--color-primary);
}

/* Responsive Styles */
@media (max-width: 1280px) {
    .courses-card-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Adjust max-width for 3-column centering */
    .courses-card.last-visible-card.center-last {
        max-width: calc(33.333% - 24px);
    }

    .courses-grid-section .container {
        max-width: 1100px;
    }
}

@media (max-width: 1024px) {
    .courses-hero-content {
        padding: var(--fluid-section) var(--fluid-space-md) var(--fluid-space-lg);
    }

    .courses-card-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--fluid-space-md);
    }

    /* Adjust max-width for 2-column centering */
    .courses-card.last-visible-card.center-last {
        max-width: calc(50% - 16px);
    }

    .courses-grid-section .container {
        padding: 0 var(--fluid-space-md);
    }

    .courses-card-image {
        height: 240px;
    }
}

@media (max-width: 768px) {
    .courses-hero {
        min-height: auto;
    }

    .courses-hero-content {
        padding: var(--fluid-section) var(--fluid-space-md) var(--fluid-space-lg);
    }

    .courses-hero-subtitle {
        line-height: var(--line-height-relaxed); /* 1.6 - matches hero-subtitle-white */
        color: rgba(255, 255, 255, 0.8);
        max-width: 43.75rem; /* 700px - matches hero-subtitle-white */
    }

    /* Font sizes now handled by fluid variables */

    .courses-tabs-container {
        width: 100%;
        padding: 0 16px;
        margin-bottom: 35px; /* Gap between tabs and search */
    }

    .courses-category-tabs {
        flex-direction: column;
        width: 100%;
        gap: 8px;
        padding: 8px 16px 16px 16px;
        border-radius: 10px;
    }

    .courses-category-tab {
        padding: var(--fluid-space-sm) var(--fluid-space-md); /* More vertical padding for mobile */
        width: 100%;
        text-align: center;
    }

    .courses-filters {
        flex-direction: column;
        gap: var(--fluid-space-xs);
        width: 100%;
        align-items: stretch;
        padding: 0 16px;
    }

    .courses-search-wrapper {
        width: 100%;
        max-width: none;
        margin-bottom: 20px; /* Gap between search and courses grid */
    }

    .courses-filter-wrapper,
    .custom-dropdown {
        width: 100%;
        max-width: none;
    }

    .courses-search-input,
    .courses-filter-dropdown {
        width: 100%;
    }

    .courses-grid-section .container {
        padding: 0 var(--fluid-space-md);
    }
}

@media (max-width: 768px) {
    .courses-card-grid {
        grid-template-columns: 1fr;
        gap: var(--fluid-space-md);
    }

    /* Reset centering - full width on mobile */
    .courses-card.last-visible-card.center-last {
        grid-column: auto;
        justify-self: auto;
        max-width: none;
    }

    .courses-card-image {
        height: 220px;
    }

    .courses-card-content {
        padding: var(--fluid-space-lg); /* More padding on all sides for mobile */
    }

    .courses-card-title {
        font-size: var(--fluid-body); /* 16px → 18px fluid on mobile */
    }

    .courses-card-tags {
        padding: var(--fluid-space-md);
    }
}

/* ========================================
   MOBILE BORDER RADIUS OVERRIDE
   All 20px border-radius becomes 10px at 768px and below
   ======================================== */
@media (max-width: 768px) {
    .courses-category-tab {
        border-radius: 10px;
    }

    .courses-card {
        border-radius: 10px;
    }
}
