
/* =========================================================
   TRAINO CORP — COURSES MEGA MENU
   Matches courses_mega_menu.php
   ========================================================= */

:root {
    --mega-blue: #094191;
    --mega-blue-dark: #073474;
    --mega-yellow: #f9a925;
    --mega-text: #263548;
    --mega-muted: #718096;
    --mega-border: #e2e8f0;
    --mega-light: #f5f8fc;
    --mega-white: #ffffff;
    --mega-shadow: 0 18px 50px rgba(15, 35, 65, 0.18);
}

/* =========================================================
   HEADER / WRAPPER
   ========================================================= */

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
}

.site-header .container {
    position: relative;
}

.mega-menu-wrapper {
    position: static;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* =========================================================
   COURSES TRIGGER
   ========================================================= */

.mega-menu-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;

    min-height: 42px;
    padding: 10px 16px;

    border: 1px solid var(--mega-blue);
    border-radius: 6px;

    background: var(--mega-blue);
    color: var(--mega-white);

    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;

    white-space: nowrap;
    cursor: pointer;

    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.mega-menu-trigger:hover,
.mega-menu-trigger[aria-expanded="true"] {
    background: var(--mega-blue-dark);
    border-color: var(--mega-blue-dark);
    color: var(--mega-white);
}

.mega-menu-trigger[aria-expanded="true"] {
    box-shadow: 0 3px 10px rgba(9, 65, 145, 0.18);
}

.mega-menu-arrow {
    display: inline-block;
    font-size: 13px;
    line-height: 1;
    transition: transform 0.2s ease;
}

.mega-menu-trigger[aria-expanded="true"] .mega-menu-arrow {
    transform: rotate(180deg);
}

.mega-menu-trigger:focus-visible,
.mega-menu-category:focus-visible,
.mega-menu-course:focus-visible,
.mega-menu-search input:focus-visible {
    outline: 3px solid rgba(249, 169, 37, 0.7);
    outline-offset: 3px;
}

/* =========================================================
   MENU PANEL — DESKTOP
   ========================================================= */

.courses-mega-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    z-index: 1100;

    width: min(1160px, calc(100vw - 40px));
    height: min(640px, calc(100vh - 110px));

    transform: translateX(-50%);

    display: grid;
    grid-template-columns: 235px minmax(0, 1fr);

    background: var(--mega-white);
    border: 1px solid var(--mega-border);
    border-radius: 12px;
    box-shadow: var(--mega-shadow);

    overflow: hidden;
    text-align: left;
}

.courses-mega-menu[hidden] {
    display: none !important;
}

/* =========================================================
   LEFT CATEGORY SIDEBAR
   ========================================================= */

.mega-menu-sidebar {
    min-width: 0;
    min-height: 0;

    padding: 22px 0;

    background: #f4f7fb;
    border-right: 1px solid var(--mega-border);

    overflow-y: auto;
    overflow-x: hidden;
}

.mega-menu-sidebar-title {
    margin: 0 0 14px;
    padding: 0 20px;

    color: #778397;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.mega-menu-category {
    width: 100%;
    min-height: 44px;

    display: flex;
    align-items: center;

    padding: 11px 18px;

    border: 0;
    border-left: 3px solid transparent;

    background: transparent;
    color: #405066;

    font: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    text-align: left;

    cursor: pointer;

    transition:
        background-color 0.18s ease,
        color 0.18s ease,
        border-color 0.18s ease;
}

.mega-menu-category:hover {
    background: #ffffff;
    color: var(--mega-blue);
}

.mega-menu-category.active {
    background: #ffffff;
    color: var(--mega-blue);
    border-left-color: var(--mega-yellow);
    font-weight: 700;
}

/* =========================================================
   RIGHT CONTENT
   ========================================================= */

.mega-menu-content {
    min-width: 0;
    min-height: 0;

    display: flex;
    flex-direction: column;

    padding: 24px 26px 18px;

    overflow: hidden;
}

/* =========================================================
   CONTENT HEADER
   ========================================================= */

.mega-menu-content-header {
    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    margin-bottom: 18px;
}

