/* VioVerse Phase 2 - Complete Stylesheet */

/* CSS Custom Properties */
:root {
    /* Brand Colors */
    --brand-orange: #f26419;

    /* Surface Colors */
    --surface-deep: #0a0f14;
    --surface-main: #1e2a35;
    --surface-panel: #253541;
    --surface-border: #3a4854;
    --surface-viewport: #7C868D;

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #BEC6CC;
    --text-muted: #9BA1A6;

    /* Severity Colors */
    --severity-extreme: #dc2626;
    --severity-severe: #f26419;
    --severity-serious: #fbbf24;

    /* Page Grid Colors */
    --grid-normal: #4a5358;
    --grid-violation: #f26419;
    --grid-ccrp: #22c55e;  /* Compliant Credit Report Page - green */
    --grid-ccrp-hover: #16a34a;
    --grid-selected: #ff4444;
    --grid-selected-experian: #60a5fa;  /* Light blue for Experian selected pages */
    --grid-hover: #5a6368;
    --grid-selected-border: #ffffff;
    --grid-icon: #ffffff;

    /* UI State Colors */
    --ui-active: #ff6b35;
    --ui-inactive: #BEC6CC;

    /* Layout Dimensions */
    --topbar-height: 40px;
    --sidebar-width: 280px;
}

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

body {
    font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
    background: var(--surface-deep);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

/* Loading state - hide everything until ready */
body.loading .app-container {
    opacity: 0;
}

/* Hide ALL viewport content during loading to prevent flash of wrong view */
body.loading .karaoke-intro,
body.loading .karaoke-player,
body.loading #canvasContainer {
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Reveal viewport content after view is initialized */
body.view-initialized .karaoke-intro,
body.view-initialized .karaoke-player,
body.view-initialized #canvasContainer {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.15s ease-out;
}

body:not(.loading) .app-container {
    opacity: 1;
    transition: opacity 0.3s ease-out;
}

@media (max-width: 768px) {
    body {
        overflow-y: auto;
        height: auto;
        min-height: 100vh;
    }
}

/* Main Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Top Bar */
.top-bar {
    height: 40px;
    background: var(--surface-main);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--surface-border);
}

/* Content Area */
.content-area {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Sidebars */
.sidebar {
    width: var(--sidebar-width);
    background: var(--surface-panel);
    overflow-y: auto;
    transition: width 0.3s ease;
}

.sidebar.collapsed {
    width: 0;
    overflow: hidden;
}

.sidebar-section {
    background: var(--surface-main);
    border-radius: 6px;
    padding: 12px;
    margin: 12px;
    box-sizing: border-box;
    overflow: hidden;
}

/* Assistant section glow for attorney first impressions */
.assistant-section-glow {
    box-shadow: 0 0 12px rgba(0, 200, 255, 0.5);
}

.hidden {
    display: none !important;
}

.sidebar-section.hidden {
    display: none;
}

#detailsSection {
    background: var(--surface-main);
    padding: 14px;
}

.section-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: lowercase;
    margin-bottom: 12px;
}

#detailsSection .section-label {
    font-size: 11px;
    color: #7C868D;
    text-transform: lowercase;
    margin-bottom: 12px;
    font-weight: 400;
}

/* Icon Buttons */
.icon-toggle-btn {
    width: 24px;
    height: 24px;
    padding: 4px;
    background: transparent;
    border: 1px solid var(--surface-border);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.icon-toggle-btn:hover,
.icon-toggle-btn.active {
    background: var(--ui-active);
    border-color: var(--ui-active);
    color: var(--text-primary);
}

.icon-toggle-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

/* Session Interface */
.session-controls {
    display: flex;
    gap: 8px;
    width: 100%;
}

.session-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.session-input {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--surface-border);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    padding: 4px 0;
    flex: 1;
    min-width: 0;
    max-width: calc(100% - 100px);
}

.session-input:focus {
    outline: none;
    border-bottom-color: var(--ui-active);
}

.session-error {
    color: var(--ui-active);
    font-size: 11px;
    margin-top: 4px;
    display: none;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.session-item {
    background: var(--surface-main);
    border-radius: 6px;
    border: 2px solid transparent;
    padding: 8px 10px;
    margin-bottom: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.session-item:hover {
    background: rgba(242, 100, 25, 0.1);
}

.session-item.default-session {
    border: 2px solid var(--brand-orange);
}

.session-item.default-session .session-name {
    color: var(--brand-orange);
}

.session-delete-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.session-delete-btn:hover {
    color: var(--text-primary);
}

.session-delete-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.default-session-btn {
    border: 1px solid var(--ui-active);
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.default-session-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.default-session-btn span {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 400;
}

.session-info {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
}

.session-name {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.session-timestamp {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Canvas Viewport */
.center-viewport {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: var(--surface-viewport);
    padding: 10px;
    position: relative;
    overflow: auto;
    will-change: opacity;
    transition: opacity 0.25s ease-in-out;
}

.canvas-container {
    position: relative;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform-origin: center top;
    margin: 0 auto;
    display: inline-block;
}

#mainCanvas {
    display: block;
    max-width: none;
    cursor: default;
    opacity: 1;
    transition: opacity 0.25s ease-in-out;
}

#mainCanvas.loading {
    opacity: 0;
    pointer-events: none;
}

#mainCanvas.redaction-mode {
    cursor: crosshair;
}

#defaultContent {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px;
    text-align: center;
    color: #333;
}

/* Button Systems */
.view-switcher {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 2px;
}

.top-controls {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
}

.view-btn {
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    font-size: 16px;
    font-family: inherit;
    font-weight: 500;
    transition: none;
    height: 32px;
    text-transform: lowercase;
}

.view-btn.active {
    color: #f26419;
}

.view-btn.active svg {
    stroke: #f26419;
}

.view-btn:hover:not(.active) {
    color: #ffffff;
}

.view-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    transition: none;
}

.toggle-btn {
    background: none;
    border: none;
    color: #BEC6CC;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    font-size: 12px;
    font-family: inherit;
    font-weight: 500;
    transition: color 0.2s ease;
    height: 28px;
    text-transform: lowercase;
}

.toggle-btn.active {
    color: #f26419;
}

.toggle-btn:hover {
    color: #ffffff;
}

.toggle-btn svg {
    width: 13px;
    height: 13px;
    stroke: currentColor;
}

/* Selector and Date Buttons */
.selector-btn {
    flex: 1;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--surface-border);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.selector-btn.active {
    background: var(--ui-active);
    border-color: var(--ui-active);
    color: var(--text-primary);
}

.selector-btn:not(.active):not(:disabled):hover {
    background: rgba(242, 100, 25, 0.1);
    border-color: var(--ui-active);
    color: var(--ui-active);
}

.selector-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.selector-buttons {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.date-btn {
    height: 32px;
    padding: 6px 8px;
    background: transparent;
    border: 1px solid var(--surface-border);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    position: relative;
}

.date-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.date-btn.active {
    background: var(--ui-active);
    border-color: var(--ui-active);
    color: var(--text-primary);
}

.date-btn:not(.active):not(:disabled):hover {
    background: rgba(242, 100, 25, 0.1);
    border-color: var(--ui-active);
    color: var(--ui-active);
}

.date-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Page Grid */
.page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(22px, 1fr));
    gap: 4px;
    max-width: 100%;
    contain: layout;
}

