/* Student mode. Loaded on every page, but every rule is scoped so logged-out
   visitors keep the marketing site. The header script sets data-tc-mode. */

html[data-tc-mode="student"] nav.navbar:not(.tc-student-nav),
html[data-tc-mode="student"] .announcement-banner,
html[data-tc-mode="student"] .tc-banner,
html[data-tc-mode="student"] footer.footer,
html[data-tc-mode="student"] .tc-footer,
html[data-tc-mode="student"] #tcNotifier,
html[data-tc-mode="student"] #tc-diwali,
html[data-tc-mode="student"] #tc-first-visit-promo,
html[data-tc-mode="student"] .tc-back-student {
    display: none !important;
}

html[data-tc-mode="student"] #tc-header-root {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 0 !important;
    overflow: visible;
    z-index: 1200;
    pointer-events: none;
}

html[data-tc-mode="student"] #tc-header-root > * {
    pointer-events: auto;
}

html.tc-polished[data-tc-mode="student"] .navbar.tc-student-nav,
html[data-tc-mode="student"] .tc-student-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--bg-dark) !important;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 157, 60, 0.18) !important;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

html[data-tc-mode="student"] .tc-student-nav .nav-container {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
    padding: 8px 16px;
    box-sizing: border-box;
}

html[data-tc-mode="student"] .tc-student-nav .logo {
    flex: 0 0 auto;
    background: transparent !important;
    -webkit-text-fill-color: unset;
}

html[data-tc-mode="student"] .tc-student-nav .nav-logo-on-light { display: none !important; }
html[data-tc-mode="student"][data-theme="light"] .tc-student-nav .nav-logo-on-dark { display: none !important; }
html[data-tc-mode="student"][data-theme="light"] .tc-student-nav .nav-logo-on-light { display: inline-block !important; }

html[data-tc-mode="student"] .tc-student-nav .nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-x: auto;
    scrollbar-width: none;
}

html[data-tc-mode="student"] .tc-student-nav .nav-links::-webkit-scrollbar {
    display: none;
}

html[data-tc-mode="student"] .tc-student-nav .nav-links a,
html[data-tc-mode="student"] .tc-student-nav .tc-stu-drop-btn,
html[data-tc-mode="student"] .tc-student-nav .mobile-menu-dropdown a,
html[data-tc-mode="student"] .tc-student-nav .mobile-menu-dropdown summary,
html[data-tc-mode="student"] .tc-student-nav .tc-stu-logout,
html[data-tc-mode="student"] .tc-stu-profile,
html[data-tc-mode="student"] .theme-toggle,
html[data-tc-mode="student"] .tc-student-footer a,
html[data-tc-mode="student"] .tc-student-footer button,
html[data-tc-mode="student"] .tc-continue-learning-link,
.tc-back-student {
    min-height: 44px;
    box-sizing: border-box;
}

html[data-tc-mode="student"] .tc-student-nav .nav-link,
html[data-tc-mode="student"] .tc-student-nav .tc-stu-drop-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 44px;
    padding: 0 10px;
    color: var(--text-secondary);
    background: transparent;
    border: 0;
    border-radius: 10px;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

html[data-tc-mode="student"] .tc-student-nav .nav-link.active,
html[data-tc-mode="student"] .tc-student-nav .tc-stu-drop-btn.active,
html[data-tc-mode="student"] .tc-student-nav .mobile-menu-dropdown a.active {
    color: var(--text-primary);
    background: var(--bg-card);
    box-shadow: inset 0 -2px 0 var(--primary-cyan);
}

html[data-tc-mode="student"] .tc-stu-browse {
    min-height: 44px;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 0.88rem;
    white-space: nowrap;
    text-decoration: none;
}

html[data-tc-mode="student"] .tc-stu-tools {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    flex: 0 0 auto;
}

html[data-tc-mode="student"] .tc-stu-theme {
    position: relative;
}

html[data-tc-mode="student"] .tc-stu-account,
html[data-tc-mode="student"] #navProfileMobile {
    position: relative;
}

html[data-tc-mode="student"] .tc-stu-profile {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    max-width: 220px;
    padding: 4px 10px 4px 6px;
    border-radius: 999px;
    border: 1px solid rgba(255, 157, 60, 0.35);
    background: var(--bg-card);
    color: var(--text-primary);
    font: inherit;
    cursor: pointer;
}

html[data-tc-mode="student"] .tc-stu-profile .tc-nav-name,
html[data-tc-mode="student"] .tc-nav-profile-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.85rem;
    font-weight: 700;
}

html[data-tc-mode="student"] .tc-stu-drop {
    position: relative;
}

html[data-tc-mode="student"] .tc-stu-drop-panel,
html[data-tc-mode="student"] .tc-stu-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 10020;
    min-width: 220px;
    padding: 8px;
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid rgba(255, 157, 60, 0.28);
    box-shadow: var(--shadow-lg);
}

html[data-tc-mode="student"] .tc-stu-drop-panel[hidden],
html[data-tc-mode="student"] .tc-stu-menu[hidden],
html[data-tc-mode="student"] #tcStuTrainerMobile[hidden] {
    display: none !important;
}

html[data-tc-mode="student"] .tc-stu-drop-panel a,
html[data-tc-mode="student"] .tc-stu-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-weight: 700;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

html[data-tc-mode="student"] .tc-stu-menu-logout {
    color: #b91c1c;
}

html[data-tc-mode="student"] .tc-stu-menu-head {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 12px 10px;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(255, 157, 60, 0.18);
}

