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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #1a1a2e;
    color: #eee;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2rem;
    color: #00d9ff;
    margin-bottom: 5px;
}

header p {
    color: #888;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #333;
    padding-bottom: 10px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: #888;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 1rem;
    border-radius: 5px;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: #333;
    color: #fff;
}

.tab-btn.active {
    background: #00d9ff;
    color: #1a1a2e;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Upload Area */
.upload-area {
    border: 2px dashed #444;
    border-radius: 10px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-area:hover, .upload-area.dragover {
    border-color: #00d9ff;
    background: rgba(0, 217, 255, 0.05);
}

.upload-icon {
    font-size: 3rem;
    color: #00d9ff;
    margin-bottom: 10px;
}

.progress-container {
    margin-top: 20px;
}

.progress-bar {
    height: 10px;
    background: #333;
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #00d9ff;
    width: 0%;
    transition: width 0.3s;
}

/* Videos List */
.video-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.video-card {
    background: #252540;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s;
}

.video-card:hover {
    transform: translateY(-5px);
}

.video-thumbnail {
    height: 160px;
    background: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #444;
    font-size: 3rem;
}

.video-info {
    padding: 15px;
}

.video-info h3 {
    font-size: 0.95rem;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-meta {
    display: flex;
    gap: 15px;
    color: #888;
    font-size: 0.85rem;
}

.video-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.75rem;
    margin-top: 8px;
}

.video-status.processed {
    background: #00d9ff33;
    color: #00d9ff;
}

.video-status.processing {
    background: #ffa50033;
    color: orange;
}

/* Search Form */
.search-form {
    background: #252540;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.form-group {
    flex: 1;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #888;
    font-size: 0.85rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    background: #1a1a2e;
    border: 1px solid #333;
    border-radius: 5px;
    color: #fff;
    font-size: 0.95rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #00d9ff;
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.result-card {
    background: #252540;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
}

.result-thumbnail {
    height: 120px;
    background: #1a1a2e;
    position: relative;
}

.result-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.result-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    padding: 8px;
    color: #fff;
    font-size: 0.8rem;
}

.result-info {
    padding: 10px;
}

.result-info .object-class {
    color: #00d9ff;
    font-weight: bold;
}

.result-info .confidence {
    color: #888;
    font-size: 0.8rem;
}

/* Buttons */
.btn {
    padding: 10px 25px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.btn.primary {
    background: #00d9ff;
    color: #1a1a2e;
}

.btn.primary:hover {
    background: #00b8d9;
}

.btn.secondary {
    background: #333;
    color: #fff;
}

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

.modal-content {
    background: #252540;
    border-radius: 10px;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 20px;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
}

#videoPlayer {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 15px;
}

.player-info {
    margin-bottom: 20px;
}

.player-info h3 {
    margin-bottom: 5px;
}

.player-info p {
    color: #888;
}

.clip-controls {
    background: #1a1a2e;
    padding: 15px;
    border-radius: 8px;
}

.clip-controls h4 {
    margin-bottom: 15px;
    color: #00d9ff;
}

/* Loading */
.loading {
    text-align: center;
    color: #888;
    padding: 40px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

/* Transcript Section */
.transcript-controls {
    background: #252540;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.srt-upload {
    display: flex;
    gap: 10px;
}

.transcript-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    padding: 15px;
    background: #252540;
    border-radius: 8px;
    align-items: center;
}

.transcript-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.transcript-segment {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #252540;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.transcript-segment:hover {
    background: #2a2a4a;
}

.transcript-segment.selected {
    border-color: #00d9ff;
    background: rgba(0, 217, 255, 0.1);
}

.segment-checkbox {
    flex-shrink: 0;
}

.segment-checkbox input {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #00d9ff;
}

.segment-time {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    min-width: 160px;
}

.time-badge {
    background: #1a1a2e;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85rem;
    color: #00d9ff;
}

.time-separator {
    color: #666;
}

.segment-text {
    flex: 1;
    line-height: 1.5;
}

.segment-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn.small {
    padding: 6px 12px;
    font-size: 0.8rem;
}

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

.btn.secondary:hover {
    background: #444;
}

/* Responsive */
@media (max-width: 600px) {
    .form-row {
        flex-direction: column;
    }

    .tabs {
        overflow-x: auto;
    }

    .transcript-segment {
        flex-wrap: wrap;
    }

    .segment-time {
        width: 100%;
        order: -1;
    }

    .segment-actions {
        width: 100%;
        justify-content: flex-end;
    }
}
