/* ============================================================
   W3Teach – Custom Site Header
   All classes are prefixed with "sh-" (site-header) to avoid
   collisions with Bootstrap or any other stylesheet.
   ============================================================ */

/* ── Root & base ──────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 6px rgba(0,0,0,0.04);
    z-index: 1000;
    transition: box-shadow 0.2s;
}
.site-header.scrolled {
    box-shadow: 0 2px 18px rgba(124,58,237,0.10);
}

/* ── Inner wrapper ────────────────────────────────────────── */
.sh-inner {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 6px;
}

/* ============================================================
   LOGO
   ============================================================ */
.sh-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
    margin-right: 12px;
    gap: 2px;
}
.sh-logo-badge {
    background: var(--purple);
    color: #fff;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.4;
    letter-spacing: -0.5px;
}
.sh-logo-text {
    color: var(--dark);
    font-size: 17px;
    font-weight: 700;
}

/* ============================================================
   DESKTOP NAV
   ============================================================ */
.sh-nav {
    flex: 1;
}
.sh-nav-list {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 2px;
}
.sh-nav-item {
    position: relative;
}

/* Shared link / button style */
.sh-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 11px;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    text-decoration: none;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 7px;
    white-space: nowrap;
    transition: color 0.15s, background 0.15s;
    line-height: 1;
}
.sh-nav-link:hover,
.sh-nav-item.sh-open > .sh-nav-link {
    color: var(--purple);
    background: var(--purple-08);
}
.sh-nav-icon {
    font-size: 12px;
    color: var(--gray);
    transition: color 0.15s;
}
.sh-nav-link:hover .sh-nav-icon,
.sh-nav-item.sh-open > .sh-nav-link .sh-nav-icon {
    color: var(--purple);
}
.sh-chevron {
    font-size: 10px;
    color: var(--gray);
    transition: transform 0.2s, color 0.15s;
    margin-left: 1px;
}
.sh-nav-item.sh-open > .sh-nav-link .sh-chevron {
    transform: rotate(180deg);
    color: var(--purple);
}

/* ============================================================
   DROPDOWN (shared base)
   ============================================================ */
.sh-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 36px rgba(0,0,0,0.10), 0 0 0 1px rgba(124,58,237,0.04);
    /* hidden by default */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.18s, transform 0.18s, visibility 0s 0.18s;
    pointer-events: none;
    z-index: 500;
}
.sh-nav-item.sh-open > .sh-dropdown,
.sh-user-wrap.sh-open > .sh-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
    transition: opacity 0.18s, transform 0.18s, visibility 0s 0s;
}

/* ── Tutorials mega-dropdown ──────────────────────────────── */
.sh-courses-dropdown {
    min-width: 500px;
    padding: 16px;
}
.sh-dropdown-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.3px;
    color: var(--gray);
    padding: 0 4px 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
}
.sh-courses-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px;
}
.sh-course-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--dark);
    font-size: 13px;
    font-weight: 500;
    transition: background 0.14s, color 0.14s;
}
.sh-course-link:hover {
    background: var(--purple-08);
    color: var(--purple);
}
.sh-course-ico {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.sh-course-name { line-height: 1; }

/* ── User dropdown ────────────────────────────────────────── */
.sh-user-wrap {
    position: relative;
}
.sh-user-dropdown {
    left: auto;
    right: 0;
    min-width: 210px;
    padding: 6px 0;
}
.sh-user-meta {
    padding: 10px 16px 8px;
}
.sh-user-email {
    font-size: 12px;
    color: var(--gray);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
}
.sh-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}
.sh-user-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--dark);
    text-decoration: none;
    transition: background 0.13s, color 0.13s;
}
.sh-user-link i {
    width: 15px;
    text-align: center;
    color: var(--gray);
    font-size: 13px;
}
.sh-user-link:hover {
    background: var(--purple-08);
    color: var(--purple);
}
.sh-user-link:hover i { color: var(--purple); }
.sh-user-link.sh-logout:hover {
    background: rgba(239,68,68,.08);
    color: #ef4444;
}
.sh-user-link.sh-logout:hover i { color: #ef4444; }

/* ============================================================
   HEADER RIGHT SIDE
   ============================================================ */
.sh-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto;
}

