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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 10px;
}

header .subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Stats Section */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 10px;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Filters Section */
.filters-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.filter-btn, .refresh-btn {
    padding: 10px 20px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-btn:hover, .refresh-btn:hover {
    background: #667eea;
    color: white;
}

.filter-btn.active {
    background: #667eea;
    color: white;
}

.refresh-btn {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Videos Section */
.videos-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-height: 400px;
}

.videos-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.video-card {
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.video-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

.video-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.video-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    word-break: break-word;
}

.video-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-completed {
    background: #d4edda;
    color: #155724;
}

.status-processing {
    background: #fff3cd;
    color: #856404;
}

.status-pending {
    background: #d1ecf1;
    color: #0c5460;
}

.status-failed {
    background: #f8d7da;
    color: #721c24;
}

.video-meta {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 10px;
}

.video-stats {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.video-stat {
    text-align: center;
    flex: 1;
}

.video-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
}

.video-stat-label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
}

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

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e0e0e0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Modal */
.modal {
    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: 1000;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px;
    border-bottom: 2px solid #e0e0e0;
}

.modal-header h2 {
    font-size: 1.5rem;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.close-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-body {
    padding: 25px;
}

.video-info, .sequence-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.video-info p, .sequence-info p {
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.sequences-list {
    display: grid;
    gap: 15px;
}

.sequence-card {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    gap: 15px;
}

.sequence-card:hover {
    border-color: #667eea;
    background: #f8f9fa;
}

.sequence-thumbnail {
    width: 120px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
}

.sequence-details {
    flex: 1;
}

.sequence-title {
    font-weight: 600;
    margin-bottom: 8px;
}

.sequence-meta {
    font-size: 0.85rem;
    color: #666;
}

.sequence-video {
    margin-bottom: 20px;
}

.detections-list {
    max-height: 300px;
    overflow-y: auto;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
}

.detection-item {
    padding: 8px;
    margin-bottom: 5px;
    background: white;
    border-radius: 4px;
    font-size: 0.85rem;
}

.detection-item strong {
    color: #667eea;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 12px 24px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.tab-btn.active {
    background: white;
    color: #667eea;
}

/* Upload Section */
.upload-section {
    margin-bottom: 30px;
}

.upload-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.upload-card h3 {
    margin-bottom: 15px;
    color: #333;
}

.upload-area {
    border: 2px dashed #e0e0e0;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    transition: all 0.3s;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: #667eea;
    background: #f8f9ff;
}

.upload-placeholder {
    cursor: pointer;
    color: #666;
}

.upload-placeholder svg {
    color: #667eea;
    margin-bottom: 15px;
}

.upload-hint {
    font-size: 0.85rem;
    color: #999;
    margin-top: 5px;
}

.upload-progress {
    padding: 20px;
}

.progress-bar {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s;
}

/* File Manager Section */
.files-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-height: 400px;
}

.files-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.files-stats {
    font-size: 0.95rem;
    color: #666;
}

.files-stats .separator {
    margin: 0 10px;
    color: #ccc;
}

.files-stats .imported-count {
    color: #28a745;
    font-weight: 600;
}

.files-stats .pending-count {
    color: #ffc107;
    font-weight: 600;
}

.files-actions {
    display: flex;
    gap: 10px;
}

.files-path {
    font-size: 0.85rem;
    color: #999;
    margin-bottom: 20px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    font-family: monospace;
}

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

/* File Card */
.file-card {
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 15px;
    transition: all 0.3s;
}

.file-card:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.file-card-main {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 12px;
}

.file-icon {
    color: #667eea;
    flex-shrink: 0;
}

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

.file-name {
    font-weight: 600;
    color: #333;
    word-break: break-word;
    margin-bottom: 4px;
}

.file-meta {
    font-size: 0.85rem;
    color: #666;
}

.file-meta .separator {
    margin: 0 8px;
    color: #ccc;
}

.file-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.file-status.imported {
    background: #d4edda;
    color: #155724;
}

.file-status.pending {
    background: #fff3cd;
    color: #856404;
}

.file-actions {
    display: flex;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

/* Action Buttons */
.action-btn {
    padding: 8px 16px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-btn:hover {
    background: #667eea;
    color: white;
}

.action-btn.btn-primary {
    background: #667eea;
    color: white;
}

.action-btn.btn-primary:hover {
    background: #5a6fd6;
}

.action-btn.btn-danger {
    border-color: #dc3545;
    color: #dc3545;
}

.action-btn.btn-danger:hover {
    background: #dc3545;
    color: white;
}

/* Video Actions in Modal */
.video-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

/* Modal Small Variant */
.modal-small {
    max-width: 500px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd6;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

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

/* Form Elements */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
}

/* Confirm Options */
.confirm-options {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.95rem;
}

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

/* Sequence Actions */
.sequence-actions {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

/* Tracks List */
.tracks-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.track-card {
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s;
    background: white;
}

.track-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.track-thumbnail-container {
    width: 100%;
    height: 150px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

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

.track-thumbnail-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    background: linear-gradient(135deg, #f0f0f0, #e0e0e0);
}

.track-info {
    padding: 12px;
}

.track-id {
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}

.track-meta {
    font-size: 0.8rem;
    color: #666;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* Lightbox Modal */
.lightbox-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: -50px;
    right: -10px;
    background: none;
    border: none;
    color: white;
    font-size: 40px;
    cursor: pointer;
    padding: 10px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.3s;
    z-index: 10;
}

.lightbox-close:hover {
    opacity: 1;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 30px;
    cursor: pointer;
    padding: 20px 15px;
    border-radius: 4px;
    opacity: 0.7;
    transition: all 0.3s;
}

.lightbox-nav:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev {
    left: -80px;
}

.lightbox-next {
    right: -80px;
}

.lightbox-caption {
    margin-top: 15px;
    color: white;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#lightbox-title {
    font-size: 1.1rem;
    font-weight: 600;
}

#lightbox-counter {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Thumbnail overlay for hover effect */
.track-thumbnail-container {
    position: relative;
    cursor: pointer;
}

.thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(102, 126, 234, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
    border-radius: 8px 8px 0 0;
    color: white;
}

.track-thumbnail-container:hover .thumbnail-overlay {
    opacity: 1;
}

.track-card:hover {
    transform: translateY(-3px);
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .videos-list {
        grid-template-columns: 1fr;
    }

    .stats-section {
        grid-template-columns: repeat(2, 1fr);
    }

    .sequence-card {
        flex-direction: column;
    }

    .sequence-thumbnail {
        width: 100%;
        height: 150px;
    }

    .tab-navigation {
        flex-direction: column;
    }

    .tab-btn {
        width: 100%;
        justify-content: center;
    }

    .files-header {
        flex-direction: column;
        align-items: stretch;
    }

    .files-actions {
        justify-content: stretch;
    }

    .files-actions button {
        flex: 1;
    }

    .file-card-main {
        flex-wrap: wrap;
    }

    .file-status {
        width: 100%;
        text-align: center;
        margin-top: 10px;
    }

    .file-actions {
        flex-direction: column;
    }

    .file-actions button {
        width: 100%;
        justify-content: center;
    }

    .video-actions {
        flex-direction: column;
    }

    .video-actions button {
        width: 100%;
        justify-content: center;
    }

    /* Lightbox responsive */
    .lightbox-nav {
        padding: 15px 10px;
        font-size: 24px;
    }

    .lightbox-prev {
        left: 10px;
    }

    .lightbox-next {
        right: 10px;
    }

    .lightbox-close {
        top: -40px;
        right: 0;
        font-size: 30px;
    }

    .tracks-list {
        grid-template-columns: repeat(2, 1fr);
    }
}
