@import url('/css/global.css');

/* ============================================================
   COURSES PAGE
   Program Theme is injected from Razor into .dw-page:
   
   --program-theme-main
   --program-theme-secondary
   ============================================================ */

body {
    background-color: var(--dw-bg-body);
}


/* ============================================================
   ENTRY ANIMATIONS
   ============================================================ */

@keyframes dw-fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: no-preference) {
    .a {
        animation: dw-fadeUp .5s cubic-bezier(.22,1,.36,1) both;
    }

    .a1 {
        animation-delay: .05s;
    }

    .a2 {
        animation-delay: .12s;
    }

    .a3 {
        animation-delay: .18s;
    }

    .a4 {
        animation-delay: .25s;
    }

    .a5 {
        animation-delay: .32s;
    }

    .a6 {
        animation-delay: .38s;
    }

    .a7 {
        animation-delay: .44s;
    }

    .a8 {
        animation-delay: .50s;
    }
}


/* ============================================================
   PAGE WRAPPER + PROGRAM THEME
   ============================================================ */

.dw-page {
    margin: 0 auto;
    padding: 40px 64px;
    /*
     * These two values are injected by Razor.
     * Fallbacks are only used when there is no Theme.
     */
    --program-theme-main: #0077C0;
    --program-theme-secondary: #005E99;
    /* ========================================================
       Re-map the old Dubai Way brand tokens to the
       currently selected Admin MainColor.
       ======================================================== */

    --dw-teal: var(--program-theme-main);
    --dw-teal-b: var(--program-theme-main);
    --dw-teal-bold: var(--program-theme-main);
    --dw-teal-300: var(--program-theme-main);
    --dw-teal-400: var(--program-theme-main);
    --dw-teal-500: var(--program-theme-main);
    --dw-teal-600: var(--program-theme-main);
    --dw-teal-50: color-mix( in srgb, var(--program-theme-main) 20%, white );
    --dw-teal-100: color-mix( in srgb, var(--program-theme-main) 15%, white );
    /* ========================================================
       Transparent MainColor variations
       ======================================================== */

    --dw-teal-2: color-mix( in srgb, var(--program-theme-main) 10%, transparent );
    --dw-teal-4: color-mix( in srgb, var(--program-theme-main) 40%, transparent );
    --dw-teal-5: color-mix( in srgb, var(--program-theme-main) 5%, transparent );
    --dw-teal-10: color-mix( in srgb, var(--program-theme-main) 10%, transparent );
    --dw-teal-20: color-mix( in srgb, var(--program-theme-main) 20%, transparent );
    --dw-teal-30: color-mix( in srgb, var(--program-theme-main) 30%, transparent );
    --dw-teal-40: color-mix( in srgb, var(--program-theme-main) 80%, transparent );
    --dw-teal-90: color-mix( in srgb, var(--program-theme-main) 90%, transparent );
    /* ========================================================
       Light MainColor variations
       ======================================================== */

    --dw-teal-light: color-mix( in srgb, var(--program-theme-main) 50%, white );
    --dw-teal-l: color-mix( in srgb, var(--program-theme-main) 10%, white );
    /* ========================================================
       Newsletter / branded gradient
       MainColor -> SecondaryColor
       ======================================================== */

    --dw-stats-from: var(--program-theme-main);
    --dw-stats-to: var(--program-theme-secondary);
}


/* ============================================================
   HERO
   ============================================================ */

.dwx-hero {
    margin-bottom: 20px;
    margin-top:-15px;
    /*
     * Main program color controls the hero branding.
     */
    background: var(--program-theme-main);
    border-radius: 0;
    padding: 40px 32px;
}

    .dwx-hero h1 {
        font-size: 4rem;
        font-weight: 700;
        color: #ffffff !important;
        letter-spacing: -1.28px;
        line-height: 4.4rem;
        margin-top: 0;
        margin-bottom: 9px;
    }

    .dwx-hero p {
        font-size: 1.125rem;
        color: rgba(255, 255, 255, .9) !important;
        line-height: 1.8rem;
        max-width: 30.3125rem;
    }

