/* CSS Custom Properties - Design System */
:root {
    /* Color Palette */
    --color-bg-primary: #0f1419;
    --color-bg-secondary: #1a202c;
    --color-bg-tertiary: #2d3748;
    --color-bg-hover: #2d3748;
    
    /* Text Colors */
    --color-text-primary: #e2e8f0;
    --color-text-secondary: #cbd5e0;
    --color-text-muted: #a0aec0;
    
    /* Border Colors */
    --color-border-primary: #4a5568;
    --color-border-secondary: #2d3748;
    
    /* Brand Colors */
    --color-brand-primary: #667eea;
    --color-brand-secondary: #5a67d8;
    
    /* Status Colors */
    --color-success: #38a169;
    --color-error: #e53e3e;
    --color-warning: #d69e2e;
    --color-info: #3182ce;
    
    /* Spacing Scale */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 4rem;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 50px;
    
    /* Shadows */
    --shadow-sm: 0 4px 15px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.3);
    
    /* Typography */
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.85rem;
    --font-size-md: 0.95rem;
    --font-size-lg: 1.3rem;
    --font-size-xl: 1.5rem;
    
    /* Breakpoints */
    --breakpoint-sm: 640px;
    --breakpoint-md: 1024px;
    --breakpoint-lg: 1200px;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--color-text-primary);
    background: var(--color-bg-primary);
    min-height: 100vh;
    overflow-x: hidden;
}


/* Main layout */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-md);
    min-height: 100vh;
}

/* Left sidebar */
.test-sidebar {
    flex: 0 0 350px;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    height: fit-content;
    position: sticky;
    top: 2rem;
}

.test-sidebar h2 {
    margin-bottom: 1rem;
    color: var(--color-text-secondary);
    font-size: var(--font-size-lg);
}

.search-box {
    margin-bottom: 1.5rem;
}

.search-box input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--color-border-primary);
    border-radius: var(--radius-md);
    font-size: var(--font-size-md);
    transition: border-color 0.2s;
    background: var(--color-bg-tertiary);
    color: #e2e8f0;
}

.search-box input:focus {
    outline: none;
    border-color: var(--color-brand-primary);
}

/* Test tree */
.test-tree {
    font-size: var(--font-size-md);
}

.test-item {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    border-left: 4px solid transparent;
}

.test-item:hover {
    background: var(--color-bg-tertiary);
    border-left-color: #667eea;
}

.test-item.active {
    background: var(--color-brand-primary);
    color: white;
    border-left-color: #4c63d2;
}

.test-item .test-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.test-item .test-path {
    font-size: var(--font-size-sm);
    opacity: 0.7;
}

.test-item .test-status {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-xs);
    font-weight: 600;
    margin-top: 0.5rem;
}

.test-status.passed {
    background: var(--color-success);
    color: #ffffff;
}

.test-status.failed {
    background: var(--color-error);
    color: #ffffff;
}

/* Video section */
.video-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.video-container {
    background: var(--color-bg-secondary);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.placeholder {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--color-text-muted);
}

.placeholder h3 {
    margin-bottom: 1rem;
    font-size: var(--font-size-xl);
}