.grid-cell {
    aspect-ratio: 1 / 1;
    border-radius: 4px;
    background: var(--grid-normal);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.grid-cell.violation {
    background: var(--grid-violation);
}

/* Compliant Credit Report Pages (CCRP) - green with thumbs-up icon */
.grid-cell.ccrp {
    background: var(--grid-ccrp);
}

.grid-cell.ccrp svg {
    stroke: var(--grid-icon);
    stroke-width: 2.5;
}

.grid-cell.ccrp:not(.selected):hover {
    transform: scale(1.1);
    z-index: 10;
    background: var(--grid-ccrp-hover);
}

.grid-cell.selected {
    background: var(--grid-selected);
    box-shadow: 0 0 0 2px var(--grid-selected-border);
    transform: scale(1.0);
}

/* Experian (EX) bureau uses light blue for selected pages instead of red */
.page-grid[data-bureau="EX"] .grid-cell.selected {
    background: var(--grid-selected-experian);
}

/* CCRP cells when selected - ensure selected state overrides green background */
.grid-cell.ccrp.selected {
    background: var(--grid-selected) !important;
    box-shadow: 0 0 0 2px var(--grid-selected-border);
}

/* Experian CCRP cells when selected use light blue */
.page-grid[data-bureau="EX"] .grid-cell.ccrp.selected {
    background: var(--grid-selected-experian) !important;
}

/* Document-Aware Selection Styling (Evidence View) */
/* Sibling pages - other pages of the same multi-page document */
.grid-cell.sibling {
    background: var(--grid-violation); /* Orange - same as violation pages */
    opacity: 1;
}

.grid-cell.sibling svg {
    stroke: var(--grid-icon);
}

.grid-cell.sibling:hover {
    transform: scale(1.1);
    z-index: 10;
    background: #ff7c3a;
    box-shadow: 0 0 0 2px #ffffff;
}

/* Grayed-out pages - pages from other documents */
.grid-cell.grayed-out {
    opacity: 0.25;
    pointer-events: auto; /* Still clickable */
}

.grid-cell.grayed-out:hover {
    opacity: 0.6;
    transform: scale(1.05);
}

/* Ensure grayed-out cells with content (violation class) show their base color dimmed */
.grid-cell.violation.grayed-out {
    background: var(--grid-violation);
}

.grid-cell.ccrp.grayed-out {
    background: var(--grid-ccrp);
}

/* Only apply hover effects to cells with content (violation class) */
.grid-cell.violation:not(.selected):hover {
    transform: scale(1.1);
    z-index: 10;
    background: #ff7c3a;
}

/* Disabled: hover effects for blank pages
.grid-cell:not(.selected):hover {
    transform: scale(1.1);
    z-index: 10;
}

.grid-cell:not(.violation):hover {
    background: var(--grid-hover);
}
*/

/* Grid Cell Tooltip */
#gridTooltip {
    position: fixed;
    z-index: 9999;
    background: var(--surface-main);
    border: 1px solid #ffffff;
    border-radius: 6px;
    padding: 8px 12px;
    max-width: 280px;
    min-width: 160px;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    font-size: 12px;
    line-height: 1.4;
}

#gridTooltip.visible {
    opacity: 1;
    visibility: visible;
}

#gridTooltip::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--surface-main);
    border-right: 1px solid #ffffff;
    border-bottom: 1px solid #ffffff;
    transform: rotate(45deg);
}

/* Tooltip arrow positioning - default below tooltip (pointing down) */
/* Uses --arrow-offset custom property for dynamic positioning when tooltip hits viewport edges */
#gridTooltip.arrow-bottom::after {
    bottom: -5px;
    left: var(--arrow-offset, 50%);
    margin-left: -4px;
}

/* Tooltip arrow when tooltip is below cell (pointing up) */
#gridTooltip.arrow-top::after {
    top: -5px;
    left: var(--arrow-offset, 50%);
    margin-left: -4px;
    transform: rotate(-135deg);
}

.tooltip-header {
    color: var(--brand-orange);
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tooltip-title {
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 2px;
}

.tooltip-subtitle {
    color: var(--text-secondary);
    font-size: 11px;
}

.tooltip-violations {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--surface-border);
}

.tooltip-violation-count {
    color: var(--severity-severe);
    font-weight: 600;
}

.tooltip-severity {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 4px;
}

.tooltip-severity.extreme { background: var(--severity-extreme); color: white; }
.tooltip-severity.severe { background: var(--severity-severe); color: white; }
.tooltip-severity.serious { background: var(--severity-serious); color: #1a1a1a; }

/* Enhanced grid cell hover glow - only for cells with content */
.grid-cell.violation:not(.selected):hover {
    box-shadow: 0 0 0 2px #ffffff;
}

.grid-cell.ccrp:not(.selected):hover {
    box-shadow: 0 0 0 2px #ffffff;
}

/* Overlay Elements */
#overlayContainer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.viobox {
    position: absolute;
    border: 2px solid var(--severity-severe);
    background: rgba(242, 100, 25, 0.15);
    pointer-events: all;
    transition: all 0.2s ease;
}

.viobox[data-severity="extreme"] {
    border-color: var(--severity-extreme);
    background: rgba(220, 38, 38, 0.15);
}

.viobox[data-severity="severe"] {
    border-color: var(--severity-severe);
    background: rgba(242, 100, 25, 0.15);
}

.viobox[data-severity="serious"] {
    border-color: var(--severity-serious);
    background: rgba(251, 191, 36, 0.15);
}

