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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #1f2937;
}

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

header {
    text-align: center;
    padding: 2rem 1rem;
    color: white;
}

.header-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.header-content p {
    font-size: 1.125rem;
    opacity: 0.95;
}

main {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.upload-section {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    margin-bottom: 2rem;
}

.upload-card {
    text-align: center;
    padding: 3rem 2rem;
    border: 2px dashed #d1d5db;
    border-radius: 0.75rem;
    background: #f9fafb;
}

.upload-icon {
    width: 4rem;
    height: 4rem;
    color: #9ca3af;
    margin: 0 auto 1rem;
}

.upload-card h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #374151;
}

.upload-card p {
    color: #6b7280;
    margin-bottom: 1.5rem;
}

.settings-card {
    padding: 1.5rem;
    background: #f3f4f6;
    border-radius: 0.75rem;
}

.settings-card h3 {
    margin-bottom: 1rem;
    color: #374151;
}

.setting-item {
    margin-bottom: 1rem;
}

.setting-item label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: #4b5563;
    font-weight: 500;
}

.setting-item input,
.setting-item select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

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

.btn-secondary {
    background: white;
    color: #4b5563;
    border: 1px solid #d1d5db;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

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

.btn-analyze {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 1rem;
    font-size: 1.125rem;
    margin: 2rem 0;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #ffffff40;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 0.5rem;
}

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

.video-info {
    margin-top: 1rem;
}

.file-info {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    background: white;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.file-name {
    font-weight: 500;
    color: #374151;
}

.file-size {
    color: #6b7280;
}

.video-preview {
    margin-bottom: 2rem;
}

.video-preview h3 {
    margin-bottom: 1rem;
    color: #374151;
}

.video-preview video {
    width: 100%;
    max-height: 400px;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.progress-section {
    padding: 2rem;
    background: #f9fafb;
    border-radius: 0.75rem;
    margin-bottom: 2rem;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.progress-header h3 {
    color: #374151;
}

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

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

.current-status {
    font-size: 0.875rem;
    color: #6b7280;
}

.results-section {
    margin-top: 2rem;
}

.results-section h2 {
    margin-bottom: 1.5rem;
    color: #374151;
}

.frames-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.frame-card {
    background: #f9fafb;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.frame-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.frame-info {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
}

.frame-info h4 {
    font-size: 0.875rem;
    color: #374151;
}

.frame-time {
    font-size: 0.75rem;
    color: #9ca3af;
}

.frame-description {
    padding: 1rem;
    min-height: 100px;
}

.frame-description p {
    font-size: 0.875rem;
    line-height: 1.5;
    color: #4b5563;
}

.loading-dots {
    color: #9ca3af;
    font-size: 0.875rem;
}

.loading-dots::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

.summary-card {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border: 1px solid #e0e7ff;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.summary-card h3 {
    color: #5b21b6;
    margin-bottom: 1rem;
}

.summary-content {
    color: #374151;
    line-height: 1.6;
}

.actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

.error-section {
    text-align: center;
    padding: 2rem;
}

.error-card {
    max-width: 500px;
    margin: 0 auto;
    padding: 2rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.75rem;
}

.error-icon {
    width: 3rem;
    height: 3rem;
    color: #ef4444;
    margin: 0 auto 1rem;
}

.error-card h3 {
    color: #dc2626;
    margin-bottom: 0.5rem;
}

.error-card p {
    color: #7f1d1d;
    margin-bottom: 1.5rem;
}

footer {
    text-align: center;
    padding: 2rem 1rem;
    color: white;
    font-size: 0.875rem;
}

.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    .upload-section {
        grid-template-columns: 1fr;
    }
    
    .header-content h1 {
        font-size: 2rem;
    }
    
    .frames-grid {
        grid-template-columns: 1fr;
    }
    
    .actions {
        flex-direction: column;
    }
    
    .btn-secondary {
        width: 100%;
    }
}