.video-player {
    width: 100%;
    height: auto;
    max-height: calc(100vh - 6rem);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.video-info {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #4a5568;
}

.video-info h3 {
    color: var(--color-text-secondary);
    margin-bottom: 0.5rem;
}

.video-info .timestamp {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

/* Transcript section */
.transcript-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.transcript-container h3 {
    color: var(--color-text-secondary);
    margin-bottom: 1rem;
}

.transcript-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.btn-secondary {
    padding: 0.5rem 1rem;
    border: 2px solid var(--color-border-primary);
    background: var(--color-bg-tertiary);
    color: #e2e8f0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--font-size-sm);
    transition: all 0.2s;
}

.btn-secondary:hover {
    border-color: var(--color-brand-primary);
    background: #4a5568;
}

.btn-secondary.active {
    background: var(--color-brand-primary);
    color: white;
    border-color: var(--color-brand-primary);
}

.transcript-search {
    margin-bottom: 1rem;
}

.transcript-search input {
    width: 100%;
    padding: 0.5rem;
    border: 2px solid var(--color-border-primary);
    border-radius: var(--radius-sm);
    background: var(--color-bg-tertiary);
    color: #e2e8f0;
}

.transcript-content {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.transcript-entry {
    display: flex;
    gap: 1rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color 0.2s, border-left-color 0.2s;
    border-left: 4px solid transparent;
    background: transparent;
    align-items: flex-start;
}

.transcript-entry:hover {
    background: var(--color-bg-tertiary);
}

.transcript-entry.active {
    background: var(--color-bg-tertiary);
    border-left-color: #667eea;
}

.transcript-entry.fading-out {
    background: transparent;
    border-left-color: transparent;
    transition: background-color 3s ease-out, border-left-color 3s ease-out;
}

.transcript-timestamp {
    flex: 0 0 80px;
    font-family: monospace;
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    font-weight: 600;
}

.transcript-type {
    flex: 0 0 80px;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    text-align: center;
}

.transcript-type.ACT {
    background: transparent;
    color: var(--color-info);
    border: 1.5px solid var(--color-info);
}

.transcript-type.CHECK {
    background: transparent;
    color: var(--color-success);
    border: 1.5px solid var(--color-success);
}

.transcript-type.THOUGHT {
    background: transparent;
    color: var(--color-error);
    border: 1.5px solid var(--color-error);
}

.transcript-type.NAV {
    background: transparent;
    color: var(--color-warning);
    border: 1.5px solid var(--color-warning);
}

.transcript-text {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.4;
}

.transcript-result {
    flex: 0 0 auto;
    font-size: var(--font-size-xs);
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-lg);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-left: 0.5rem;
}

.transcript-result.passed {
    background: var(--color-success);
    color: #ffffff;
}

.transcript-result.failed {
    background: var(--color-error);
    color: #ffffff;
}

/* Tests Overview Styles */
.tests-overview {
    background: var(--color-bg-secondary);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.overview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 2rem;
}

.overview-header h2 {
    color: var(--color-text-secondary);
    margin: 0;
    font-size: var(--font-size-xl);
}

.overview-header .search-box {
    flex: 0 0 300px;
    margin: 0;
}

.tests-table-container {
    overflow-x: auto;
}

.tests-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-md);
}

.tests-table th {
    background: var(--color-bg-tertiary);
    padding: var(--spacing-md);
    text-align: left;
    font-weight: 600;
    color: var(--color-text-secondary);
    border-bottom: 2px solid #4a5568;
}

.tests-table td {
    padding: var(--spacing-md);
    border-bottom: 1px solid #4a5568;
    vertical-align: middle;
}


/* Folder and Test Row Styles */
.test-row, .folder-row {
    transition: background-color 0.2s;
}

.test-row:hover, .folder-row:hover {
    background: var(--color-bg-hover);
}

.folder-row {
    cursor: pointer;
    user-select: none;
}

.folder-row:hover {
    background: var(--color-bg-hover);
}

.folder-name-cell, .test-name-cell {
    display: flex;
    align-items: center;
}

.indent {
    display: inline-block;
    font-family: monospace;
    color: var(--color-text-muted);
}

.expand-icon {
    display: inline-block;
    margin-right: 0.5rem;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    transition: transform 0.2s;
    width: 16px;
    text-align: center;
}

.folder-name-cell {
    font-weight: 600;
    color: var(--color-text-secondary);
}

.folder-path-cell,
.folder-status-cell,
.folder-timestamp-cell,
.folder-actions-cell {
    color: var(--color-text-muted);
}

.folder-status-cell .status-badge {
    opacity: 0.8;
}

.test-name-cell {
    font-weight: 600;
    color: #e2e8f0;
}

.test-path-cell {
    color: var(--color-text-muted);
    font-family: monospace;
    font-size: var(--font-size-sm);
}