html[data-tc-mode="student"] .tc-stu-menu-head span {
    color: var(--text-secondary);
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

html[data-tc-mode="student"] .tc-student-nav .mobile-menu-btn {
    display: none;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border: 0;
    background: transparent;
    color: var(--text-primary);
}

html[data-tc-mode="student"] .tc-student-nav .mobile-menu-dropdown {
    display: none;
    background: var(--bg-dark);
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 157, 60, 0.18);
}

html[data-tc-mode="student"] .tc-student-nav .mobile-menu-dropdown ul {
    list-style: none;
    margin: 0;
    padding: 8px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

html[data-tc-mode="student"] .tc-student-nav .mobile-menu-dropdown a,
html[data-tc-mode="student"] .tc-student-nav .mobile-menu-dropdown summary,
html[data-tc-mode="student"] .tc-stu-logout {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 44px;
    padding: 8px 10px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 700;
    background: transparent;
    border: 0;
    font: inherit;
    cursor: pointer;
}

html[data-tc-mode="student"] .tc-stu-details summary {
    cursor: pointer;
}

html[data-tc-mode="student"] .tc-stu-details a {
    padding-left: 18px;
}

html[data-tc-mode="student"] .tc-stu-mobile-account {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 157, 60, 0.18);
}

html[data-tc-mode="student"] .tc-student-footer {
    position: relative;
    z-index: 1;
    margin-top: 32px;
    padding: 20px 16px calc(24px + env(safe-area-inset-bottom, 0px));
    background: var(--bg-darker, var(--bg-dark));
    color: var(--text-secondary);
    border-top: 1px solid rgba(255, 157, 60, 0.18);
    text-align: center;
}

html[data-tc-mode="student"] .tc-stu-foot-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 8px;
    margin-bottom: 8px;
}

html[data-tc-mode="student"] .tc-student-footer a,
html[data-tc-mode="student"] .tc-stu-full-site {
    color: var(--text-primary);
    text-decoration: none;
    padding: 0 8px;
    background: transparent;
    border: 0;
    font: inherit;
    cursor: pointer;
}

html[data-tc-mode="student"] .tc-student-footer a.active {
    text-decoration: underline;
    text-underline-offset: 4px;
}

html[data-tc-mode="student"] .tc-stu-foot-copy {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 8px;
}

html[data-tc-mode="student"] body:has(.tc-header),
html[data-tc-mode="student"] body:has(.iv-app-header),
html[data-tc-mode="student"] body:has(.ip-app-header) {
    padding-top: 64px;
}

html[data-tc-mode="student"] .tc-header,
html[data-tc-mode="student"] .iv-app-header,
html[data-tc-mode="student"] .ip-app-header {
    top: 64px;
}

html[data-tc-mode="student"] .tc-continue-learning {
    position: relative;
    display: block;
    width: 100%;
    margin: 0 0 16px;
    padding: 0;
}

html[data-tc-mode="student"] .tc-continue-learning-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 750;
    border: 1px solid rgba(255, 157, 60, 0.35);
}

.tc-back-student {
    position: fixed;
    top: 76px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1100;
    display: inline-flex;
    align-items: center;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid rgba(255, 157, 60, 0.45);
    background: var(--bg-card, #111);
    color: var(--text-primary, #fff);
    font: inherit;
    font-weight: 750;
    cursor: pointer;
    box-shadow: var(--shadow-card, 0 8px 24px rgba(0, 0, 0, 0.25));
}

@media (max-width: 1280px) {
    html[data-tc-mode="student"] .tc-student-nav .nav-link,
    html[data-tc-mode="student"] .tc-student-nav .tc-stu-drop-btn {
        padding: 0 8px;
        font-size: 0.84rem;
    }
}

@media (max-width: 1024px) {
    html[data-tc-mode="student"] .tc-student-nav .nav-links { display: none !important; }
    html[data-tc-mode="student"] .tc-student-nav .mobile-menu-btn { display: inline-flex !important; }
    html[data-tc-mode="student"] .tc-student-nav .mobile-menu-dropdown:not(.hidden) {
        display: block;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: 100%;
        max-height: calc(100svh - 64px);
        overflow-y: auto;
        box-sizing: border-box;
    }
    html[data-tc-mode="student"] #tcStudentAccount { display: none !important; }
    html[data-tc-mode="student"] #navProfileMobile.tc-show { display: inline-flex; }
    html[data-tc-mode="student"] .tc-stu-browse { width: 100%; justify-content: center; }
}

@media (min-width: 1025px) {
    html[data-tc-mode="student"] #navProfileMobile { display: none !important; }
    html[data-tc-mode="student"] .tc-student-nav .mobile-menu-dropdown { display: none !important; }
}

@media (max-width: 640px) {
    html[data-tc-mode="student"] #tcChatBtn {
        bottom: 16px !important;
        right: 12px !important;
    }
    html[data-tc-mode="student"] .tc-student-footer {
        padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    }
    html[data-tc-mode="student"] .tc-stu-profile .tc-nav-name { display: none; }
    .tc-back-student {
        top: auto;
        bottom: calc(76px + env(safe-area-inset-bottom, 0px));
        max-width: calc(100% - 32px);
    }
}

@media (prefers-reduced-motion: reduce) {
    html[data-tc-mode="student"] .tc-student-nav,
    html[data-tc-mode="student"] .tc-student-nav *,
    html[data-tc-mode="student"] .tc-student-footer,
    html[data-tc-mode="student"] .tc-student-footer *,
    html[data-tc-mode="student"] .tc-continue-learning,
    html[data-tc-mode="student"] .tc-continue-learning *,
    .tc-back-student {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