.viobox:not(.deactivated):hover {
    opacity: 0.8;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.viobox.deactivated {
    border-style: dotted !important;
    border-width: 2px;
    pointer-events: all;
}

.viobox.deactivated[data-severity="extreme"] {
    border-color: rgba(220, 38, 38, 0.5) !important;
    background: rgba(220, 38, 38, 0.1) !important;
}

.viobox.deactivated[data-severity="severe"] {
    border-color: rgba(242, 100, 25, 0.5) !important;
    background: rgba(242, 100, 25, 0.1) !important;
}

.viobox.deactivated[data-severity="serious"] {
    border-color: rgba(251, 191, 36, 0.5) !important;
    background: rgba(251, 191, 36, 0.1) !important;
}

.viobox.has-overlaps:hover {
    cursor: cell;
    animation: pulse-border 0.5s ease-in-out;
}

@keyframes pulse-border {
    0%, 100% { border-width: 2px; }
    50% { border-width: 3px; }
}

/* VioBox Duplicate Badge */
.viobox-badge {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    min-width: 18px;
    height: 18px;
    background: #dc2626;
    color: #ffffff;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    padding: 0 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 100;
    line-height: 1;
    font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
}

/* Ensure badge is visible on deactivated VioBoxes */
.viobox.deactivated .viobox-badge {
    background: rgba(220, 38, 38, 0.7);
}

/* Highlight Tools */
.evidence-highlight {
    position: absolute;
    isolation: isolate;
    z-index: 10;
    transition: opacity 0.2s ease;
    border: none;
}

/* Ensure highlights don't have redaction styles */
.evidence-highlight.redact-box {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: transparent !important;
}

.temp-highlight {
    border: none !important;
    pointer-events: none;
}

/* Redaction Boxes */
.redact-box {
    position: absolute;
    border: none;
    background: transparent;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    pointer-events: all;
    z-index: 20;
    transition: opacity 0.2s ease;
}

/* Ensure redactions don't have highlight styles */
.redact-box.evidence-highlight {
    mix-blend-mode: normal !important;
    isolation: auto !important;
}

.temp-redact {
    border: none !important;
    pointer-events: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(0, 0, 0, 0.05);
}

/* Container-specific isolation */
.highlight-container-only {
    z-index: 15 !important;
    isolation: isolate;
}

.redaction-container-only {
    z-index: 20 !important;
    isolation: isolate;
}

.resize-handle {
    width: 8px;
    height: 8px;
    background: white;
    border: 1px solid black;
    position: absolute;
    z-index: 1000;
}

/* Print support for redactions */
@media print {
    .redact-box {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
}

/* Toast Notifications */
.toast-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--ui-active);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 3000;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

/* VioBox Manager Popup Mobile Animation */
@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Mobile Swipe Navigation Animations */
/* Using opacity-only to avoid conflicting with mobile scale transform */
@keyframes swipeFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes swipeFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Session Rename Dialog */
.session-rename-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.session-rename-dialog {
    background: var(--surface-main);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    padding: 20px;
    min-width: 320px;
    max-width: 400px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.session-rename-header {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.session-rename-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.session-rename-input {
    width: 100%;
    background: var(--surface-deep);
    border: 1px solid var(--surface-border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    padding: 8px 10px;
    margin-bottom: 16px;
}

.session-rename-input:focus {
    outline: none;
    border-color: var(--brand-orange);
}

.session-rename-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.session-rename-btn {
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.session-rename-ok {
    background: var(--brand-orange);
    color: var(--text-primary);
}

.session-rename-ok:hover {
    background: #ff7c3a;
}

.session-rename-cancel {
    background: transparent;
    border: 1px solid var(--surface-border);
    color: var(--text-secondary);
}

.session-rename-cancel:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

/* Custom Scrollbars */
/* Webkit browsers (Chrome, Safari, Edge) */
.sidebar::-webkit-scrollbar,
.center-viewport::-webkit-scrollbar,
body::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.sidebar::-webkit-scrollbar-track,
.center-viewport::-webkit-scrollbar-track,
body::-webkit-scrollbar-track {
    background: var(--surface-panel);
}

.sidebar::-webkit-scrollbar-thumb,
.center-viewport::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb {
    background: #5a6368;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.center-viewport::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover {
    background: var(--brand-orange);
}

/* Firefox */
.sidebar,
.center-viewport,
body {
    scrollbar-width: thin;
    scrollbar-color: #5a6368 var(--surface-panel);
}

/* Light-themed scrollbars for white popups */
.case-guide-body::-webkit-scrollbar,
.assistant-chat-messages::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.case-guide-body::-webkit-scrollbar-track,
.assistant-chat-messages::-webkit-scrollbar-track {
    background: #f0f0f0;
}

.case-guide-body::-webkit-scrollbar-thumb,
.assistant-chat-messages::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.case-guide-body::-webkit-scrollbar-thumb:hover,
.assistant-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

/* Firefox - light theme popups */
.case-guide-body,
.assistant-chat-messages {
    scrollbar-width: thin;
    scrollbar-color: #c0c0c0 #f0f0f0;
}

/* Tablet/iPad Styles (including iPad Pro) */
@media (min-width: 769px) and (max-width: 1366px) {
    .center-viewport {
        padding: 10px;
        min-height: calc(100vh - var(--topbar-height) - env(safe-area-inset-bottom));
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: var(--topbar-height);
        left: -100%;
        width: 100%;
        height: calc(100% - var(--topbar-height) - 96px);
        z-index: 50;
        transition: left 0.3s ease;
        transform: scale(1) !important;
    }

    .sidebar.mobile-open {
        left: 0;
    }

    .top-controls {
        display: none;
    }

    /* Show mobile-specific controls even when top-controls is hidden */
    .top-controls .mobile-zoom-toggle,
    .top-controls .hamburger-menu {
        display: flex !important;
    }

    /* Make top-controls visible but hide desktop buttons */
    .top-controls {
        display: flex !important;
    }

    .top-controls .toggle-btn:not(.mobile-zoom-toggle):not(.hamburger-menu),
    .top-controls .zoom-controls {
        display: none !important;
    }

    .view-btn {
        font-size: 13px;
        padding: 4px 8px;
    }

    .view-btn svg {
        width: 16px;
        height: 16px;
    }

    /* Hide text labels for inactive view buttons on mobile */
    .view-btn:not(.active) span {
        display: none;
    }

    /* Adjust padding for icon-only inactive buttons */
    .view-btn:not(.active) {
        padding: 4px;
        min-width: 32px;
        justify-content: center;
    }

    /* Tighter spacing for view switcher on mobile */
    .view-switcher {
        gap: 0;
    }

    .canvas-container {
        /* Mobile scaling applied via JS - removes hardcoded 0.75 */
        transform-origin: center top;
        margin: 0 auto;
    }

    /* Mobile Swipe Navigation Animation Classes */
    .canvas-container.swipe-fade-out {
        animation: swipeFadeOut 0.12s ease-out forwards;
    }

    .canvas-container.swipe-fade-in {
        animation: swipeFadeIn 0.18s ease-out forwards;
    }

    .center-viewport {
        padding: 0 10px 10px 10px;
        padding-top: calc(40px + env(safe-area-inset-top));
        justify-content: center;
        align-items: flex-start;
        touch-action: pan-y;  /* Only vertical panning native - horizontal swipes handled by JS */
        overflow-y: auto;
        min-height: calc(100vh - var(--topbar-height) - 96px);
    }

    /* Prevent nav bars from scaling during pinch-zoom */
    .top-bar {
        position: fixed;
        top: 0;
        top: env(safe-area-inset-top);
        left: 0;
        right: 0;
        z-index: 100;
        transform: scale(1) !important;
        transform-origin: top left;
    }

    .mobile-bottom-bars {
        display: flex;
        flex-direction: column;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        background: var(--surface-main);
        border-top: 1px solid var(--surface-border);
        z-index: 60;
        transform: scale(1) !important;
        transform-origin: bottom left;
    }

    .mobile-bar {
        display: flex;
        height: 48px;
    }

    .mobile-bar-btn {
        flex: 1;
        background: none;
        border: none;
        color: var(--ui-inactive);
        font-size: 11px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        cursor: pointer;
        padding: 8px;
    }

    .mobile-bar-btn.active {
        color: var(--ui-active);
    }

    .mobile-bar-btn svg {
        width: 18px;
        height: 18px;
    }

    .page-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .grid-cell {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Mobile Zoom Toggle */
.mobile-zoom-toggle {
    display: none;
    background: none;
    border: none;
    color: #7C868D;
    cursor: pointer;
    padding: 4px;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.mobile-zoom-toggle.active {
    color: #f26419;
}

.mobile-zoom-toggle svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

/* Hamburger Menu */
.hamburger-menu {
    background: none;
    border: none;
    color: #7C868D;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.hamburger-menu:hover {
    color: #BEC6CC;
}

.hamburger-menu svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

/* Mobile Zoom Controls */
.mobile-zoom-controls {
    display: none;
    position: fixed;
    bottom: 100px;
    right: 12px;
    background: var(--surface-main);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    padding: 8px;
    gap: 6px;
    align-items: center;
    z-index: 70;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.mobile-zoom-controls.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.mobile-zoom-btn {
    width: 36px;
    height: 36px;
    background: var(--surface-panel);
    border: 1px solid var(--surface-border);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.mobile-zoom-btn:active {
    background: var(--ui-active);
    color: var(--text-primary);
}

.mobile-zoom-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.mobile-zoom-percentage {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 42px;
    text-align: center;
}

@media (max-width: 768px) {
    .mobile-zoom-controls {
        display: flex;
    }

    .mobile-zoom-toggle {
        display: flex;
    }
}

@media (min-width: 769px) {
    .mobile-bottom-bars,
    .mobile-zoom-controls,
    .hamburger-menu {
        display: none !important;
    }
}

/* Story Controls */
.story-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    gap: 16px;
    background: rgba(0, 0, 0, 0.8);
    padding: 8px 16px;
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.story-controls.visible {
    opacity: 1;
    pointer-events: all;
}

/* Violation Counter */
.violation-counter {
    padding: 12px;
    background: var(--surface-main);
    border-radius: 6px;
    margin-bottom: 12px;
}

.counter-header {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 400;
    color: #BEC6CC;
    margin-bottom: 10px;
}

.counter-summary {
    text-align: left;
    margin-bottom: 14px;
    line-height: 1.2;
}

.counter-summary > div {
    margin-bottom: 2px;
}

.counter-summary span:first-child {
    color: #ffffff;
    font-size: 13px;
    font-weight: 400;
}

.counter-active,
.counter-case-total,
.counter-all-reports {
    color: #f26419;
    font-size: 24px;
    font-weight: 700;
    display: inline;
    margin-left: 6px;
}

.severity-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    padding: 2px 0;
}

.severity-label {
    display: flex;
    align-items: center;
    min-width: 60px;
    flex-shrink: 0;
}

.severity-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 6px;
    flex-shrink: 0;
}

.severity-row[data-severity="extreme"] .severity-dot {
    background: #dc2626;
}

.severity-row[data-severity="severe"] .severity-dot {
    background: #f26419;
}

.severity-row[data-severity="serious"] .severity-dot {
    background: #fbbf24;
}

.severity-label span {
    color: #ffffff;
    font-size: 11px;
    font-weight: 400;
    text-transform: lowercase;
}

.severity-progress {
    flex: 1;
    height: 4px;
    background: #3a4854;
    border-radius: 2px;
    overflow: hidden;
    margin: 0 8px 0 4px;
    position: relative;
}

.severity-progress-fill {
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 2px;
}

.severity-row[data-severity="extreme"] .severity-progress-fill {
    background: #dc2626;
}

.severity-row[data-severity="severe"] .severity-progress-fill {
    background: #f26419;
}

.severity-row[data-severity="serious"] .severity-progress-fill {
    background: #fbbf24;
}

.severity-count {
    color: #9BA1A6;
    font-size: 11px;
    font-weight: 400;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 28px;
    text-align: right;
}

.reset-violations-btn {
    display: block;
    width: 100%;
    padding: 8px 12px;
    margin-top: 14px;
    background: transparent;
    border: 1px solid #3a4854;
    border-radius: 4px;
    color: #BEC6CC;
    font-size: 12px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reset-violations-btn:hover {
    background: rgba(242, 100, 25, 0.1);
    border-color: #f26419;
    color: #f26419;
}

/* Zoom Controls */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 3px;
}

.zoom-controls button {
    background: none;
    border: none;
    color: #7C868D;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.zoom-controls button:hover {
    color: #BEC6CC;
}

.zoom-controls button svg {
    width: 13px;
    height: 13px;
    stroke: currentColor;
}

.zoom-percentage {
    font-size: 12px;
    color: #7C868D;
    min-width: 38px;
    text-align: center;
    font-weight: 400;
}

/* Evidence Type Selector */
.evidence-type-buttons {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.evidence-type-btn {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid var(--surface-border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: lowercase;
}

.evidence-type-btn.active {
    background: var(--ui-active);
    border-color: var(--ui-active);
    color: var(--text-primary);
}

.evidence-type-btn:not(.active):hover {
    background: rgba(242, 100, 25, 0.1);
    border-color: var(--ui-active);
    color: var(--ui-active);
}

/* Tools Header (for combined highlight/redaction section) */
.tools-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.tools-header .section-label {
    margin-bottom: 0;
}

.visibility-toggle-btn {
    background: none;
    border: none;
    color: var(--ui-active);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    font-size: 13px;
    font-family: inherit;
    font-weight: 400;
    transition: opacity 0.2s ease;
    text-transform: lowercase;
}

.visibility-toggle-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    flex-shrink: 0;
}

.visibility-toggle-btn:hover {
    opacity: 0.8;
}

/* Tools Divider */
.tools-divider {
    height: 1px;
    background: var(--surface-border);
    margin: 16px 0;
}

/* Redaction Controls */
.redaction-controls {
    display: flex;
    gap: 6px;
}

/* Full Width Redaction Button (Report/Story Views) */
.redaction-btn-full {
    width: 100%;
    padding: 12px 16px;
    background: rgba(30, 42, 53, 0.6);
    border: 1px solid var(--surface-border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: lowercase;
    margin-top: 12px;
}

.redaction-btn-full svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    flex-shrink: 0;
}

.redaction-btn-full.active {
    border: 2px solid var(--ui-active);
    box-shadow: 0 0 10px rgba(242, 100, 25, 0.4);
}

.redaction-btn-full:not(.active):hover {
    border-color: rgba(190, 198, 204, 0.5);
}

/* Highlight Mode and Color Buttons - Match erase button style */
.highlight-mode-toggle,
.color-selector {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.mode-btn,
.color-btn {
    flex: 1;
    padding: 8px 10px;
    background: rgba(30, 42, 53, 0.6);
    border: 1px solid var(--surface-border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-transform: lowercase;
}

.redaction-btn {
    flex: 1;
    padding: 8px 12px;
    background: rgba(30, 42, 53, 0.6);
    border: 1px solid var(--surface-border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-transform: lowercase;
    height: 40px;
}

.mode-btn svg,
.color-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    flex-shrink: 0;
}

.redaction-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    flex-shrink: 0;
}

/* Active states with colored borders */
.mode-btn.active,
.eraserModeBtn.active {
    border: 2px solid rgba(190, 198, 204, 0.8);
    box-shadow: 0 0 8px rgba(190, 198, 204, 0.4);
}

.color-btn#yellowColorBtn.active {
    border: 2px solid rgba(255, 235, 90, 0.9);
    box-shadow: 0 0 10px rgba(255, 235, 90, 0.5);
}

.color-btn#pinkColorBtn.active {
    border: 2px solid rgba(255, 105, 180, 0.9);
    box-shadow: 0 0 10px rgba(255, 105, 180, 0.5);
}

.redaction-btn.active {
    border: 2px solid var(--ui-active);
    box-shadow: 0 0 10px rgba(242, 100, 25, 0.4);
}

.mode-btn:not(.active):hover,
.color-btn:not(.active):hover,
.redaction-btn:not(.active):hover {
    border-color: rgba(190, 198, 204, 0.5);
}

.color-btn {
    flex-direction: column;
    padding: 10px 8px;
    min-height: 60px;
}

.color-swatch {
    width: 30px;
    height: 10px;
    border-radius: 2px;
    margin-bottom: 4px;
}

/* Violations Toggle */
.violations-toggle {
    margin: 12px 0;
    display: flex;
    align-items: center;
}

.violations-toggle-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    font-size: 13px;
    font-family: inherit;
    font-weight: 400;
    transition: all 0.2s ease;
    text-transform: lowercase;
}

.violations-toggle-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    flex-shrink: 0;
}

.violations-toggle-btn.active {
    color: var(--brand-orange);
}

.violations-toggle-btn:hover {
    opacity: 0.8;
}

/* Page Grid Navigation Hint */
.page-grid-nav-hint {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 12px;
}

.page-grid-nav-hint .nav-hint-key {
    color: var(--text-secondary);
    font-weight: 600;
}

/* Desktop: show page up/down, hide swipe */
.page-grid-nav-hint .nav-hint-desktop {
    display: inline;
}
.page-grid-nav-hint .nav-hint-mobile {
    display: none;
}

/* Mobile: show swipe, hide page up/down */
@media (max-width: 768px) {
    .page-grid-nav-hint .nav-hint-desktop {
        display: none;
    }
    .page-grid-nav-hint .nav-hint-mobile {
        display: inline;
    }
}

/* Page Info */
.page-info-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0;
}

.page-info {
    font-size: 13px;
    color: var(--text-secondary);
}

.page-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}

.page-download-btn:hover {
    color: var(--text-secondary);
    background: var(--surface-border);
}

.page-download-btn:active {
    background: var(--surface-main);
}

.page-download-btn svg {
    width: 12px;
    height: 12px;
}

.page-download-btn span {
    font-size: 12px;
    font-weight: 500;
}

.page-context {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* Evidence Summary Display */
.summary-display {
    padding: 12px;
    line-height: 1.4;
}

.summary-title {
    font-size: 20px;
    font-weight: 700;
    color: #FFFDCC;
    line-height: 1.3;
    margin-bottom: 16px;
    padding: 12px;
}

.summary-prefix {
    color: var(--brand-orange);
    font-weight: 700;
}

.metadata-display {
    margin-top: 16px;
    padding: 0 12px;
}

.metadata-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
}

.metadata-item span:first-child {
    color: var(--text-muted);
}

.metadata-item span:last-child {
    color: var(--text-primary);
    font-weight: 500;
}

.notes-label {
    display: block;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    margin-top: 16px;
    margin-bottom: 8px;
    padding: 0 12px;
}

/* Evidence Notes */
.evidence-notes-input {
    width: calc(100% - 24px);
    margin: 0 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--surface-border);
    border-radius: 4px;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 13px;
    padding: 10px;
    resize: vertical;
    min-height: 200px;
}

.evidence-notes-input:focus {
    outline: none;
    border-color: var(--ui-active);
    color: var(--text-primary);
}

.evidence-notes-input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

/* EID Badge */
.eid-badge {
    display: inline-block;
    background: var(--surface-main);
    border: 1px solid var(--brand-orange);
    border-radius: 4px;
    padding: 4px 10px;
    margin: 0 12px 8px 12px;
    font-size: 12px;
    font-weight: 700;
    color: #BEC6CC;
    letter-spacing: 0.5px;
}

/* EID Badge in Tooltip */
#gridTooltip .eid-badge {
    display: inline-block;
    background: var(--surface-main);
    border: 1px solid var(--brand-orange);
    border-radius: 4px;
    padding: 2px 6px;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 700;
    color: #BEC6CC;
    letter-spacing: 0.5px;
}

/* Filter Options */
.filter-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group-label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 2px;
    text-transform: lowercase;
}

.filter-checkboxes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.filter-checkboxes.single-column {
    grid-template-columns: 1fr;
}

.filter-checkbox-item {
    display: flex;
    align-items: center;
    padding: 1px 4px;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 10px;
}

.filter-checkbox-item:hover:not(.disabled) {
    background: transparent;
}

.filter-checkbox-item.disabled {
    opacity: 1;
    cursor: not-allowed;
    background: transparent;
}

.filter-checkbox-item.selected {
    color: #9BA1A6;
}

.filter-checkbox-item.selected svg {
    stroke: #f26419;
}

.filter-group input[type="date"] {
    background: var(--surface-deep);
    border: 1px solid var(--surface-border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 13px;
    padding: 6px 8px;
}

.filter-group input[type="date"]:focus {
    outline: none;
    border-color: var(--ui-active);
}

/* Filter action links (all/none) */
.filter-action-link {
    font-size: 10px;
    color: #7C868D;
    cursor: pointer;
    transition: color 0.2s ease;
    padding: 2px 4px;
    text-transform: lowercase;
    user-select: none;
}

.filter-action-link:hover {
    color: #f26419;
}

.filter-action-link:active {
    color: #d9551a;
}

/* Filter section */
.filter-section {
    margin-bottom: 12px;
}

/* Hide specific filters in report view */
body.view-report .filter-section.hide-in-report {
    display: none;
}

.filter-header {
    display: flex;
    align-items: center;
    padding: 4px 0;
    margin-bottom: 4px;
}

.filter-content {
    overflow: hidden;
}

/* Filter action buttons */
#runFilterBtn,
#clearFilterBtn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Filter results display */
#filterResults {
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    #runFilterBtn,
    #clearFilterBtn {
        padding: 12px 16px !important;
        font-size: 14px !important;
    }

    #filterResults {
        padding: 14px !important;
    }

    #filterResults > div:first-child {
        font-size: 12px !important;
    }

    #filterResults > div:last-child {
        font-size: 13px !important;
    }

    /* Larger touch targets for mobile */
    .filter-action-link {
        font-size: 11px !important;
        padding: 4px 6px !important;
        min-width: 28px;
        display: inline-block;
        text-align: center;
    }
}