/* ── Search ───────────────────────────────────────────────── */
.sh-search {
    position: relative;
    display: flex;
    align-items: center;
}
.sh-search-form {
    display: flex;
    align-items: center;
    position: relative;
}

/* Icon-only button (always visible on desktop) */
.sh-search-icon-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: color 0.14s, border-color 0.14s, background 0.14s;
    flex-shrink: 0;
}
.sh-search-icon-btn:hover,
.sh-search.sh-search-open .sh-search-icon-btn {
    color: var(--purple);
    border-color: rgba(124,58,237,.35);
    background: var(--purple-08);
}

/* Expanding input box */
.sh-search-box {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    overflow: hidden;
    opacity: 0;
    transition: width 0.25s cubic-bezier(.4,0,.2,1), opacity 0.2s;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 9px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
}
.sh-search.sh-search-open .sh-search-box {
    width: 290px;
    opacity: 1;
}
.sh-search-box input {
    flex: 1;
    border: none;
    outline: none;
    padding: 9px 12px;
    font-size: 14px;
    font-family: var(--font);
    background: transparent;
    color: var(--dark);
    min-width: 0;
}
.sh-search-box input::placeholder { color: var(--gray); }
.sh-search-submit {
    width: 34px;
    height: 34px;
    margin: 1px;
    background: var(--purple);
    border: none;
    border-radius: 7px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    transition: background 0.14s;
}
.sh-search-submit:hover { background: var(--purple-dark); }

/* Live results dropdown */
.sh-search-results {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 310px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.10);
    display: none;
    z-index: 600;
    overflow: hidden;
}
.sh-search-results.sh-has-results { display: block; }
.sh-result-item {
    display: flex;
    flex-direction: column;
    padding: 10px 14px;
    text-decoration: none;
    color: var(--dark);
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    transition: background 0.12s;
}
.sh-result-item:last-child { border-bottom: none; }
.sh-result-item:hover { background: var(--purple-08); }
.sh-result-title  { font-weight: 600; }
.sh-result-course { font-size: 11px; color: var(--gray); margin-top: 2px; }

/* ── Admin link ───────────────────────────────────────────── */
.sh-admin-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 12px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
    text-decoration: none;
    background: var(--bg);
    border: 1px solid var(--border);
    white-space: nowrap;
    transition: all 0.14s;
}
.sh-admin-link:hover {
    color: var(--purple);
    border-color: rgba(124,58,237,.35);
    background: var(--purple-08);
}

/* ── User button ──────────────────────────────────────────── */
.sh-user-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 11px 5px 5px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--dark);
    cursor: pointer;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    transition: all 0.14s;
    white-space: nowrap;
}
.sh-user-btn:hover {
    border-color: rgba(124,58,237,.35);
    background: var(--purple-08);
    color: var(--purple);
}
.sh-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(124,58,237,.20);
    flex-shrink: 0;
}
.sh-user-name {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Login / Sign Up ──────────────────────────────────────── */
.sh-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    text-decoration: none;
    transition: color 0.14s, background 0.14s;
    white-space: nowrap;
}
.sh-login-btn:hover {
    color: var(--purple);
    background: var(--purple-08);
}
.sh-signup-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    background: var(--purple);
    box-shadow: 0 2px 10px var(--purple-30);
    transition: background 0.14s, box-shadow 0.14s;
    white-space: nowrap;
}
.sh-signup-btn:hover {
    background: var(--purple-dark);
    color: #fff;
    box-shadow: 0 4px 16px var(--purple-40);
}

/* ============================================================
   HAMBURGER BUTTON
   ============================================================ */
.sh-hamburger {
    display: none;   /* shown only on mobile via media query */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
    margin-left: 8px;
    flex-shrink: 0;
    transition: border-color 0.14s;
}
.sh-hamburger:hover { border-color: rgba(124,58,237,.40); }
.sh-ham-line {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--dark);
    border-radius: 2px;
    transition: transform 0.25s, opacity 0.2s, width 0.2s;
}
/* X state */
.sh-hamburger.sh-active .sh-ham-line:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.sh-hamburger.sh-active .sh-ham-line:nth-child(2) { opacity: 0; width: 0; }
.sh-hamburger.sh-active .sh-ham-line:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   MOBILE SLIDE-DOWN MENU
   ============================================================ */
