/*!
 * Teaching Mode — Web Foundations Course
 * Visual styles for the presentation/distraction-free layer.
 */

/* ─────────────────────────────────────────────────────
   Toggle button (inside .fixed-controls)
───────────────────────────────────────────────────── */
.tm-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 2px solid var(--border-color, rgba(255,255,255,0.1));
    border-radius: 50%;
    background: var(--bg-card, rgba(26,26,26,0.8));
    color: var(--text-secondary, #b0b0b0);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.15s, border-color 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow-md, 0 4px 16px rgba(0,0,0,0.4));
}

.tm-toggle-btn:hover {
    background: var(--accent-primary, #6366f1);
    color: #fff;
    border-color: var(--accent-primary, #6366f1);
    transform: scale(1.08);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.tm-toggle-btn--active {
    background: var(--accent-primary, #6366f1);
    color: #fff;
    border-color: var(--accent-primary, #6366f1);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

/* Light-theme overrides for toggle button */
[data-theme="light"] .tm-toggle-btn {
    background: var(--bg-card, rgba(255,255,255,0.9));
    color: var(--text-secondary, #4a4a4a);
    border-color: var(--border-color, rgba(0,0,0,0.08));
    box-shadow: var(--shadow-md, 0 4px 16px rgba(0,0,0,0.08));
}

[data-theme="light"] .tm-toggle-btn:hover {
    background: var(--accent-primary, #6366f1);
    color: #fff;
    border-color: var(--accent-primary, #6366f1);
}

[data-theme="light"] .tm-toggle-btn--active {
    background: var(--accent-primary, #6366f1);
    color: #fff;
    border-color: var(--accent-primary, #6366f1);
}

/* ─────────────────────────────────────────────────────
   Teaching toolbar (fixed at top)
───────────────────────────────────────────────────── */
.teaching-toolbar {
    position: fixed;
    top: -56px;          /* hidden by default */
    left: 0;
    right: 0;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    background: var(--bg-secondary, #1e1e1e);
    border-bottom: 1px solid var(--border-color, #333);
    z-index: 10010;
    transition: top 0.35s cubic-bezier(.4, 0, .2, 1);
    font-family: var(--font-sans, system-ui, sans-serif);
}

[data-teaching="true"] .teaching-toolbar {
    top: 0;
}

/* Navigation buttons */
.tm-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-primary, #fff);
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}

.tm-nav-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, .08);
}

[data-theme="light"] .tm-nav-btn:hover:not(:disabled) {
    background: rgba(0, 0, 0, .06);
}

.tm-nav-btn:disabled {
    opacity: .25;
    cursor: default;
}

/* Center info */
.tm-center {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    white-space: nowrap;
}

.tm-module-name {
    font-weight: 700;
    font-size: .85rem;
    color: var(--accent-primary, #646cff);
}

.tm-sep {
    opacity: .35;
    font-size: .9rem;
}

.tm-title {
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-primary, #fff);
    overflow: hidden;
    text-overflow: ellipsis;
}

.tm-counter {
    font-size: .75rem;
    opacity: .5;
    margin-left: auto;
    flex-shrink: 0;
}

/* Zoom group */
.tm-zoom-group {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
}

.tm-zoom-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-color, #444);
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary, #fff);
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.15s;
}

.tm-zoom-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, .08);
}

[data-theme="light"] .tm-zoom-btn:hover:not(:disabled) {
    background: rgba(0, 0, 0, .06);
}

.tm-zoom-btn:disabled {
    opacity: .3;
    cursor: default;
}

.tm-zoom-level {
    font-size: .72rem;
    opacity: .55;
    min-width: 36px;
    text-align: center;
}

/* Exit button */
.tm-exit-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, .12));
    border-radius: 8px;
    background: transparent;
    color: var(--text-primary, #fff);
    font-size: .8rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    margin-left: 6px;
}

.tm-exit-btn:hover {
    background: rgba(255, 100, 100, .12);
    border-color: rgba(255, 100, 100, .35);
}

/* ─────────────────────────────────────────────────────
   Active state — hide chrome, adjust layout
───────────────────────────────────────────────────── */
[data-teaching="true"] .navbar,
[data-teaching="true"] .module-sidebar,
[data-teaching="true"] .sidebar-mobile-toggle,
[data-teaching="true"] .sidebar-backdrop,
[data-teaching="true"] .fixed-controls,
[data-teaching="true"] .section-indicator,
[data-teaching="true"] .module-header-bar,
[data-teaching="true"] .reading-progress {
    display: none !important;
}

/* Centre the main content and add top padding for toolbar */
[data-teaching="true"] .module-main {
    margin: 0 auto !important;
    padding-top: calc(56px + 1.5rem) !important;
    max-width: 920px;
}

/* Centre the header in teaching mode */
[data-teaching="true"] .module-header-bar {
    margin-top: 56px;
    text-align: center;
}

[data-teaching="true"] .module-layout {
    display: block !important;
}

/* ─────────────────────────────────────────────────────
   Section focus / dim
───────────────────────────────────────────────────── */
section[data-tm-focus="active"] {
    opacity: 1;
    transition: opacity 0.35s ease;
}

section[data-tm-focus="dim"] {
    opacity: 0.22;
    transition: opacity 0.35s ease;
    cursor: pointer;
}

section[data-tm-focus="dim"]:hover {
    opacity: 0.45;
}

/* ─────────────────────────────────────────────────────
   Keyboard hint toast
───────────────────────────────────────────────────── */
.tm-keyboard-hint {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, .82);
    color: #fff;
    padding: 10px 22px;
    border-radius: 10px;
    font-size: .82rem;
    letter-spacing: .02em;
    z-index: 10020;
    animation: tmHintFade 4s ease forwards;
    pointer-events: none;
}

@keyframes tmHintFade {
    0%   { opacity: 0; transform: translateX(-50%) translateY(12px); }
    10%  { opacity: 1; transform: translateX(-50%) translateY(0); }
    80%  { opacity: 1; }
    100% { opacity: 0; }
}

/* ─────────────────────────────────────────────────────
   Responsive — small screens
───────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .teaching-toolbar {
        padding: 0 8px;
        gap: 4px;
    }

    .tm-module-name,
    .tm-sep {
        display: none;
    }

    .tm-title {
        font-size: .78rem;
    }

    .tm-zoom-group {
        display: none;
    }

    .tm-exit-btn span {
        display: none;
    }
}
