:root {
    --primary-color: #dc2626;
    --primary-dark: #991b1b;
    --secondary-color: #ef4444;
    --accent-color: #b91c1c;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #dc2626;
    --info-color: #dc2626;

    --bg-color: #0a0a0a;
    --surface-color: #1a1a1a;
    --border-color: #2a2a2a;
    --text-primary: #f5f5f5;
    --text-secondary: #a3a3a3;
    --text-muted: #737373;

    --gradient-primary: linear-gradient(135deg, #1a1a1a 0%, #dc2626 100%);
    --gradient-secondary: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    --gradient-success: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    --gradient-info: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);

    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    --transition-fast: 150ms ease-in-out;
    --transition-base: 250ms ease-in-out;
    --transition-slow: 350ms ease-in-out;
}

* {
    box-sizing: border-box;
}

body {
    background: var(--bg-color);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
}

.form-label, .form-text, .form-check-label {
    color: var(--text-secondary) !important;
}

.card-body {
    color: var(--text-primary);
}

.text-muted {
    color: var(--text-muted) !important;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-lg);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.header {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header h1 {
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.config-section {
    padding: var(--spacing-xl) 0;
    animation: fadeIn var(--transition-base);
}

.config-card {
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
    background: var(--surface-color);
    height: 100%;
}

.config-card:hover {
    box-shadow: var(--shadow-xl);
}

.config-card .card-title {
    color: var(--primary-color);
    font-weight: 600;
}

.divider-text {
    text-align: center;
    position: relative;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.divider-text::before,
.divider-text::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 45%;
    height: 1px;
    background: var(--border-color);
}

.divider-text::before {
    left: 0;
}

.divider-text::after {
    right: 0;
}

.upload-area {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    transition: all var(--transition-base);
    background: var(--bg-color);
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(220, 38, 38, 0.05);
}

.upload-area input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-placeholder {
    text-align: center;
    color: var(--text-muted);
    pointer-events: none;
}

.file-info {
    padding: var(--spacing-sm);
    background: var(--bg-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    display: none;
}

.file-info.active {
    display: block;
}

.file-preview {
    margin-top: var(--spacing-md);
}

.file-preview-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--surface-color);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}

.file-preview-content:hover {
    box-shadow: var(--shadow-md);
}

.file-preview-content > i {
    color: var(--primary-color);
    flex-shrink: 0;
}

.file-preview-info {
    flex: 1;
    min-width: 0;
}

.file-preview-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-preview-size {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.file-remove-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.file-remove-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.file-remove-btn:active {
    transform: scale(0.95);
}

.form-select,
.form-control {
    border-radius: var(--radius-md);
    border-color: var(--border-color);
    transition: all var(--transition-fast);
    background-color: var(--surface-color);
    color: var(--text-primary);
}

.form-select:focus,
.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
    background-color: var(--surface-color);
    color: var(--text-primary);
}

.form-select option {
    background-color: var(--surface-color);
    color: var(--text-primary);
}

.btn-primary {
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-lg);
    font-weight: 600;
    padding: var(--spacing-md) var(--spacing-lg);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    box-shadow: var(--shadow-md);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.results-section {
    padding: var(--spacing-xl) 0;
    animation: slideUp var(--transition-slow);
    min-height: calc(100vh - 200px);
}

.stats-bar {
    background: var(--surface-color);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
}

.stat-badge {
    display: inline-flex;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-color);
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
}

.stat-badge strong {
    color: var(--text-primary);
    margin-left: var(--spacing-xs);
}

.summary-card .card {
    border: none;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    background: var(--surface-color);
}

.summary-card .card-body {
    background: var(--surface-color);
}

.summary-card .card-header {
    background: var(--gradient-info);
    color: white;
    cursor: pointer;
    user-select: none;
    transition: background var(--transition-fast);
}

.summary-card .card-header:hover {
    opacity: 0.9;
}

.results-sidebar .card {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--spacing-lg);
    background: var(--surface-color);
}

.results-sidebar .card-body {
    background: var(--surface-color);
}

.results-sidebar .card-header {
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    font-weight: 600;
}

.topic-chip {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-md);
    background: var(--gradient-info);
    color: white;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    margin: var(--spacing-xs);
    box-shadow: var(--shadow-sm);
    animation: fadeIn var(--transition-base);
}

.participant-card {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-fast);
}

.participant-card:last-child {
    border-bottom: none;
}

.participant-card:hover {
    background: var(--bg-color);
}

.participant-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.25rem;
    margin-right: var(--spacing-md);
    box-shadow: var(--shadow-md);
}

.participant-role {
    display: inline-block;
    padding: 2px 8px;
    background: var(--gradient-secondary);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: var(--spacing-sm);
}

.sentiment-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    margin-left: var(--spacing-sm);
}

.sentiment-positive {
    background: var(--gradient-success);
    color: white;
}

.sentiment-neutral {
    background: var(--text-muted);
    color: white;
}

.sentiment-negative {
    background: var(--gradient-secondary);
    color: white;
}

.sentiment-table {
    width: 100%;
    font-size: 0.875rem;
    border-collapse: separate;
    border-spacing: 0 4px;
}

.sentiment-table td {
    padding: 4px 8px;
    background: var(--bg-color);
}

.sentiment-table td:first-child {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    font-weight: 500;
}