/* Karaoke Player Styles */
.karaoke-intro {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #1e2a35;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 10;
}

.karaoke-intro.loaded {
    /* Original image (commented out for easy revert):
    background-image: url('phase2-build/data/pdfs/story/slides/pngs/Intro.png'); */
    animation: fadeInBackground 0.5s ease-out;
}

/* Video background for intro */
.karaoke-intro-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

@keyframes fadeInBackground {
    from {
        opacity: 0.8;
    }
    to {
        opacity: 1;
    }
}

.karaoke-intro-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    padding: 40px;
    padding-top: 178px;
    max-width: 800px;
    z-index: 1;
}

.karaoke-intro-title {
    font-size: 48px;
    font-weight: 700;
    color: #FF6B35;
    margin-bottom: 12px;
    line-height: 1.2;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.karaoke-intro-subtitle {
    background: transparent;
    border: none;
    padding: 0;
    margin-bottom: 12px;
}

.karaoke-intro-subtitle span {
    font-size: 24px;
    font-weight: 500;
    color: #B8BCC8;
    letter-spacing: 0.5px;
}

.karaoke-intro-tagline {
    font-size: 16px;
    color: #B8BCC8;
    margin-bottom: 5px;
    line-height: 1.6;
    font-weight: 400;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.karaoke-intro-buttons {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    margin-bottom: 2px;
}

.karaoke-start-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 28px;
    height: 40px;
    background: #FF6B35;
    border: none;
    border-radius: 40px;
    color: #ffffff;
    font-size: 17px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none;
}

.karaoke-start-btn:hover {
    background: #FF6B35;
    transform: scale(1.02);
    box-shadow: 0 6px 24px rgba(255, 107, 53, 0.8);
}

.karaoke-start-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.karaoke-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--surface-deep);
    padding: 20px;
}

