/* --- Header Layout --- */
.mt-custom-header {
    background: #020612; /* Deep dark space blue/black mix */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem 0.75rem 0; /* No left padding to push logo flush left */
    font-family: var(--font-primary);
    position: relative;
    z-index: 9999;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    box-sizing: border-box;
}

/* --- Left Aligned Brand Group (Logo + Courses) --- */
.mt-brand-group {
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

/* --- Logo Configuration --- */
.mt-logo-area a {
    display: flex;
    align-items: center;
}
.mt-logo-area img {
    height: 65px;
    width: auto;
    display: block;
    margin-left: -15px; /* Pull the image left to offset transparent padding inside the PNG */
}

/* --- Core Navigation Menu --- */
.mt-nav-container {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.mt-main-menu {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
    align-items: center;
    gap: 2rem;
}

.mt-menu-item {
    position: relative;
}

.mt-menu-link {
    color: var(--color-text);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.05rem;
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.3s ease;
}

/* Primary Links Hover Highlight with Theme Orange */
.mt-menu-link:hover {
    color: var(--color-primary);
}

/* Active/Hover Underline Glow effect matching brand orange theme */
.mt-menu-item > .mt-menu-link::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--color-primary);
    transition: width 0.3s ease;
}
.mt-menu-item:hover > .mt-menu-link::after,
.mt-menu-item.active > .mt-menu-link::after {
    width: 100%;
}

/* --- Action Buttons ("Courses" & "Student Login") --- */
.mt-btn-style {
    background-color: var(--color-primary);
    color: var(--color-text) !important;
    padding: 0.7rem 1.6rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    border: none;
    border-bottom: 3px solid transparent;
    box-sizing: border-box;
}

.mt-btn-style:hover {
    background-color: #e03b30;
    border-bottom: 3px solid var(--color-secondary);
}

/* --- Multi-Level Dropdowns System --- */
/* Level 1 Dropdown Menu Container */
.mt-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #040a17;
    border: 1px solid rgba(255, 255, 255, 0.08);
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
    min-width: 270px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    opacity: 0;
    visibility: hidden;
    transform: translateY(5px); 
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
    border-radius: 6px;
}

/* Level 2 Sub-tier Dropdowns */
.mt-dropdown-menu .mt-dropdown-menu {
    top: 0;
    left: 100%;
    transform: translateX(10px);
    margin-top: 0;
}

/* Hover Display & Progression Rules */
.mt-brand-group-item:hover > .mt-dropdown-menu,
.mt-menu-item:hover > .mt-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.mt-dropdown-item:hover > .mt-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Dropdown Interactive Links */
.mt-dropdown-link {
    color: var(--color-subtle);
    padding: 0.75rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease;
}

/* Changes internal item texts directly into Orange on hover */
.mt-dropdown-link:hover {
    background-color: rgba(255, 74, 63, 0.08);
    color: var(--color-primary);
}
.mt-dropdown-link i {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.3);
    transition: color 0.2s ease;
}
.mt-dropdown-link:hover i {
    color: var(--color-primary);
}

/* --- Mobile Responsive Rules --- */
.mt-mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--color-text);
    font-size: 1.6rem;
    cursor: pointer;
}

@media (max-width: 1120px) {
    .mt-custom-header {
        padding: 0.75rem 0.5rem 0.75rem 0;
    }
    .mt-logo-area img {
        margin-left: -10px; /* Slight negative margin for mobile */
    }
    .mt-mobile-toggle {
        display: block;
    }
    .mt-brand-group {
        gap: 1rem;
    }
    .mt-brand-group .mt-brand-group-item {
        display: none;
    }
    .mt-nav-container {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: #020612;
        flex-direction: column;
        align-items: stretch;
        padding: var(--spacing-md);
        gap: var(--spacing-md);
        display: none;
        box-sizing: border-box;
        border-bottom: 3px solid var(--color-primary);
        max-height: 80vh;
        overflow-y: auto;
    }
    .mt-nav-container.active {
        display: flex;
    }
    .mt-nav-container .mt-mobile-courses-fallback {
        display: block !important;
    }
    .mt-main-menu {
        flex-direction: column;
        align-items: stretch;
        gap: 1.2rem;
    }
    .mt-menu-link {
        padding: 0.5rem 0;
    }
    .mt-menu-link i,
    .mt-dropdown-link i {
        font-size: 1.2rem !important;
        color: var(--color-primary) !important;
        background: rgba(255, 74, 63, 0.12);
        padding: 8px 14px;
        border-radius: 6px;
        margin-left: auto;
        transition: background 0.2s ease, transform 0.2s ease;
    }
    .mt-menu-link i:active,
    .mt-dropdown-link i:active {
        background: rgba(255, 74, 63, 0.25);
        transform: scale(0.95);
    }
    .mt-menu-item > .mt-menu-link::after {
        display: none;
    }
    .mt-dropdown-menu, .mt-dropdown-menu .mt-dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: rgba(255,255,255,0.02);
        margin-top: 0.5rem;
        padding-left: 1rem;
        display: none;
        border: none;
    }
    .mt-brand-group-item.open-mobile > .mt-dropdown-menu,
    .mt-menu-item.open-mobile > .mt-dropdown-menu,
    .mt-dropdown-item.open-mobile > .mt-dropdown-menu {
        display: block;
    }
    
    /* Animate chevron rotation when open */
    .mt-dropdown-item.open-mobile > a i.fa-chevron-right {
        transform: rotate(90deg);
    }
    .mt-brand-group-item.open-mobile > a i.fa-chevron-down,
    .mt-menu-item.open-mobile > a i.fa-chevron-down {
        transform: rotate(180deg);
    }
}