.status-badge {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.status-badge.passed {
    background: var(--color-success);
    color: #ffffff;
}

.status-badge.failed {
    background: var(--color-error);
    color: #ffffff;
}

.status-badge.unknown {
    background: #4a5568;
    color: var(--color-text-secondary);
}

.test-timestamp {
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

.watch-btn {
    background: var(--color-brand-primary);
    color: white;
    border: 2px solid #667eea;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.watch-btn:hover {
    background: var(--color-brand-secondary);
    border-color: var(--color-brand-secondary);
}

.no-tests {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--color-text-muted);
}

.no-tests h3 {
    margin-bottom: 1rem;
    font-size: var(--font-size-xl);
}

.no-tests code {
    background: var(--color-bg-tertiary);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

/* Watch Page Styles */

.watch-container {
    margin: 0;
    padding: var(--spacing-md);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: start;
    min-height: 100vh;
    width: 100vw;
    box-sizing: border-box;
}

.video-section {
    background: var(--color-bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-md);
    height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
}

.transcript-section {
    background: var(--color-bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-md);
    height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.loading-placeholder {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--color-text-muted);
}

.video-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 0.5rem;
}

.transcript-header {
    margin-bottom: 1rem;
}

.transcript-header h3 {
    margin-bottom: 1rem;
    color: var(--color-text-secondary);
}

/* Reusable Component Classes */

/* Card Components */
.card {
    background: var(--color-bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
}

.card-compact {
    background: var(--color-bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-md);
}

/* Badge Components */
.badge {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-success { background: var(--color-success); color: white; }
.badge-error { background: var(--color-error); color: white; }
.badge-warning { background: var(--color-warning); color: white; }
.badge-info { background: var(--color-info); color: white; }
.badge-muted { background: var(--color-border-primary); color: var(--color-text-secondary); }

.badge-outline {
    background: transparent;
    border: 1.5px solid;
}

.badge-outline.badge-success { color: var(--color-success); border-color: var(--color-success); }
.badge-outline.badge-error { color: var(--color-error); border-color: var(--color-error); }
.badge-outline.badge-warning { color: var(--color-warning); border-color: var(--color-warning); }
.badge-outline.badge-info { color: var(--color-info); border-color: var(--color-info); }

/* Button Components */
.btn {
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    border: 2px solid transparent;
}

.btn-primary {
    background: var(--color-brand-primary);
    color: white;
    border-color: var(--color-brand-primary);
}

.btn-primary:hover {
    background: var(--color-brand-secondary);
    border-color: var(--color-brand-secondary);
}

.btn-secondary {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    border-color: var(--color-border-primary);
}

.btn-secondary:hover {
    border-color: var(--color-brand-primary);
    background: var(--color-bg-hover);
}

.btn-secondary.active {
    background: var(--color-brand-primary);
    color: white;
    border-color: var(--color-brand-primary);
}

/* Input Components */
.input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--color-border-primary);
    border-radius: var(--radius-md);
    font-size: var(--font-size-md);
    transition: border-color 0.2s;
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}

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

/* Spacing Utilities */
.mb-xs { margin-bottom: var(--spacing-xs); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mb-xl { margin-bottom: var(--spacing-xl); }

.p-xs { padding: var(--spacing-xs); }
.p-sm { padding: var(--spacing-sm); }
.p-md { padding: var(--spacing-md); }
.p-lg { padding: var(--spacing-lg); }
.p-xl { padding: var(--spacing-xl); }

/* Responsive design */
@media (max-width: var(--breakpoint-lg)) {
    .watch-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .transcript-section {
        max-height: 60vh;
    }
}

@media (max-width: var(--breakpoint-md)) {
    .overview-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .overview-header .search-box {
        flex: none;
    }
}

@media (max-width: var(--breakpoint-sm)) {
    header h1 {
        font-size: 2rem;
    }
    
    .container,
    .watch-container {
        padding: 0 0.5rem;
        gap: 1rem;
    }
    
    .tests-overview,
    .video-section,
    .transcript-section {
        padding: var(--spacing-md);
    }
    
    .tests-table th,
    .tests-table td {
        padding: 0.75rem 0.5rem;
    }
    
}