.karaoke-slide-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 12px;
}

.karaoke-slide-image {
    max-width: 95%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Video slides - crop left/right sides to match PNG aspect ratio */
video.karaoke-slide-image {
    object-fit: cover !important;
    aspect-ratio: 16 / 9 !important;
    width: 95% !important;
    max-width: 95% !important;
    max-height: 75vh !important;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.karaoke-caption-text {
    font-size: 30px;
    line-height: 1.6;
    text-align: center;
    max-width: 1000px;
    padding: 4px 8px;
    min-height: 80px;
}

.karaoke-caption-text .future {
    color: var(--text-secondary);
    opacity: 0.5;
}

.karaoke-caption-text .current {
    color: var(--brand-orange);
    opacity: 1;
    font-weight: 600;
}

.karaoke-caption-text .done {
    color: var(--text-primary);
    opacity: 1;
}

.karaoke-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
    position: relative;
}

.karaoke-controls.visible {
    opacity: 1;
}

/* Desktop: show on hover */
@media (min-width: 769px) {
    .karaoke-player:hover .karaoke-controls {
        opacity: 1;
    }
}

.karaoke-control-btn {
    width: 36px;
    height: 36px;
    background: var(--surface-main);
    border: 1px solid var(--surface-border);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.karaoke-control-btn:hover:not(:disabled) {
    background: var(--surface-panel);
    color: var(--text-primary);
    border-color: var(--brand-orange);
}

.karaoke-control-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.karaoke-control-btn.active {
    border-color: var(--brand-orange);
    color: var(--brand-orange);
}

.karaoke-control-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.karaoke-play-btn {
    width: 48px;
    height: 48px;
    background: var(--brand-orange);
    border-color: var(--brand-orange);
    color: var(--text-primary);
}

.karaoke-play-btn:hover {
    background: #ff7c3a;
    border-color: #ff7c3a;
}

.karaoke-play-btn svg {
    width: 20px;
    height: 20px;
}

/* Story View Details - Slide Info */
.story-slide-info .story-slide-date {
    font-size: 10px;
    color: var(--brand-orange);
    font-weight: 600;
    font-style: normal;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.story-slide-info .story-slide-title {
    font-size: 20px;
    font-weight: 700;
    font-style: normal;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.2;
}

.story-slide-info .story-slide-description {
    font-size: 11px;
    font-style: normal;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Mobile Karaoke Styles */
@media (max-width: 768px) {
    .karaoke-intro {
        /* Ensure absolute positioning fills viewport on mobile */
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        align-items: center;
        justify-content: center;
        z-index: 50; /* Above sidebar (z-index: 50) */
    }

    .karaoke-intro-content {
        max-width: 100%;
        padding: 20px;
        padding-top: 114px;
        gap: 4px;
    }

    .karaoke-intro-title {
        font-size: 28px;
        line-height: 1.2;
        margin-bottom: 8px;
    }

    .karaoke-intro-subtitle {
        padding: 0;
        margin-bottom: 8px;
    }

    .karaoke-intro-subtitle span {
        font-size: 19px;
    }

    .karaoke-intro-tagline {
        font-size: 13px;
        line-height: 1.5;
        margin-bottom: 3px;
    }

    .karaoke-intro-buttons {
        flex-direction: column;
        align-items: center;
        width: 100%;
        gap: 8px;
        margin-top: 12px;
        margin-bottom: 1px;
    }

    .karaoke-start-btn {
        padding: 0 20px;
        height: 28px;
        font-size: 13px;
        width: 100%;
        max-width: 280px;
    }

    .karaoke-start-btn svg {
        width: 14px;
        height: 14px;
    }

    .karaoke-skip-tutorial {
        margin-top: 2px;
    }

    .karaoke-skip-tutorial a {
        font-size: 11px;
    }

    .karaoke-player {
        padding: 10px;
        /* Keep absolute positioning to fill viewport on mobile */
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 50; /* Above sidebar */
    }

    .karaoke-slide-container {
        position: relative;
    }

    .karaoke-slide-image {
        max-height: 50vh;
    }

    .karaoke-slide-title {
        font-size: 20px;
    }

    .karaoke-slide-description {
        font-size: 14px;
    }

    .karaoke-caption-text {
        font-size: 18px;
    }

    .karaoke-control-btn {
        width: 40px;
        height: 40px;
    }

    .karaoke-play-btn {
        width: 56px;
        height: 56px;
    }

    /* Mobile-specific: Position controls centered in viewport */
    .karaoke-controls {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        opacity: 0;
        transition: opacity 0.3s ease;
        background: rgba(0, 0, 0, 0.8);
        padding: 12px;
        border-radius: 12px;
        pointer-events: auto;
        z-index: 100;
    }

    .karaoke-controls.visible {
        opacity: 1;
    }
}

/* ============================================
   TUTORIAL SYSTEM STYLES
   ============================================ */

/* Tutorial Backdrop */
.tutorial-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 9998;
    pointer-events: all;
}

.tutorial-backdrop.allow-clicks {
    pointer-events: none;
}

/* Tutorial Overlay (SVG Mask) */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
    animation: tutorialOverlayFadeIn 300ms ease-out;
}

/* Tutorial Highlighted Element */
.tutorial-highlighted {
    position: relative;
    z-index: 10001 !important;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.8),
                0 0 30px 10px rgba(255, 255, 255, 0.6),
                0 0 50px 20px rgba(255, 255, 255, 0.4),
                0 0 80px 30px rgba(255, 255, 255, 0.2) !important;
    border-radius: 8px;
    animation: tutorialHighlightGlow 200ms ease-out 150ms both, tutorialPulseGlow 2s ease-in-out infinite 400ms;
    pointer-events: auto !important;
}

.tutorial-highlighted * {
    pointer-events: auto !important;
}

/* Tutorial Tip Box */
.tutorial-tip-box {
    position: fixed;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    padding: 24px;
    width: 320px;
    font-family: 'Space Grotesk', sans-serif;
    z-index: 10002;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 250ms ease-out, transform 250ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tutorial-tip-box.active {
    opacity: 1;
    transform: scale(1);
}

.tutorial-tip-box.mobile {
    width: 90vw;
}

/* Tutorial View Navigation */
.tutorial-view-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e5e5;
}

.tutorial-view-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    transition: color 0.2s ease;
    user-select: none;
}