.sentiment-table td:last-child {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    text-align: right;
}

.behavior-group {
    background: var(--bg-color);
    padding: var(--spacing-sm);
    border-radius: var(--radius-md);
}

.behavior-name-small {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: var(--spacing-xs);
}

.behavior-clips-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.behavior-clip-item {
    padding: var(--spacing-xs);
    background: var(--surface-color);
    border-left: 2px solid var(--primary-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.75rem;
}

.behavior-clip-item:hover {
    background: rgba(220, 38, 38, 0.1);
    transform: translateX(2px);
}

.behavior-clip-time {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.7rem;
    margin-bottom: 2px;
}

.behavior-clip-text {
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.3;
}

.detection-card {
    border: none;
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    background: var(--surface-color);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    animation: fadeIn var(--transition-base);
}

.detection-card:hover {
    box-shadow: var(--shadow-lg);
}

.detection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.detection-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.confidence-badge {
    position: relative;
    width: 60px;
    height: 60px;
}

.confidence-circle {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.confidence-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 700;
    font-size: 1rem;
    color: var(--primary-color);
}

.evidence-list {
    list-style: none;
    padding: 0;
    margin: var(--spacing-md) 0 0;
}

.evidence-item {
    padding: var(--spacing-md);
    background: var(--bg-color);
    border-left: 3px solid var(--primary-color);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.evidence-item:hover {
    background: rgba(220, 38, 38, 0.05);
    transform: translateX(4px);
}

.evidence-timestamp {
    display: inline-block;
    padding: 2px 8px;
    background: var(--primary-color);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: var(--spacing-sm);
}

.evidence-quote {
    color: var(--text-secondary);
    font-style: italic;
    display: block;
    margin-top: var(--spacing-xs);
}

.results-section .card {
    background: var(--surface-color);
}

.results-section .card-body {
    background: var(--surface-color);
}

.results-section .card-header {
    background: var(--gradient-primary);
    color: white;
    border: none;
    font-weight: 600;
}

.transcript-container {
    max-height: 800px;
    overflow-y: auto;
    padding: var(--spacing-lg);
    background: var(--bg-color);
}

.transcript-clip {
    display: flex;
    margin-bottom: var(--spacing-lg);
    animation: slideIn var(--transition-base);
    opacity: 0;
    animation-fill-mode: forwards;
}

.clip-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    margin-right: var(--spacing-md);
    flex-shrink: 0;
    box-shadow: var(--shadow-md);
}

.clip-content {
    flex: 1;
    background: var(--surface-color);
    padding: var(--spacing-md);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
}

.clip-content:hover {
    box-shadow: var(--shadow-md);
}

.clip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.clip-speaker {
    font-weight: 600;
    color: var(--text-primary);
}

.clip-timestamp {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.clip-text {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--spacing-sm);
}

.clip-badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-sm);
}

.clip-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--gradient-info);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 600;
}

.evidence-marker {
    background: var(--gradient-secondary);
    padding: 4px 12px;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    margin-top: var(--spacing-sm);
    display: inline-block;
}

.clip-content.is-evidence {
    border-left: 4px solid var(--accent-color);
    background: rgba(220, 38, 38, 0.05);
}

.pii-phi-highlight {
    background-color: rgba(255, 193, 7, 0.3);
    padding: 2px 4px;
    border-radius: 3px;
    cursor: help;
    position: relative;
    border-bottom: 2px dotted rgba(255, 193, 7, 0.8);
}

.pii-phi-highlight::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    font-size: 0.75rem;
    white-space: nowrap;
    border-radius: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    margin-bottom: 4px;
}

.pii-phi-highlight:hover::after {
    opacity: 1;
}

.models-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--spacing-sm);
    max-height: 400px;
    overflow-y: auto;
    padding: var(--spacing-sm);
    background: var(--bg-color);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.model-category-header {
    grid-column: 1 / -1;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-top: var(--spacing-md);
    margin-bottom: var(--spacing-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.model-category-header:first-child {
    margin-top: 0;
}

.model-toggle {
    position: relative;
    display: flex;
    align-items: center;
    padding: var(--spacing-md);
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
}

.model-toggle:hover {
    border-color: var(--primary-color);
    background: rgba(220, 38, 38, 0.05);
}

.model-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.model-toggle.selected {
    border-color: var(--primary-color);
    background: var(--gradient-secondary);
    color: white;
}

.model-toggle .model-name {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
}

.model-toggle .check-icon {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    margin-right: var(--spacing-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    background: var(--bg-color);
}

.model-toggle.selected .check-icon {
    background: white;
    border-color: white;
}

.model-toggle.selected .check-icon::after {
    content: '✓';
    color: var(--primary-color);
    font-weight: bold;
    font-size: 14px;
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-color) 25%, var(--border-color) 50%, var(--bg-color) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.spinner-border {
    color: var(--primary-color);
}

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (max-width: 768px) {
    .config-section {
        padding: var(--spacing-md) 0;
    }

    .stats-bar .row {
        justify-content: center;
    }

    .stat-badge {
        font-size: 0.8rem;
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    .transcript-container {
        max-height: 600px;
    }
}

.d-none {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-2 { margin-top: var(--spacing-sm); }
.mt-3 { margin-top: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-lg); }
.py-3 { padding-top: var(--spacing-md); padding-bottom: var(--spacing-md); }
