@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
    /* High-contrast solid light theme tokens */
    --bg-main: hsl(210, 24%, 96%);             /* Soft light grey-blue backdrop */
    --bg-sidebar: hsl(210, 20%, 92%);          /* Defined neutral borders & headers */
    --bg-card: hsl(0, 0%, 100%);               /* Solid, clean white for all panels */
    --bg-card-hover: hsl(210, 20%, 98%);
    --bg-active-light: hsl(196, 100%, 96%);    /* High-contrast active highlight */
    
    --border-color: hsl(214, 16%, 85%);        /* Strong, visible slate borders */
    --border-glow: hsl(196, 100%, 40%);
    
    --text-primary: hsl(220, 25%, 12%);         /* Deep, highly legible charcoal slate */
    --text-secondary: hsl(215, 18%, 28%);       /* High-contrast muted text */
    --text-muted: hsl(217, 10%, 45%);           /* Standard grey */
    
    --color-accent: hsl(196, 100%, 35%);        /* Electric Cyan */
    --color-purple: hsl(267, 85%, 45%);         /* Deep Royal Purple */
    --color-success: hsl(145, 80%, 28%);        /* Slate Green */
    --color-warning: hsl(34, 95%, 35%);         /* Deep Gold Amber */
    --color-danger: hsl(355, 85%, 42%);         /* High-contrast Alert Red */
    
    --shadow-premium: 0 4px 20px -2px rgba(8, 12, 26, 0.08), 0 2px 6px -1px rgba(8, 12, 26, 0.04);
    --shadow-active: 0 0 0 2px var(--color-accent), 0 8px 24px -4px rgba(0, 150, 200, 0.2);
    
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Courier New', Courier, monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 400;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-sidebar);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-accent);
}

/* Panel Elevation Utility */
.glass-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-premium);
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Dashboard Header */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.back-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
    box-shadow: 0 4px 12px rgba(0, 150, 200, 0.2);
}

.header-title-area h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-title-area p {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.sla-badge {
    background: hsla(355, 85%, 48%, 0.08);
    border: 1.5px solid var(--color-danger);
    color: var(--color-danger);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: pulse-danger 2s infinite;
}

@keyframes pulse-danger {
    0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.2); }
    70% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

/* Main Dashboard Workspace - RECONFIGURED COLUMNS */
.dashboard-grid {
    display: grid;
    grid-template-columns: 280px 1fr 430px;
    gap: 16px;
    padding: 16px;
    height: calc(100vh - 69px);
    overflow: hidden;
}

/* Panel Containers */
.panel-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.panel-header {
    padding: 12px 18px;
    border-bottom: 2px solid var(--border-color);
    background: var(--bg-sidebar);
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--bg-card);
}

/* Flowchart Visual Container styling */
.flowchart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
}

/* Flowchart Visual Connector styling */
.flowchart-connector {
    width: 3px;
    height: 20px;
    background: var(--border-color);
    position: relative;
}

.flowchart-connector::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--text-muted);
}

.flowchart-connector.active {
    background: var(--color-accent);
}

.flowchart-connector.active::after {
    border-top-color: var(--color-accent);
}