.tutorial-view-label:hover {
    color: #f26419;
}

.tutorial-view-label.active {
    color: #f26419;
    font-weight: 600;
    cursor: default;
}

.tutorial-nav-separator {
    color: #ccc;
    font-size: 13px;
    user-select: none;
}

/* Tutorial Heading */
.tutorial-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 18px;
    color: #1a1a1a;
    margin-bottom: 12px;
    line-height: 1.3;
}

/* Tutorial Description */
.tutorial-description {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: #4a4a4a;
    line-height: 1.6;
    margin-bottom: 20px;
}

.tutorial-description br {
    display: block;
    content: "";
    margin-top: 8px;
}

/* Tutorial Footer */
.tutorial-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* Tutorial Skip Link */
.tutorial-skip {
    color: #888;
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.tutorial-skip:hover {
    color: #555;
}

/* Tutorial Counter */
.tutorial-counter {
    color: #f26419;
    font-size: 13px;
    font-weight: 500;
    margin-left: auto;
}

/* Tutorial Prev Button */
.tutorial-prev-btn {
    background: transparent;
    color: #f26419;
    border: 1px solid #f26419;
    border-radius: 6px;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-transform: lowercase;
    font-family: 'Space Grotesk', sans-serif;
    transition: background 0.2s ease, transform 0.1s ease, color 0.2s ease;
}

.tutorial-prev-btn:hover {
    background: rgba(242, 100, 25, 0.1);
    transform: translateY(-1px);
}

.tutorial-prev-btn:active {
    transform: translateY(0);
}

/* Tutorial Prev Spacer (when no prev button on first tip) */
.tutorial-prev-spacer {
    width: 72px;
    display: inline-block;
}

/* Tutorial Next Button */
.tutorial-next-btn {
    background: #f26419;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-transform: lowercase;
    font-family: 'Space Grotesk', sans-serif;
    transition: background 0.2s ease, transform 0.1s ease;
}

.tutorial-next-btn:hover {
    background: #d95614;
    transform: translateY(-1px);
}

.tutorial-next-btn:active {
    transform: translateY(0);
}

/* Tutorial Arrow */
.tutorial-arrow {
    position: fixed;
    z-index: 10001;
    opacity: 0;
    transition: opacity 150ms ease-out;
}

.tutorial-arrow.active {
    opacity: 1;
}

/* Karaoke Skip Tutorial Link */
.karaoke-skip-tutorial {
    margin-top: 4px;
    text-align: center;
}

.karaoke-skip-tutorial a {
    color: #9BA1A6;
    font-size: 13px;
    font-weight: 400;
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s ease;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.karaoke-skip-tutorial a:hover {
    color: #FF6B35;
    text-decoration: underline;
}

/* Tutorial Animations */
@keyframes tutorialOverlayFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes tutorialHighlightGlow {
    from {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0),
                    0 0 0 0 rgba(255, 255, 255, 0),
                    0 0 0 0 rgba(255, 255, 255, 0),
                    0 0 0 0 rgba(255, 255, 255, 0);
    }
    to {
        box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.8),
                    0 0 30px 10px rgba(255, 255, 255, 0.6),
                    0 0 50px 20px rgba(255, 255, 255, 0.4),
                    0 0 80px 30px rgba(255, 255, 255, 0.2);
    }
}

@keyframes tutorialPulseGlow {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.8),
                    0 0 30px 10px rgba(255, 255, 255, 0.6),
                    0 0 50px 20px rgba(255, 255, 255, 0.4),
                    0 0 80px 30px rgba(255, 255, 255, 0.2);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(255, 255, 255, 1),
                    0 0 40px 15px rgba(255, 255, 255, 0.8),
                    0 0 70px 25px rgba(255, 255, 255, 0.5),
                    0 0 100px 35px rgba(255, 255, 255, 0.3);
    }
}

/* Mobile Tutorial Styles */
@media (max-width: 768px) {
    .tutorial-tip-box {
        width: 90vw;
        max-width: 90vw;
    }

    .tutorial-heading {
        font-size: 16px;
    }

    .tutorial-description {
        font-size: 13px;
        line-height: 1.5;
    }

    .tutorial-footer {
        flex-wrap: wrap;
        gap: 12px;
    }

    .tutorial-counter {
        order: -1;
        width: 100%;
        text-align: center;
        margin: 0 0 8px 0;
    }

    .tutorial-skip {
        flex: 1;
    }

    .tutorial-next-btn {
        flex: 1;
        padding: 10px 16px;
        font-size: 15px;
    }
}

/* Tablet Tutorial Styles */
@media (min-width: 481px) and (max-width: 768px) {
    .tutorial-tip-box {
        width: 280px;
    }
}

/* ============================================
   VIOVERSE ASSISTANT STYLES
   ============================================ */

/* Assistant Controls */
.assistant-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.assistant-controls-stacked {
    flex-direction: column;
    gap: 8px;
}

.assistant-btn-full {
    width: 100%;
}