/*
 * Inside banner set by the Program Admin (ADM-BRAND-02). Without an image it runs main-to-secondary;
 * over an image a dark wash on the text side keeps the title legible. The page's theme block sets the
 * hero background with !important, so these selectors are more specific and important too.
 */
.dw-page .dwx-hero.dwx-hero--banner {
    background-image: linear-gradient(135deg, var(--program-theme-main), var(--program-theme-secondary)) !important;
}

.dw-page .dwx-hero.dwx-hero--banner.has-image {
    background-image: linear-gradient(90deg, rgba(10, 20, 45, .72), rgba(10, 20, 45, .15)), var(--dwx-banner-image) !important;
    background-size: cover !important;
    background-position: center !important;
}

[dir="rtl"] .dw-page .dwx-hero.dwx-hero--banner.has-image {
    background-image: linear-gradient(270deg, rgba(10, 20, 45, .72), rgba(10, 20, 45, .15)), var(--dwx-banner-image) !important;
}

    .dwx-hero--banner h1,
    .dwx-hero--banner p {
        text-shadow: 0 1px 3px rgba(0, 0, 0, .3);
        overflow-wrap: anywhere;
    }

    .dwx-hero--banner p {
        max-width: 40rem;
    }

@media (max-width: 480px) {
    .dwx-hero--banner h1 {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}


/* ============================================================
   SEARCH BAR
   ============================================================ */

.dw-search-bar {
    width: 73%;
    max-width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--dw-white);
    border: 1px solid var(--dw-brd-100);
    border-radius: 12px;
    padding: 8px;
    height: 57px;
    margin-bottom: 25px;
    box-shadow: 0px 8px 32px 0px rgba(0, 0, 0, 0.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.dw-search-bar__icon {
    color: var(--program-theme-main) !important;
    flex-shrink: 0;
    margin-top: 4px;
    padding-inline-start: 10px;
}

.dw-search-bar input {
    /* min-width: 0 lets the field shrink inside flex so the Search button
       is not pushed outside / over the bar on narrow mobile viewports. */
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    border: none;
    background: transparent;
    font-size: 1rem;
    color: var(--dw-bdr-b);
    padding: 0 12px;
    outline: none;
    /* iOS Safari search fields ship with native chrome that inflates width. */
    -webkit-appearance: none;
    appearance: none;
}

    .dw-search-bar input::placeholder {
        color: var(--dw-placeholder);
    }

    .dw-search-bar input::-webkit-search-decoration,
    .dw-search-bar input::-webkit-search-cancel-button {
        -webkit-appearance: none;
    }


/* ============================================================
   SEARCH BUTTON
   SecondaryColor
   ============================================================ */

.dw-search-btn {
    flex-shrink: 0;
    min-height: 40px;
    padding: 0 22px;
    background: var(--program-theme-secondary) !important;
    color: #ffffff !important;
    font-size: 1rem;
    font-weight: 400;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: filter .18s, transform .15s;
}

    .dw-search-btn:hover {
        background: var(--program-theme-secondary) !important;
        filter: brightness(.92);
    }

    .dw-search-btn:focus-visible {
        outline: 2px solid var(--program-theme-secondary) !important;
        outline-offset: 2px;
    }


/* ============================================================
   MAIN PROGRAM SWITCHER
   ============================================================ */

.dw-tracks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

    .dw-tracks .dwx-pill {
        text-decoration: none;
    }


/* ============================================================
   FILTER PILLS
   ============================================================ */

.dw-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 35px;
}

.dwx-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 12px 24px;
    border-radius: 100px;
    border: 1px solid var(--dw-brd-100);
    background: var(--dw-white-40);
    font-size: 1rem;
    font-weight: 400;
    color: var(--dw-ink);
    cursor: pointer;
    transition: all .15s;
}

    .dwx-pill:hover {
        border-color: var(--program-theme-main) !important;
        color: var(--program-theme-main) !important;
    }

    .dwx-pill.active {
        background: var(--program-theme-main) !important;
        border-color: var(--program-theme-main) !important;
        color: #ffffff !important;
    }

    .dwx-pill:focus-visible {
        outline: 2px solid var(--program-theme-main) !important;
        outline-offset: 2px;
    }


