/* ========================================
   TUTORIAL OVERLAY & WALKTHROUGH
   Spotlight tour for first-time teachers
   ======================================== */

/* ---- Overlay ---- */
.tutorial-overlay {
    position: fixed;
    inset: 0;
    z-index: 99998;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.tutorial-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Kill modal animations during tutorials so spotlight positioning is accurate */
body.tutorial-no-animate .modal,
body.tutorial-no-animate .modal-content {
    animation: none !important;
}

/* The dark veil — SVG mask cuts out the spotlight hole */
.tutorial-overlay-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* ---- Spotlight ring glow ---- */
.tutorial-spotlight-ring {
    position: absolute;
    border-radius: 12px;
    pointer-events: none;
    z-index: 99998;
    transition: all 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 0 0 2px rgba(167, 139, 250, 0.6),
        0 0 20px 4px rgba(167, 139, 250, 0.25),
        0 0 40px 8px rgba(167, 139, 250, 0.1);
}

/* Breathing pulse on the spotlight ring */
.tutorial-spotlight-ring::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: inherit;
    border: 2px solid rgba(167, 139, 250, 0.3);
    animation: tutorial-ring-breathe 2s ease-in-out infinite;
}

@keyframes tutorial-ring-breathe {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.015); }
}

/* ---- Popover Card ---- */
.tutorial-popover {
    position: absolute;
    z-index: 99999;
    width: 680px;
    min-height: 400px;
    max-width: calc(100vw - 32px);
    background: rgba(30, 30, 58, 0.92);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border: 1px solid rgba(167, 139, 250, 0.25);
    border-radius: 16px;
    padding: 48px 52px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(167, 139, 250, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    opacity: 0;
    transition: opacity 0.15s ease;
    font-family: 'Nunito Sans', sans-serif;
}

.tutorial-popover.visible {
    opacity: 1;
}

/* Popover arrow */
.tutorial-popover::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    background: rgba(30, 30, 58, 0.92);
    border: 1px solid rgba(167, 139, 250, 0.25);
    transform: rotate(45deg);
    z-index: -1;
}

.tutorial-popover[data-position="bottom"]::before {
    top: -8px;
    left: 50%;
    margin-left: -7px;
    border-right: none;
    border-bottom: none;
}

.tutorial-popover[data-position="top"]::before {
    bottom: -8px;
    left: 50%;
    margin-left: -7px;
    border-left: none;
    border-top: none;
}

.tutorial-popover[data-position="left"]::before {
    right: -8px;
    top: 50%;
    margin-top: -7px;
    border-left: none;
    border-bottom: none;
}

.tutorial-popover[data-position="right"]::before {
    left: -8px;
    top: 50%;
    margin-top: -7px;
    border-right: none;
    border-top: none;
}

/* Center popover (no arrow, no highlighted element) */
.tutorial-popover[data-position="center"] {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.tutorial-popover[data-position="center"].visible {
    transform: translate(-50%, -50%);
}

.tutorial-popover[data-position="center"]::before {
    display: none;
}

/* ---- Popover content ---- */
.tutorial-step-counter {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
}

.tutorial-step-dots {
    display: flex;
    gap: 5px;
}

.tutorial-step-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
}

.tutorial-step-dot.completed {
    background: var(--color-accent-special, #a78bfa);
}

.tutorial-step-dot.current {
    background: var(--color-accent-special, #a78bfa);
    box-shadow: 0 0 8px rgba(167, 139, 250, 0.6);
    transform: scale(1.25);
}

.tutorial-step-number {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.4);
    margin-left: auto;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.tutorial-title {
    font-size: 38px;
    font-weight: 800;
    color: #f0f0f7;
    margin: 0 0 20px 0;
    line-height: 1.25;
}

/* Gradient text matching the Mr Sear MTC logo */
.tutorial-title .tutorial-gradient {
    font-style: italic;
    background: linear-gradient(135deg, var(--color-accent-primary) 0%, var(--color-accent-info) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ---- Close (X) button ---- */
.tutorial-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.4);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
}

.tutorial-close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.8);
}

body.light-mode .tutorial-close {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.3);
}

body.light-mode .tutorial-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: rgba(0, 0, 0, 0.6);
}

.tutorial-text {
    font-size: 24px;
    color: #b8b8d0;
    line-height: 1.6;
    margin: 0;
    flex: 1;
}

