/* ══════════════════════════════════════════
   ClickTrainer Test Mode Styles
   ══════════════════════════════════════════ */
.ctt-wrap { display: flex; flex-direction: column; height: calc(100vh - 120px); position: relative; background: #fff; border-radius: 12px; overflow: hidden; }

/* Top bar */
.ctt-topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: #fff; color: #0f172a; flex-shrink: 0; border-bottom: 1px solid #e2e8f0; }
.ctt-topbar-left { display: flex; align-items: center; gap: 12px; }
.ctt-logo-icon { width: 32px; height: 32px; border-radius: 8px; background: #f97316; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ctt-topbar-info { display: flex; flex-direction: column; }
.ctt-topbar-title { font-size: 15px; font-weight: 700; color: #0f172a; }
.ctt-topbar-mode { font-size: 12px; color: #ef4444; font-weight: 600; }
.ctt-topbar-right { display: flex; align-items: center; gap: 16px; font-size: 13px; color: #64748b; }
.ctt-topbar-counter { font-weight: 600; }
.ctt-topbar-progress { width: 120px; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.ctt-topbar-progress-fill { height: 100%; background: #3b82f6; border-radius: 3px; transition: width 0.4s ease; }

/* Main split */
.ctt-body { display: flex; flex: 1; overflow: hidden; }

/* Left: screenshot area */
.ctt-screen { flex: 1; background: #0f172a; overflow: hidden; position: relative; padding: 0; }
.ctt-screen-wrap { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; cursor: crosshair; }
.ctt-screen-img { max-width: 100%; max-height: 100%; object-fit: contain; pointer-events: none; }

/* Click markers */
.ctt-marker { position: absolute; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transform: translate(-50%, -50%); z-index: 10; animation: ctt-marker-pop 0.3s ease; }
.ctt-marker-correct { background: #22c55e; box-shadow: 0 2px 8px rgba(34,197,94,0.5); }
.ctt-marker-wrong { background: #ef4444; box-shadow: 0 2px 8px rgba(239,68,68,0.5); }
@keyframes ctt-marker-pop { from { transform: translate(-50%,-50%) scale(0); } to { transform: translate(-50%,-50%) scale(1); } }

/* Feedback toast */
.ctt-feedback { position: absolute; top: 12px; right: 12px; padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; color: #fff; display: flex; align-items: center; gap: 8px; z-index: 20; opacity: 0; transform: translateY(-8px); transition: opacity 0.3s, transform 0.3s; pointer-events: none; }
.ctt-feedback.visible { opacity: 1; transform: translateY(0); }
.ctt-feedback-correct { background: #22c55e; }
.ctt-feedback-wrong { background: #ef4444; }

/* Right: steps sidebar */
.ctt-sidebar { width: 280px; background: #fff; border-left: 1px solid #e2e8f0; display: flex; flex-direction: column; flex-shrink: 0; position: relative; }

.ctt-steps-header { font-size: 15px; font-weight: 700; color: #0f172a; padding: 16px 20px 8px; }

.ctt-steps-list { flex: 1; overflow-y: auto; padding: 0 12px 20px; }
.ctt-step-item { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; border-radius: 8px; margin-bottom: 2px; position: relative; }
.ctt-step-item.active { background: #eff6ff; border: 1px solid #bfdbfe; }
.ctt-step-num { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; background: #f1f5f9; color: #64748b; }
.ctt-step-item.active .ctt-step-num { background: #3b82f6; color: #fff; }
.ctt-step-item.done.pass .ctt-step-num { background: #22c55e; color: #fff; }
.ctt-step-item.done.fail .ctt-step-num { background: #ef4444; color: #fff; }
.ctt-step-text { font-size: 13px; color: #94a3b8; line-height: 1.4; padding-top: 3px; }
.ctt-step-item.active .ctt-step-text { color: #0f172a; font-weight: 600; }
.ctt-step-item.done .ctt-step-text { color: #475569; }

/* Blurred steps (not yet reached) */
.ctt-step-text.blurred { filter: blur(4px); user-select: none; }

/* Scroll indicator */
.ctt-scroll-indicator { position: absolute; bottom: 16px; right: 16px; width: 40px; height: 40px; border-radius: 50%; background: #6366f1; color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 4px 12px rgba(99,102,241,0.4); z-index: 10; }
.ctt-scroll-indicator:hover { background: #4f46e5; }

/* Test completion modal */
.ctt-modal-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); z-index: 100; display: flex; align-items: center; justify-content: center; }
.ctt-modal { text-align: center; width: 440px; background: #fff; border-radius: 16px; padding: 36px 32px; box-shadow: 0 12px 40px rgba(0,0,0,0.2); }
.ctt-modal-check { margin-bottom: 12px; }
.ctt-modal-title { font-size: 20px; font-weight: 700; color: #0f172a; margin-bottom: 6px; }
.ctt-modal-score { font-size: 48px; font-weight: 800; color: #22c55e; line-height: 1.1; }
.ctt-modal-score-label { font-size: 13px; color: #94a3b8; margin-bottom: 20px; }
.ctt-modal-table { text-align: left; margin-bottom: 16px; }
.ctt-modal-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; color: #475569; border-bottom: 1px solid #f1f5f9; }
.ctt-modal-row:last-child { border-bottom: none; }
.ctt-modal-val { font-weight: 700; }
.ctt-modal-val.green { color: #22c55e; }
.ctt-modal-val.red { color: #ef4444; }
.ctt-modal-progress-wrap { margin-bottom: 16px; }
.ctt-modal-progress-bar { height: 10px; background: #e2e8f0; border-radius: 5px; overflow: hidden; margin-bottom: 6px; }
.ctt-modal-progress-fill { height: 100%; background: linear-gradient(90deg, #22c55e, #16a34a); border-radius: 5px; transition: width 0.5s ease; }
.ctt-modal-grade { font-size: 12px; color: #64748b; font-weight: 600; }
.ctt-modal-msg { font-size: 13px; color: #64748b; margin-bottom: 20px; line-height: 1.5; }
.ctt-modal-actions { display: flex; flex-direction: column; gap: 8px; }
.ctt-modal-btn { display: block; width: 100%; padding: 12px; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit; border: none; }
.ctt-modal-btn-primary { background: #3b82f6; color: #fff; }
.ctt-modal-btn-primary:hover { background: #2563eb; }
.ctt-modal-btn-secondary { background: #fff; color: #475569; border: 1px solid #e2e8f0; }
.ctt-modal-btn-secondary:hover { background: #f8fafc; }

/* ── Editor Mode ── */
.ctt-editor-bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; background: #fef3c7; border-bottom: 2px solid #f59e0b; flex-shrink: 0; gap: 12px; flex-wrap: wrap; }
.ctt-editor-bar-left { display: flex; align-items: center; gap: 10px; }
.ctt-editor-bar-right { display: flex; align-items: center; gap: 6px; }
.ctt-editor-badge { background: #f59e0b; color: #fff; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 4px; text-transform: uppercase; }
.ctt-editor-info { font-size: 12px; color: #92400e; font-weight: 500; }
.ctt-editor-btn { background: #fff; border: 1px solid #e2e8f0; color: #475569; padding: 5px 12px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; }
.ctt-editor-btn:hover { background: #f8fafc; }
.ctt-editor-btn-save { background: #22c55e; color: #fff; border-color: #22c55e; }
.ctt-editor-btn-save:hover { background: #16a34a; }
.ctt-editor-btn-close { background: #ef4444; color: #fff; border-color: #ef4444; }
.ctt-editor-btn-close:hover { background: #dc2626; }

.ctt-editor-zone { position: absolute; border: 3px dashed #22c55e; background: rgba(34,197,94,0.15); pointer-events: none; z-index: 15; border-radius: 4px; }
.ctt-editor-drawing { position: absolute; border: 2px solid #3b82f6; background: rgba(59,130,246,0.2); pointer-events: none; z-index: 16; border-radius: 3px; }

@media (max-width: 576px) and (orientation: portrait) {
    .ctt-sidebar { width: 240px; }
    .ctt-body { flex-direction: column; }
    .ctt-sidebar { width: 100%; border-left: none; border-top: 1px solid #e2e8f0; max-height: 200px; }
}

@media (max-width: 576px) and (orientation: portrait) {
    .ctt-wrap { height: calc(100vh - 100px); }
    .ctt-topbar { padding: 10px 12px; }
    .ctt-topbar-title { font-size: 13px; }
    .ctt-topbar-mode { font-size: 11px; }
    .ctt-topbar-progress { width: 80px; }
    .ctt-body { flex-direction: column; }
    .ctt-screen { min-height: 200px; }
    .ctt-sidebar { width: 100%; border-left: none; border-top: 1px solid #e2e8f0; max-height: 180px; overflow-y: auto; }
    .ctt-steps-header { font-size: 13px; padding: 10px 14px 4px; }
    .ctt-step-item { padding: 6px 8px; }
    .ctt-step-num { width: 24px; height: 24px; font-size: 11px; }
    .ctt-step-text { font-size: 12px; }
    .ctt-scroll-indicator { width: 32px; height: 32px; bottom: 10px; right: 10px; }
    .ctt-modal { width: 90vw; max-width: 360px; padding: 28px 20px; }
    .ctt-modal-title { font-size: 18px; }
    .ctt-modal-score { font-size: 36px; }
    .ctt-feedback { font-size: 12px; padding: 6px 12px; top: 8px; right: 8px; }
    .ctt-editor-bar { flex-direction: column; padding: 6px 10px; gap: 6px; }
    .ctt-editor-bar-right { flex-wrap: wrap; }
}