.mega-menu-content-header h2 {
    margin: 0 0 5px;

    color: #172b45;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
}

.mega-menu-content-header p {
    margin: 0;

    color: var(--mega-muted);
    font-size: 12px;
    line-height: 1.5;
}

/* =========================================================
   SEARCH
   ========================================================= */

.mega-menu-search {
    flex: 0 1 280px;
    min-width: 180px;
}

.mega-menu-search input {
    width: 100%;
    height: 42px;

    padding: 0 13px;

    border: 1px solid #d8e1eb;
    border-radius: 6px;

    background: #f8fafc;
    color: var(--mega-text);

    font: inherit;
    font-size: 13px;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease;
}

.mega-menu-search input::placeholder {
    color: #8a96a6;
}

.mega-menu-search input:focus {
    outline: none;
    border-color: var(--mega-blue);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(9, 65, 145, 0.08);
}

/* =========================================================
   COURSE GRID
   ========================================================= */

.mega-menu-courses {
    flex: 1;
    min-height: 0;
    min-width: 0;

    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-content: start;

    gap: 13px;

    padding: 2px 4px 5px 1px;

    overflow-y: auto;
    overflow-x: hidden;
}

/* =========================================================
   COURSE CARD
   ========================================================= */

.mega-menu-course {
    min-width: 0;
    min-height: 175px;

    display: flex;
    flex-direction: column;
    align-items: stretch;

    padding: 15px !important;

    border: 1px solid #e3e9f0;
    border-radius: 8px;

    background: #ffffff;
    color: var(--mega-text);
    text-decoration: none;

    box-shadow: 0 2px 7px rgba(20, 40, 65, 0.035);

    transition:
        transform 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}

.mega-menu-course:hover {
    transform: translateY(-2px);
    border-color: #b8cce3;
    box-shadow: 0 7px 18px rgba(20, 40, 65, 0.09);
    color: var(--mega-text);
}

.mega-menu-course[hidden] {
    display: none !important;
}

/* =========================================================
   CARD TOP — PROVIDER / BADGE
   ========================================================= */

.mega-menu-course-top {
    min-width: 0;
    min-height: 34px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;

    margin-bottom: 12px;
}

.mega-menu-provider-logo {
    display: block;

    max-width: 110px;
    max-height: 30px;

    width: auto;
    height: auto;

    object-fit: contain;
    object-position: left center;
}

.mega-menu-provider {
    min-width: 0;

    color: #596b80;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
}

.mega-menu-badge {
    flex-shrink: 0;

    padding: 4px 7px;

    border-radius: 4px;
    background: #fff2d8;
    color: #815200;

    font-size: 9px;
    font-weight: 700;
    line-height: 1.3;
    text-transform: uppercase;
}

/* =========================================================
   COURSE TITLE / DESCRIPTION
   ========================================================= */

.mega-menu-course-title {
    margin: 0 0 9px;

    color: #20334b;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.45;

    overflow-wrap: anywhere;
}

.mega-menu-course:hover .mega-menu-course-title {
    color: var(--mega-blue);
}

.mega-menu-course-description {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;

    margin: 0 0 10px;

    overflow: hidden;

    color: #718096;
    font-size: 11px;
    line-height: 1.55;
}

/* =========================================================
   COURSE DURATION
   ========================================================= */

.mega-menu-course-duration {
    display: block;
    margin-top: auto;
    padding-top: 9px;

    color: #6b7a8e;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
}

/* =========================================================
   NO RESULTS
   ========================================================= */

.mega-menu-no-results {
    flex: 1;
    min-height: 140px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin: 0;
    padding: 24px;

    color: var(--mega-muted);
    font-size: 14px;
    text-align: center;
}

.mega-menu-no-results[hidden] {
    display: none !important;
}

/* =========================================================
   FOOTER
   ========================================================= */

.mega-menu-footer {
    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: flex-end;

    margin-top: 13px;
    padding-top: 13px;

    border-top: 1px solid #e8edf2;
}

.mega-menu-footer a {
    display: inline-flex;
    align-items: center;
    gap: 6px;

    color: var(--mega-blue);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;

    transition: color 0.18s ease;
}