.assistant-ask-btn {
    flex: 1;
    background: #10b981;
    border: none;
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-transform: lowercase;
    font-family: 'Space Grotesk', sans-serif;
    transition: all 0.2s ease;
}

.assistant-ask-btn:hover {
    background: #059669;
    transform: translateY(-1px);
}

.assistant-ask-btn:active {
    transform: translateY(0);
}

.assistant-ask-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.assistant-help-btn {
    flex: 1;
    background: #253541;
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-transform: lowercase;
    font-family: 'Space Grotesk', sans-serif;
    transition: all 0.2s ease;
}

.assistant-help-btn:hover {
    background: #4a4f57;
    transform: translateY(-1px);
}

.assistant-help-btn:active {
    transform: translateY(0);
}

.assistant-help-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

/* Track-specific Overview Buttons */
.assistant-overview-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.assistant-overview-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border: none;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.assistant-overview-btn svg {
    width: 14px;
    height: 14px;
    stroke: white;
}

.assistant-fcra-btn {
    background-color: #2980B9;
}

.assistant-fcra-btn:hover {
    background-color: #3498db;
    transform: translateY(-1px);
}

.assistant-bk-btn {
    background-color: #f26419;
}

.assistant-bk-btn:hover {
    background-color: #ff7830;
    transform: translateY(-1px);
}

/* Chat List */
.assistant-chats-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.assistant-chat-item {
    background: var(--surface-panel);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.assistant-chat-item:hover {
    background: rgba(242, 100, 25, 0.1);
}

.assistant-chat-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.assistant-chat-item-title {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
    overflow: hidden;
    white-space: nowrap;
}

.assistant-chat-item-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.assistant-chat-item-download,
.assistant-chat-item-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.assistant-chat-item-download:hover,
.assistant-chat-item-delete:hover {
    color: var(--brand-orange);
}

.assistant-chat-item-download svg,
.assistant-chat-item-delete svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

.assistant-chat-item-preview {
    font-size: 12px;
    color: var(--brand-orange);
    font-weight: 400;
    line-height: 1.4;
}

/* Help Content Styling */
.assistant-help-content {
    padding: 20px;
}

.assistant-help-content h3 {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 20px 0 12px 0;
}

.assistant-help-content h3:first-child {
    margin-top: 0;
}

.assistant-help-content p {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 12px;
}

.assistant-help-content ul {
    list-style: none;
    padding: 0;
    margin: 0 0 12px 0;
}

.assistant-help-content li {
    font-size: 14px;
    color: #666;
    line-height: 1.8;
    padding-left: 20px;
    position: relative;
}

.assistant-help-content li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--brand-orange);
    font-weight: bold;
}

/* ========================================
   CASE GUIDE STYLES
   ======================================== */

/* Case Guide Modal Override */
.case-guide-modal {
    max-width: 700px;
    max-height: 90vh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

/* Case Guide Body - Scrollable Content */
.case-guide-body {
    overflow-y: auto;
    flex: 1;
    padding: 0;
    scroll-behavior: smooth;
}

/* Case Guide Section Divider */
.case-guide-divider {
    border: none;
    border-top: 1px solid #e5e5e5;
    margin: 0 24px;
}

/* Case Guide Section */
.case-guide-section {
    border-bottom: none;
}

.case-guide-section:last-child {
    border-bottom: none;
}

/* Case Thesis Section */
.case-guide-thesis {
    background: transparent;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e5e5;
}

.case-guide-thesis-content {
    font-size: 14px;
    line-height: 1.7;
    color: #2c3e50;
    font-weight: 400;
}

/* Thesis Section Headings with Icons */
.thesis-section-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 16px 0 8px 0;
}

.thesis-section:first-child .thesis-section-heading {
    margin-top: 0;
}

.thesis-section-heading svg {
    width: 16px;
    height: 16px;
    stroke: #666;
    flex-shrink: 0;
}

/* Divider between Case Structure and Evidence Timeline */
.thesis-section-divider {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 16px 0 0 0;
}

/* Section Headers */
.case-guide-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 24px;
    background: #fff;
    cursor: default;
    border-bottom: none;
}

.section-title-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    color: #1e3a5f;
    padding: 6px 0;
    border-radius: 0;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: lowercase;
}

.section-title-box i {
    color: #1e3a5f;
}

.section-title-box i,
.section-title-box svg {
    width: 16px;
    height: 16px;
}

.section-title {
    font-size: 11px;
    font-weight: 700;
    color: #7f8c8d;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.violation-count {
    font-size: 12px;
    color: #ffffff;
    font-weight: 700;
    background: #1e3a5f;
    padding: 2px 8px;
    border-radius: 10px;
}

.expand-all-btn {
    background: transparent;
    border: none;
    padding: 0;
    font-size: 11px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    text-decoration: none;
}

.expand-all-btn:hover {
    color: var(--brand-orange);
}

/* Section Content */
.case-guide-section-content {
    padding: 0 24px 16px;
}

/* Phase Groups */
.phase-group {
    margin-bottom: 2px;
}

.phase-group:last-child {
    margin-bottom: 0;
}

.phase-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    background: transparent;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.phase-header:hover {
    background: transparent;
}

.phase-header:hover .phase-title {
    color: var(--brand-orange);
}

.phase-arrow {
    color: #1e3a5f;
    transition: all 0.2s ease;
    width: 14px;
    height: 14px;
}

.phase-header.expanded .phase-arrow {
    color: var(--brand-orange);
}

.phase-header.expanded .phase-title {
    color: var(--brand-orange);
}

.phase-title {
    font-size: 12px;
    font-weight: 600;
    color: #1e3a5f;
}

/* Phase Content - Collapsible */
.phase-content {
    display: none;
    padding: 12px 0 12px 20px;
}

.phase-content.expanded {
    display: block;
}

/* Evidence Items */
.evidence-item {
    padding: 14px;
    margin-bottom: 10px;
    background: transparent;
    border: none;
    border-radius: 0;
    transition: all 0.2s ease;
}

.evidence-item:last-child {
    margin-bottom: 0;
}

.evidence-item:hover {
    background: #e5e7e6;
}

.evidence-item-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
}

.evidence-eid {
    font-size: 10px;
    font-weight: 700;
    color: #ffffff;
    background: #1e3a5f;
    padding: 3px 7px;
    border-radius: 4px;
    letter-spacing: 0.3px;
}

.evidence-title {
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    flex: 1;
    line-height: 1.3;
}

.smoking-gun-marker {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.smoking-gun-marker i,
.smoking-gun-marker svg {
    width: 14px;
    height: 14px;
    stroke: #1e3a5f;
    stroke-width: 2;
    fill: none;
}

.evidence-pitch {
    font-size: 12px;
    line-height: 1.6;
    color: #5d6d7e;
    margin-bottom: 10px;
}

/* Query This Link */
.query-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    color: var(--brand-orange);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 4px 8px;
    border-radius: 4px;
    margin-left: -4px;
}

.query-link:hover {
    color: #d55a10;
    background: rgba(242, 100, 25, 0.08);
}

