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

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --bg-color: #f9fafb;
    --sidebar-bg: #1f2937;
    --sidebar-hover: #374151;
    --card-bg: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar - Hidden */
.sidebar {
    display: none;
}

/* Main Content */
.main-content {
    margin-left: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
}

/* Top Bar */
.top-bar {
    background: var(--card-bg);
    padding: 20px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar::before {
    content: '🎥 AudioSense Dashboard';
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-right: 32px;
}

.search-container {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-container i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-container input {
    width: 100%;
    padding: 10px 10px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.search-container input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.sort-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-container label {
    font-size: 14px;
    color: var(--text-secondary);
}

.sort-container select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.icon-btn {
    padding: 8px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

.icon-btn.delete-btn:hover {
    color: var(--danger-color);
}

/* Table Container */
.table-container {
    flex: 1;
    padding: 32px;
    overflow-x: auto;
    width: 100%;
}

.data-table {
    width: 100%;
    min-width: 1400px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
}

.data-table thead {
    background: #f3f4f6;
}

.data-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr {
    border-top: 1px solid var(--border-color);
    transition: background 0.2s;
}

.data-table tbody tr:hover {
    background: #f9fafb;
}

.data-table td {
    padding: 16px;
    font-size: 14px;
}

/* Video Name */
.video-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.video-name i {
    color: var(--primary-color);
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-initializing {
    background: #dbeafe;
    color: #1e40af;
}

.status-extracting-audio {
    background: #fef3c7;
    color: #92400e;
}

.status-transcribing {
    background: #e0e7ff;
    color: #4338ca;
}

.status-tagging {
    background: #ddd6fe;
    color: #5b21b6;
}

.status-finalizing {
    background: #fce7f3;
    color: #9f1239;
}

.status-completed {
    background: #d1fae5;
    color: #065f46;
}

.status-failed {
    background: #fee2e2;
    color: #991b1b;
}

.status-retrying {
    background: #fed7aa;
    color: #9a3412;
    animation: pulse-retry 2s ease-in-out infinite;
}

@keyframes pulse-retry {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Transcription Preview */
.transcription-preview {
    max-width: 300px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.text-btn {
    margin-top: 4px;
    padding: 4px 8px;
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

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

/* Tags */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.tag-keyword {
    background: #dbeafe;
    color: #1e40af;
}

.tag-semantic {
    background: #e0e7ff;
    color: #4338ca;
}

.tag-more {
    background: #f3f4f6;
    color: var(--text-secondary);
}

/* Processing Text */
.processing-text {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.processing-text i {
    font-size: 12px;
}

/* Error Text */
.error-text {
    color: var(--danger-color);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.error-text i {
    font-size: 12px;
}

/* Score */
.score {
    font-weight: 600;
    color: var(--success-color);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* Empty State */
.empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.empty-state i {
    font-size: 64px;
    color: var(--text-secondary);
    opacity: 0.5;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-large {
    max-width: 800px;
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
}

.close-btn {
    padding: 8px;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
}

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

.modal-body {
    padding: 24px;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.02);
}

.upload-area.drag-over {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.05);
}

.upload-area i {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 16px;
}

.upload-area h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.upload-area p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Upload Progress */
#uploadProgress {
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.3s;
    animation: progress-animation 1.5s infinite;
}

@keyframes progress-animation {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 20px 0;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Modal Actions */
.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* Transcription Content */
.transcription-content {
    max-height: 60vh;
    overflow-y: auto;
}

.transcript-segment {
    padding: 16px;
    border-left: 3px solid var(--primary-color);
    margin-bottom: 16px;
    background: var(--bg-color);
    border-radius: 8px;
}

.timestamp {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-color);
    display: block;
    margin-bottom: 8px;
}

.transcript-segment p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 1024px) {
    .table-container {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
    }
    
    .top-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .top-bar::before {
        font-size: 18px;
    }
    
    .search-container {
        max-width: 100%;
    }
    
    .controls {
        flex-wrap: wrap;
    }
    
    .table-container {
        padding: 16px;
        width: 100%;
    }
}