/* ---- Navigation buttons ---- */
.tutorial-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: auto;
    padding-top: 24px;
}

.tutorial-btn {
    border: none;
    border-radius: 12px;
    padding: 16px 40px;
    font-family: 'Nunito Sans', sans-serif;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
}

.tutorial-btn:active {
    transform: scale(0.96);
}

.tutorial-btn-next {
    background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
    color: white;
    margin-left: auto;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.tutorial-btn-next:hover {
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.45);
    transform: translateY(-1px);
}

.tutorial-btn-back {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tutorial-btn-back:hover {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.9);
}

.tutorial-btn-skip {
    background: none;
    color: rgba(255, 255, 255, 0.35);
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
}

.tutorial-btn-skip:hover {
    color: rgba(255, 255, 255, 0.6);
}

/* Done button — celebratory green */
.tutorial-btn-done {
    background: linear-gradient(135deg, #4ecb71 0%, #28a745 100%);
    color: white;
    margin-left: auto;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.tutorial-btn-done:hover {
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.45);
    transform: translateY(-1px);
}

/* ---- Light mode overrides ---- */
body.light-mode .tutorial-popover {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(167, 139, 250, 0.3);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.15),
        0 0 30px rgba(167, 139, 250, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

body.light-mode .tutorial-popover::before {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(167, 139, 250, 0.3);
}

body.light-mode .tutorial-title {
    color: #1e293b;
}

body.light-mode .tutorial-text {
    color: #475569;
}

body.light-mode .tutorial-step-number {
    color: rgba(0, 0, 0, 0.35);
}

body.light-mode .tutorial-step-dot {
    background: rgba(0, 0, 0, 0.12);
}

body.light-mode .tutorial-btn-back {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.5);
    border-color: rgba(0, 0, 0, 0.1);
}

body.light-mode .tutorial-btn-back:hover {
    background: rgba(0, 0, 0, 0.08);
    color: rgba(0, 0, 0, 0.7);
}

body.light-mode .tutorial-btn-skip {
    color: rgba(0, 0, 0, 0.3);
}

body.light-mode .tutorial-btn-skip:hover {
    color: rgba(0, 0, 0, 0.5);
}

/* ---- Reduced motion ---- */
body.reduced-motion .tutorial-popover,
body.reduced-motion .tutorial-spotlight-ring,
body.reduced-motion .tutorial-overlay {
    transition-duration: 0.01ms;
}

body.reduced-motion .tutorial-spotlight-ring::after {
    animation: none;
}

/* ---- Tutorials Picker Modal ---- */
.tutorials-modal-content {
    max-width: 500px;
}

.tutorials-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.tutorial-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    background: var(--container-bg);
    border: var(--glass-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tutorial-card:hover {
    border-color: rgba(167, 139, 250, 0.4);
    box-shadow: 0 4px 16px rgba(167, 139, 250, 0.12);
    transform: translateY(-1px);
}

.tutorial-card:active {
    transform: scale(0.98);
}

.tutorial-card-icon {
    font-size: 32px;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.15) 0%, rgba(124, 58, 237, 0.15) 100%);
    border-radius: 10px;
}

.tutorial-card-content {
    flex: 1;
    min-width: 0;
}

.tutorial-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-color-primary);
    margin: 0 0 4px 0;
}

.tutorial-card-desc {
    font-size: 13px;
    color: var(--text-color-secondary);
    margin: 0;
    line-height: 1.4;
}

.tutorial-card-arrow {
    font-size: 18px;
    color: var(--text-color-secondary);
    flex-shrink: 0;
    opacity: 0.4;
    transition: all 0.2s ease;
}

.tutorial-card:hover .tutorial-card-arrow {
    opacity: 0.8;
    transform: translateX(3px);
}

/* ---- Bulk-edit demo seat ---- */

.tutorial-demo-seat {
    z-index: 1;
}

.tutorial-demo-seat .test-level {
    transition: transform 0.2s ease;
}

.tutorial-demo-seat .test-level-btn {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    pointer-events: none;
}

.tutorial-demo-cursor {
    position: absolute;
    bottom: -12px;
    left: calc(50% - 10px);
    z-index: 20;
    pointer-events: none;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
    transition: left 0.6s ease, right 0.6s ease, bottom 0.6s ease;
}