.sh-mobile-menu {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 28px rgba(0,0,0,0.08);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.32s cubic-bezier(.4,0,.2,1);
    z-index: 999;
}
.sh-mobile-menu.sh-menu-open {
    max-height: 90vh;
    overflow-y: auto;
}
.sh-mobile-inner {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Mobile search */
.sh-mobile-search {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 9px;
    overflow: hidden;
    background: var(--bg);
}
.sh-mobile-search input {
    flex: 1;
    padding: 11px 14px;
    border: none;
    outline: none;
    font-size: 14px;
    font-family: var(--font);
    background: transparent;
    color: var(--dark);
}
.sh-mobile-search button {
    padding: 0 16px;
    background: var(--purple);
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.14s;
}
.sh-mobile-search button:hover { background: var(--purple-dark); }

/* Mobile nav list */
.sh-mobile-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.sh-mobile-item {
    border-bottom: 1px solid var(--border);
}
.sh-mobile-item:last-child { border-bottom: none; }

.sh-mobile-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    text-decoration: none;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s, color 0.12s;
}
.sh-mobile-link:hover {
    background: var(--purple-08);
    color: var(--purple);
}
.sh-mobile-link > span { display: flex; align-items: center; gap: 9px; }
.sh-mobile-link > span i { color: var(--gray); font-size: 13px; }
.sh-mobile-chevron {
    font-size: 11px;
    color: var(--gray);
    transition: transform 0.2s;
    flex-shrink: 0;
}
.sh-mobile-item.sh-sub-open .sh-mobile-chevron { transform: rotate(180deg); }

/* Mobile sub-items */
.sh-mobile-sub {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
    background: var(--bg);
}
.sh-mobile-item.sh-sub-open .sh-mobile-sub { max-height: 800px; }
.sh-mobile-sub-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--dark);
    text-decoration: none;
    border-top: 1px solid var(--border);
    transition: background 0.12s, color 0.12s;
}
.sh-mobile-sub-link:hover {
    background: var(--purple-08);
    color: var(--purple);
}

/* Mobile auth */
.sh-mobile-auth {
    border-top: 1px solid var(--border);
    padding-top: 10px;
}
.sh-mobile-user-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 2px 10px;
}
.sh-mobile-user-row .sh-avatar { width: 38px; height: 38px; }
.sh-mobile-user-name  { font-size: 14px; font-weight: 700; color: var(--dark); }
.sh-mobile-user-email { font-size: 12px; color: var(--gray); }

.sh-mobile-auth-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.sh-mb-btn {
    display: inline-flex;
    align-items: center;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.14s;
}
.sh-mb-outline {
    color: var(--dark);
    border: 1px solid var(--border);
    background: #fff;
}
.sh-mb-outline:hover {
    color: var(--purple);
    border-color: rgba(124,58,237,.35);
    background: var(--purple-08);
}
.sh-mb-logout {
    color: #ef4444;
    border-color: rgba(239,68,68,.25);
}
.sh-mb-logout:hover {
    background: rgba(239,68,68,.08);
    border-color: rgba(239,68,68,.45);
}
.sh-mb-solid {
    background: var(--purple);
    color: #fff;
    border: 1px solid var(--purple);
    box-shadow: 0 2px 8px var(--purple-30);
}
.sh-mb-solid:hover {
    background: var(--purple-dark);
    border-color: var(--purple-dark);
    color: #fff;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 991px) {
    .sh-nav,
    .sh-search,
    .sh-admin-link,
    .sh-login-btn,
    .sh-signup-btn,
    .sh-user-wrap { display: none; }

    .sh-hamburger { display: flex; }
}

@media (max-width: 600px) {
    .sh-inner { padding: 0 14px; }
    .sh-courses-dropdown { min-width: 300px; }
    .sh-courses-grid { grid-template-columns: 1fr; }
}