/* Flowchart Nodes - Clean Elevated Cards */
.flowchart-node {
    width: 240px;
    padding: 10px 12px;
    cursor: pointer;
    background: var(--bg-main);
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.flowchart-node:hover {
    background: var(--bg-sidebar);
    border-color: var(--text-muted);
    transform: translateY(-1px);
}

.flowchart-node.active {
    background: var(--bg-card);
    border-color: var(--color-accent);
    box-shadow: 0 4px 15px rgba(0, 150, 200, 0.15);
    transform: scale(1.02);
}

/* Unique Left Borders for Node Categorization */
.flowchart-node.start { border-left: 5px solid var(--color-success); }
.flowchart-node.process { border-left: 5px solid var(--color-accent); }
.flowchart-node.decision { border-left: 5px solid var(--color-warning); }
.flowchart-node.endpoint { border-left: 5px solid var(--color-danger); }

/* Flowchart Node Inner Content */
.node-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.node-step {
    color: var(--text-muted);
}

.flowchart-node.active .node-step {
    color: var(--color-accent);
}

.node-time {
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.flowchart-node.active .node-time {
    color: var(--text-primary);
}

.node-label {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-primary);
}

.node-sublabel {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Middle Panel: Video Drawer & Compact Drawer elements */
.transcript-toggle-btn {
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 11.5px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.transcript-toggle-btn:hover {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
}

/* Compact Hideable Transcript elements */
.compact-transcript-container {
    height: 150px;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.03);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.compact-transcript-container.collapsed {
    height: 0;
    border: none;
    margin: 0;
    opacity: 0;
}

.transcript-drawer-header {
    background: var(--bg-sidebar);
    padding: 6px 12px;
    border-bottom: 1.5px solid var(--border-color);
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.transcript-drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Right Panel: Steppers Reference Layout */
.reference-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
}

.detail-section {
    padding: 8px 0;
    border-bottom: 2px solid var(--border-color);
}

.detail-section h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-accent);
    margin-bottom: 6px;
}

.detail-section p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.45;
    font-weight: 450;
}

/* How to instructions checklist */
.how-to-steps-list {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.how-to-step-item {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 12px;
    background: var(--bg-main);
    border: 1.5px solid var(--border-color);
    padding: 10px 12px;
    border-radius: 8px;
    align-items: start;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.how-to-screen-badge {
    background: var(--bg-card);
    border: 1.5px solid var(--text-muted);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 9.5px;
    font-weight: 700;
    text-align: center;
    padding: 4px 6px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.how-to-step-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.how-to-step-action {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-primary);
}

.how-to-step-detail {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.45;
    font-weight: 450;
}

/* High-Contrast Styled Keyboard Keys */
kbd {
    background: #f8f9fa;
    border: 1.5px solid #a1aab2;
    border-radius: 4px;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15), inset 0 1px 0 #fff;
    padding: 1px 5px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-primary);
    font-weight: 700;
}

/* Nuggets & Wisdom Cards */
.nuggets-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-wisdom {
    background: hsla(267, 85%, 52%, 0.03);
    border: 1.5px solid hsla(267, 85%, 52%, 0.25);
    border-radius: 8px;
    padding: 12px;
}

.card-wisdom-title {
    color: var(--color-purple);
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.card-gotcha {
    background: hsla(38, 95%, 35%, 0.03);
    border: 1.5px solid hsla(38, 95%, 35%, 0.25);
    border-radius: 8px;
    padding: 12px;
}

.card-gotcha-title {
    color: var(--color-warning);
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.card-body {
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-secondary);
    font-weight: 450;
}

/* SOP Link list */
.sop-links {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sop-link-btn {
    background: var(--bg-main);
    border: 1.5px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    font-size: 12.5px;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.sop-link-btn:hover {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
    box-shadow: 0 4px 12px rgba(0, 150, 200, 0.2);
}

/* Video Container positioning */
.video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    border: 1.5px solid var(--border-color);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

video {
    width: 100%;
    height: 100%;
    display: block;
}

/* Custom Overlay when playing out of step bounds */
.video-overlay-lock {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.96);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    z-index: 5;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.video-overlay-lock.visible {
    opacity: 1;
    pointer-events: auto;
}

.lock-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-warning);
    margin-bottom: 6px;
}

.lock-desc {
    font-size: 13.5px;
    color: var(--text-secondary);
    max-width: 80%;
    margin-bottom: 16px;
    line-height: 1.5;
}

.lock-btn {
    background: var(--color-accent);
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 150, 200, 0.25);
}

.lock-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 150, 200, 0.35);
}

/* Live Transcript Item elements */
.transcript-item {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12.5px;
    line-height: 1.45;
    transition: all 0.2s ease;
    border: 1.5px solid transparent;
    cursor: pointer;
    background: var(--bg-main);
}

.transcript-item:hover {
    background: var(--bg-sidebar);
    border-color: var(--border-color);
}

.transcript-item.highlighted {
    background: var(--bg-active-light);
    border-color: var(--color-accent);
    border-left: 4px solid var(--color-accent);
}