/* ============================================================
   COURSES GRID
   ============================================================ */

/* Three per row as in the design; rows stretch, so every card in a row is the same height. */
.dw-courses-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    margin-bottom: 55px;
}

@media (max-width: 900px) {
    .dw-courses-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {
    .dw-courses-grid {
        grid-template-columns: 1fr;
    }
}


/* ============================================================
   STATUS ALERT
   ============================================================ */

.dw-courses-alert {
    background: #FEF3C7;
    color: #92400E;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 24px;
    font-size: 0.9375rem;
}

.dw-courses-alert--info {
    background: var(--dw-teal-10);
    color: var(--program-theme-main) !important;
}

/* Guest with Guest Browsing off: the notice and its UAE Pass button replace the grid. */
.dw-courses-login {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
    padding: 20px 24px;
}

    .dw-courses-login p {
        margin: 0;
    }

    .dw-courses-login .dw-btn {
        color: #FFFFFF !important;
    }

/* The job type behind an entitlement: secondary to the notice it follows, on its own line. */
.dw-courses-alert__meta {
    display: block;
    margin-top: 4px;
    font-size: 0.875rem;
    opacity: 0.85;
}


/* ============================================================
   COURSE CARD
   ============================================================ */

.dw-course-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    background: var(--dw-white-40);
    border: 1px solid var(--dw-brd-100);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow .2s, transform .15s, border-color .15s;
}

    .dw-course-card:hover {
        box-shadow: var(--dw-shadow-lg);
        transform: translateY(-2px);
        border-color: var(--program-theme-main) !important;
    }


/* ============================================================
   COURSE IMAGE
   ============================================================ */

.dwx-card-img {
    position: relative;
    flex: 0 0 auto;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--dw-surf);
}

    .dwx-card-img img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        transition: transform .35s;
    }

.dw-course-card:hover .dwx-card-img img {
    transform: scale(1.04);
}


/* ============================================================
   PRICE / STATUS BADGE
   SecondaryColor
   ============================================================ */

.dw-price-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--program-theme-secondary) !important;
    color: #ffffff !important;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 100px;
    box-shadow: 0px 8px 2px 0px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}


/* ============================================================
   CARD BODY
   ============================================================ */

/* Fills the card below the image, so the meta row (and its CTA) sits on the same line across a row. */
.dw-card-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    padding: 20px 20px 18px;
}

.dw-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--program-theme-main) !important;
    line-height: 1.6rem;
    margin-bottom: 8px;
    margin-top: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dw-card-desc {
    font-size: 0.9375rem;
    color: var(--dw-muted);
    line-height: 1.5rem;
    margin-top: 0;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

    /* Admin rich text: flatten its blocks into one run of text so the 3-line clamp applies to all of it. */
    .dw-card-desc :is(p, ul, ol, li, div, h1, h2, h3, h4) {
        display: inline;
        margin: 0;
        padding: 0;
        font-size: inherit;
        font-weight: inherit;
    }

        .dw-card-desc :is(p, li, div)::after {
            content: " ";
        }

/* nowrap + wrap: "5 Hours · Certificate" never breaks mid-item; on a narrow card the CTA drops to its own line. */
.dw-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 7px;
    white-space: nowrap;
    margin-top: auto;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--dw-muted);
}

.dw-card-cta {
    margin-inline-start: auto;
    white-space: nowrap;
    font-weight: 600;
    color: var(--program-theme-main);
}

.dw-card-cta__arrow {
    display: inline-block;
    transition: transform .15s;
}

[dir="rtl"] .dw-card-cta__arrow {
    transform: scaleX(-1);
}

.dw-course-card:hover .dw-card-cta__arrow {
    transform: translateX(3px);
}

[dir="rtl"] .dw-course-card:hover .dw-card-cta__arrow {
    transform: scaleX(-1) translateX(3px);
}