.mega-menu-footer a:hover {
    color: #b87500;
}

/* =========================================================
   SCROLLBARS
   ========================================================= */

.mega-menu-sidebar,
.mega-menu-courses {
    scrollbar-width: thin;
    scrollbar-color: #c4cfdb transparent;
}

.mega-menu-sidebar::-webkit-scrollbar,
.mega-menu-courses::-webkit-scrollbar {
    width: 6px;
}

.mega-menu-sidebar::-webkit-scrollbar-track,
.mega-menu-courses::-webkit-scrollbar-track {
    background: transparent;
}

.mega-menu-sidebar::-webkit-scrollbar-thumb,
.mega-menu-courses::-webkit-scrollbar-thumb {
    background: #c4cfdb;
    border-radius: 10px;
}

/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 1100px) {
    .courses-mega-menu {
        width: calc(100vw - 30px);
        grid-template-columns: 205px minmax(0, 1fr);
    }

    .mega-menu-content {
        padding: 20px;
    }

    .mega-menu-courses {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mega-menu-content-header h2 {
        font-size: 20px;
    }
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 768px) {
    .mega-menu-wrapper {
        position: static;
    }

    .mega-menu-trigger {
        min-height: 40px;
        padding: 9px 12px;
        font-size: 14px;
    }

    .courses-mega-menu {
        position: fixed;

        top: var(--site-header-height, 80px);
        left: 10px;
        right: 10px;

        width: auto;
        height: calc(100dvh - var(--site-header-height, 80px) - 12px);
        max-height: none;

        transform: none;

        display: flex;
        flex-direction: column;

        border-radius: 10px;
    }

    .courses-mega-menu[hidden] {
        display: none !important;
    }

    .mega-menu-sidebar {
        flex: 0 0 auto;

        display: flex;
        align-items: center;
        gap: 7px;

        max-height: 60px;
        padding: 9px 10px;

        border-right: 0;
        border-bottom: 1px solid var(--mega-border);

        overflow-x: auto;
        overflow-y: hidden;
    }

    .mega-menu-sidebar-title {
        display: none;
    }

    .mega-menu-category {
        flex: 0 0 auto;
        width: auto;
        min-height: 34px;

        padding: 7px 11px;

        border: 1px solid #dce4ed;
        border-radius: 5px;

        background: #ffffff;

        font-size: 12px;
        white-space: nowrap;
    }

    .mega-menu-category.active {
        border-color: var(--mega-blue);
        background: var(--mega-blue);
        color: #ffffff;
    }

    .mega-menu-content {
        flex: 1;
        min-height: 0;
        padding: 15px;
    }

    .mega-menu-content-header {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;

        margin-bottom: 13px;
    }

    .mega-menu-content-header h2 {
        font-size: 19px;
    }

    .mega-menu-search {
        flex: 0 0 auto;
        width: 100%;
        min-width: 0;
    }

    .mega-menu-search input {
        height: 40px;
    }

    .mega-menu-courses {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .mega-menu-course {
        min-height: 160px;
        padding: 12px;
    }

    .mega-menu-course-title {
        font-size: 13px;
    }

    .mega-menu-footer {
        margin-top: 10px;
        padding-top: 10px;
    }
}

/* =========================================================
   SMALL MOBILE
   ========================================================= */

@media (max-width: 480px) {
    .courses-mega-menu {
        left: 5px;
        right: 5px;

        height: calc(100dvh - var(--site-header-height, 80px) - 8px);
    }

    .mega-menu-content {
        padding: 12px;
    }

    .mega-menu-courses {
        grid-template-columns: 1fr;
        gap: 9px;
    }

    .mega-menu-course {
        min-height: 0;
        padding: 13px;
    }

    .mega-menu-course-top {
        margin-bottom: 8px;
    }

    .mega-menu-course-title {
        margin-bottom: 6px;
    }

    .mega-menu-course-description {
        margin-bottom: 6px;
    }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    .mega-menu-trigger,
    .mega-menu-arrow,
    .mega-menu-category,
    .mega-menu-course,
    .mega-menu-search input {
        transition: none;
    }
}