.query-link-arrow {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.query-link:hover .query-link-arrow {
    transform: translateX(2px);
}

/* Violation Pattern Groups */
.pattern-group {
    margin-bottom: 2px;
}

.pattern-group:last-child {
    margin-bottom: 0;
}

.pattern-group-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    background: transparent;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.pattern-group-header:hover {
    background: transparent;
}

.pattern-group-header:hover .pattern-group-title {
    color: var(--brand-orange);
}

.pattern-group-header.expanded .phase-arrow {
    color: var(--brand-orange);
}

.pattern-group-header.expanded .pattern-group-title {
    color: var(--brand-orange);
}

.pattern-group-title {
    font-size: 12px;
    font-weight: 600;
    color: #1e3a5f;
}

/* Pattern Group Content - Collapsible */
.pattern-group-content {
    display: none;
    padding: 12px 0 12px 20px;
}

.pattern-group-content.expanded {
    display: block;
}

/* Violation Pattern Items */
.violation-pattern-item {
    padding: 14px;
    margin-bottom: 10px;
    background: transparent;
    border: none;
    border-radius: 0;
    transition: all 0.2s ease;
}

.violation-pattern-item:last-child {
    margin-bottom: 0;
}

.violation-pattern-item:hover {
    background: rgba(242, 100, 25, 0.03);
}

.pattern-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.pattern-name {
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
}

.pattern-count {
    font-size: 12px;
    font-weight: 700;
    color: var(--brand-orange);
    background: rgba(242, 100, 25, 0.08);
    padding: 2px 8px;
    border-radius: 10px;
}

.pattern-bureaus {
    font-size: 11px;
    color: #7f8c8d;
    margin-bottom: 8px;
}

.pattern-description {
    font-size: 12px;
    line-height: 1.6;
    color: #5d6d7e;
    margin-bottom: 10px;
}

/* Creditor List */
.creditor-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.creditor-tag {
    font-size: 10px;
    padding: 4px 8px;
    background: #f5f6f7;
    border-radius: 4px;
    color: #5d6d7e;
    border: 1px solid #e8e8e8;
}

.creditor-tag-count {
    font-weight: 700;
    color: #2c3e50;
}

/* View in Report Link */
.view-in-report-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    color: #7f8c8d;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 4px 8px;
    border-radius: 4px;
    margin-left: -4px;
}

.view-in-report-link:hover {
    color: var(--brand-orange);
    background: rgba(242, 100, 25, 0.05);
}

/* ====================================== */
/* 9-Category Violation Patterns Table   */
/* ====================================== */

.violation-patterns-lead {
    font-size: 12px;
    color: #5d6d7e;
    line-height: 1.6;
    margin-bottom: 16px;
    padding: 0 4px;
}

.violation-categories-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.violation-categories-table thead {
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}

.violation-categories-table th {
    padding: 10px 12px;
    font-weight: 600;
    color: #495057;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.violation-categories-table th.text-right,
.violation-categories-table td.text-right {
    text-align: right;
}

.violation-categories-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s ease;
}

.violation-categories-table tbody tr:hover {
    background: #e5e7e6;
}

.violation-categories-table tbody tr:last-child {
    border-bottom: none;
}

.violation-categories-table td {
    padding: 10px 12px;
    color: #2c3e50;
}

.violation-categories-table .category-name {
    font-weight: 500;
}

.violation-categories-table tfoot {
    background: #f8f9fa;
    border-top: 2px solid #e9ecef;
}

.violation-categories-table tfoot td {
    padding: 12px;
    font-weight: 600;
}

/* Severity color coding */
.severity-cell {
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.severity-cell.severity-extreme {
    color: #DC2626;
}

.severity-cell.severity-severe {
    color: #EA580C;
}

.severity-cell.severity-serious {
    color: #CA8A04;
}

/* Row highlighting for severity */
.category-row.severity-extreme {
    border-left: 3px solid #DC2626;
}

.category-row.severity-severe {
    border-left: 3px solid #EA580C;
}

.category-row.severity-serious {
    border-left: 3px solid #CA8A04;
}

/* ====================================== */
/* End Violation Patterns Table          */
/* ====================================== */

/* Legal Theory Items */
.legal-theory-item {
    padding: 14px;
    margin-bottom: 10px;
    background: transparent;
    border: none;
    border-radius: 0;
    transition: all 0.2s ease;
}

.legal-theory-item:last-child {
    margin-bottom: 0;
}

.legal-theory-item:hover {
    background: #e5e7e6;
}

.theory-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
}

.theory-eid {
    font-size: 10px;
    font-weight: 700;
    color: #ffffff;
    background: #f26419;
    padding: 3px 7px;
    border-radius: 4px;
    letter-spacing: 0.3px;
}

.theory-title {
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.3;
}

.theory-pitch {
    font-size: 12px;
    line-height: 1.6;
    color: #5d6d7e;
    margin-bottom: 10px;
}

/* ========================================
   CASE GUIDE MOBILE STYLES
   ======================================== */

@media (max-width: 768px) {
    /* Full-screen modal on mobile */
    .case-guide-modal {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    /* Larger touch targets */
    .phase-header,
    .pattern-group-header {
        padding: 14px 12px;
        min-height: 44px;
    }

    .expand-all-btn {
        padding: 8px 12px;
        font-size: 12px;
        min-height: 44px;
    }

    /* Full-width query links for easier tapping */
    .query-link {
        display: flex;
        justify-content: center;
        padding: 10px;
        background: rgba(242, 100, 25, 0.1);
        border-radius: 4px;
        font-size: 12px;
        min-height: 44px;
        align-items: center;
    }

    .view-in-report-link {
        display: flex;
        justify-content: center;
        padding: 10px;
        background: #f5f5f5;
        border-radius: 4px;
        font-size: 12px;
        min-height: 44px;
        align-items: center;
    }

    /* Prevent auto-zoom with 16px base font */
    .case-guide-body {
        font-size: 16px;
    }

    .evidence-pitch,
    .theory-pitch {
        font-size: 14px;
    }

    .evidence-title,
    .theory-title,
    .pattern-name,
    .phase-title,
    .pattern-group-title {
        font-size: 15px;
    }

    /* Adjust spacing */
    .case-guide-section-header {
        padding: 14px 16px;
    }

    .case-guide-section-content {
        padding: 0 16px 16px;
    }

    .case-guide-thesis {
        padding: 16px;
    }

    .evidence-item,
    .violation-pattern-item,
    .legal-theory-item {
        padding: 14px;
    }
}

/* Chat Popup Overlay */
.assistant-chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.assistant-chat-modal {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    font-family: 'Space Grotesk', sans-serif;
}

/* Chat Header */
.assistant-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e5e5;
}

.assistant-chat-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
}

.assistant-chat-close {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.assistant-chat-close:hover {
    color: #1a1a1a;
}

.assistant-chat-close svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

/* Export Button (PDF download) */
.assistant-chat-export {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, opacity 0.2s ease;
    margin-left: auto;
    margin-right: 8px;
}

.assistant-chat-export:hover {
    color: var(--brand-orange, #f97316);
}

.assistant-chat-export svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.assistant-chat-export:disabled,
.assistant-chat-export.exporting {
    opacity: 0.5;
    cursor: not-allowed;
}

.assistant-chat-export.exporting svg {
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Chat Messages Area */
.assistant-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.assistant-message {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.assistant-message-user {
    font-size: 14px;
    color: var(--brand-orange);
    font-weight: 600;
    line-height: 1.5;
    background: #f0f0f0;
    border-radius: 16px;
    padding: 12px 16px;
    display: inline-block;
    max-width: fit-content;
}

.assistant-message-assistant {
    font-size: 14px;
    color: #1a1a1a;
    font-weight: 400;
    line-height: 1.6;
    white-space: pre-line;
}

.assistant-message-assistant em {
    font-size: 80%;
    font-style: italic;
}

/* Chat Input Area */
.assistant-chat-input-area {
    display: flex;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid #e5e5e5;
}

.assistant-chat-input {
    flex: 1;
    background: #f5f5f5;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    font-family: 'Space Grotesk', sans-serif;
    color: #1a1a1a;
}

.assistant-chat-input:focus {
    outline: none;
    border-color: var(--brand-orange);
    background: #ffffff;
}

.assistant-chat-input::placeholder {
    color: #999;
}

.assistant-chat-send {
    width: 44px;
    height: 44px;
    background: var(--brand-orange);
    border: none;
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.assistant-chat-send:hover {
    background: #d95614;
    transform: translateY(-1px);
}

.assistant-chat-send:active {
    transform: translateY(0);
}

.assistant-chat-send svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .assistant-chat-modal {
        width: 95%;
        max-width: 95%;
        max-height: 90vh;
    }

    .assistant-chat-header {
        padding: 16px 20px;
    }

    .assistant-chat-title {
        font-size: 16px;
    }

    .assistant-chat-messages {
        padding: 20px;
    }

    .assistant-chat-input-area {
        padding: 12px 20px;
    }
}