/* Shown by the search script when nothing matches. */
.dw-courses-empty {
    text-align: center;
    padding: 48px 24px;
    margin-bottom: 55px;
    border: 1px dashed var(--dw-brd-100);
    border-radius: 12px;
    color: var(--dw-muted);
}

    .dw-courses-empty[hidden] {
        display: none;
    }

    .dw-courses-empty h3 {
        margin: 0 0 6px;
        font-size: 1.125rem;
        color: var(--dw-ink);
    }

    .dw-courses-empty p {
        margin: 0 0 18px;
    }

    .dw-courses-empty button {
        cursor: pointer;
        border: 1px solid var(--program-theme-main);
        background: transparent;
        color: var(--program-theme-main);
        border-radius: 100px;
        padding: 8px 20px;
        font-weight: 600;
    }

/* ── Course Card Brand Header ── */

.dw-course-card__brand {
    height: 46px;
    min-height: 46px;
    background: var(--program-theme-main) !important;
    color: #fff;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.dw-course-card__brand-logo {
    width: 100%;
    height: 46px;
    min-height: 46px;
    display: block;
}


/* ============================================================
   NEWSLETTER
   MainColor -> SecondaryColor
   ============================================================ */

.dw-newsletter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    background: linear-gradient( 135deg, var(--program-theme-main) 0%, var(--program-theme-secondary) 100% );
    border-radius: 16px;
    padding: 48px;
    margin-bottom: 30px;
}

.dw-newsletter__text h2 {
    font-size: 2rem;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: -0.32px;
    margin-bottom: 8px;
    line-height: 2.4rem;
}

.dw-newsletter__text p {
    font-size: 1rem;
    color: #ffffff;
    line-height: 1.6rem;
    max-width: 27.8125rem;
}

.dw-newsletter__form {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}


/* ============================================================
   NEWSLETTER INPUT
   ============================================================ */

.dw-nl-input {
    min-height: 44px;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 8px;
    padding: 0 16px;
    font-size: 1rem;
    color: #ffffff;
    outline: none;
    transition: border-color .15s;
}

    .dw-nl-input::placeholder {
        color: rgba(255,255,255,.65);
    }

    .dw-nl-input:focus {
        border-color: rgba(255,255,255,.7);
    }


/* ============================================================
   NEWSLETTER BUTTON
   SecondaryColor
   ============================================================ */

.dw-nl-btn {
    min-height: 44px;
    padding: 0 32px;
    background: var(--program-theme-secondary) !important;
    color: #ffffff !important;
    font-size: 1rem;
    font-weight: 400;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: filter .15s;
}

    .dw-nl-btn:hover {
        background: var(--program-theme-secondary) !important;
        filter: brightness(.92);
    }

    .dw-nl-btn:focus-visible {
        outline: 2px solid rgba(255,255,255,.7);
        outline-offset: 2px;
    }


/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {

    .dw-page {
        padding: 20px;
    }

    .dwx-hero {
        margin-top: -15px;
        padding: 15px 24px;
    }

        .dwx-hero h1 {
            font-size: 2.25rem;
            line-height: 1.2;
            margin: 0 0 9px;
        }

    .dw-search-bar {
        width: 100%;
        max-width: 100%;
        padding: 6px 6px 6px 8px;
    }

    .dw-search-bar__icon {
        padding-inline-start: 4px;
    }

    .dw-search-bar input {
        padding: 0 8px;
        font-size: 0.9375rem;
    }

    .dw-search-btn {
        padding: 0 14px;
        min-height: 36px;
        font-size: 0.875rem;
    }
}

@media (max-width: 640px) {

    .dw-newsletter {
        flex-direction: column;
        align-items: flex-start;
    }

    .dw-newsletter__form {
        width: 100%;
        display: grid !important;
        gap: 15px;
    }

    .dw-nl-input {
        flex: 1;
        width: auto;
    }

    .dw-nl-btn {
        width: 100%;
    }
}

/* Very narrow phones: stack so the button never competes with the field. */
@media (max-width: 380px) {

    .dw-search-bar {
        flex-wrap: wrap;
        height: auto;
        row-gap: 8px;
    }

    .dw-search-bar__icon {
        margin-top: 0;
    }

    .dw-search-bar input {
        flex: 1 1 calc(100% - 36px);
    }

    .dw-search-btn {
        width: 100%;
        height: 40px;
    }
}