.transcript-time {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--color-accent);
    font-weight: 700;
    display: block;
    margin-bottom: 2px;
}

.transcript-text {
    color: var(--text-primary);
    font-weight: 450;
}

.transcript-item.highlighted .transcript-text {
    font-weight: 600;
}

/* Glossary Tooltip / Definition hover styling */
.term-hover {
    border-bottom: 1.5px dashed var(--color-purple);
    color: var(--color-purple);
    font-weight: 600;
    cursor: help;
    position: relative;
    padding: 0 1px;
}

.term-hover:hover {
    color: white;
    background: var(--color-purple);
    border-radius: 2px;
}

/* Glossary Widget card at bottom of Reference pane */
.glossary-search-widget {
    padding: 12px;
    background: var(--bg-sidebar);
}

.glossary-search-input {
    width: 100%;
    background: white;
    border: 1.5px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    outline: none;
    transition: all 0.2s ease;
}

.glossary-search-input:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(0, 150, 200, 0.1);
}

.glossary-results-box {
    max-height: 80px;
    overflow-y: auto;
    font-size: 12px;
    color: var(--text-secondary);
    display: none;
    padding: 4px;
}

.glossary-result-item {
    padding: 4px;
    border-bottom: 1px solid var(--border-color);
}

.glossary-result-item strong {
    color: var(--color-purple);
    display: block;
}

/* Trainee Checkpoint Widget */
.checkpoint-widget {
    background: hsla(145, 80%, 28%, 0.03);
    border: 1.5px solid hsla(145, 80%, 28%, 0.25);
    border-radius: 8px;
    padding: 12px;
    margin-top: 12px;
}

.checkpoint-title {
    color: var(--color-success);
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.checkpoint-question {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.4;
}

.checkpoint-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.checkpoint-option {
    background: white;
    border: 1.5px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 11.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    color: var(--text-secondary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.checkpoint-option:hover {
    border-color: var(--color-accent);
    color: var(--text-primary);
    background: var(--bg-main);
}

.checkpoint-option.correct {
    background: hsl(145, 80%, 95%);
    border-color: var(--color-success);
    color: var(--color-success);
    font-weight: 700;
}

.checkpoint-option.incorrect {
    background: hsl(355, 90%, 96%);
    border-color: var(--color-danger);
    color: var(--color-danger);
}

.feedback-msg {
    margin-top: 10px;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.45;
    display: none;
}

/* INTERACTIVE POPUP MODAL OVERLAY FOR SOP WIDGET */
.pdf-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.pdf-modal-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.pdf-modal-container {
    width: 85%;
    height: 85%;
    background: white;
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(8, 12, 26, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pdf-modal-overlay.visible .pdf-modal-container {
    transform: scale(1);
}

.pdf-modal-header {
    background: var(--bg-sidebar);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--border-color);
}

.pdf-modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.pdf-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.pdf-modal-close:hover {
    color: var(--color-danger);
}

.pdf-modal-body {
    flex: 1;
    position: relative;
    background: #525659;
}

.pdf-modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ── Non-blocking Stage Toast Notification ─────────────────────────── */
/* Replaces the old blocking overlay-lock. Video always continues. */
.video-overlay-lock {
    display: none !important; /* Fully disabled — never block the video */
}

.stage-toast {
    position: fixed;
    top: 72px;
    right: 16px;
    z-index: 9999;
    background: var(--bg-card);
    border: 1.5px solid var(--color-warning);
    border-left: 4px solid var(--color-warning);
    border-radius: 10px;
    padding: 10px 16px;
    min-width: 260px;
    max-width: 340px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.10);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    transform: translateX(calc(100% + 24px));
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    pointer-events: none;
}

.stage-toast.show {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.stage-toast-icon {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 1px;
    color: var(--color-warning);
}

.stage-toast-body {
    flex: 1;
}

.stage-toast-title {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--color-warning);
    margin-bottom: 2px;
}

.stage-toast-msg {
    font-size: 11.5px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.stage-toast-close {
    background: none;
    border: none;
    font-size: 16px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.2s;
}

.stage-toast-close:hover {
    color: var(--color-danger);
}
