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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.app {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 40px;
    position: relative;
    overflow: hidden;
}

.app::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

/* Header Styles */
h2 {
    color: #2d3748;
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.muted {
    color: #718096;
    font-size: 1.1rem;
    margin-bottom: 40px;
    line-height: 1.6;
}

/* Row Layout */
.row {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-top: 20px;
}

/* Card Styles */
.card {
    flex: 1;
    min-width: 300px;
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

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

.card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.card h3 {
    color: #2d3748;
    font-size: 1.5rem;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #edf2f7;
}

/* Form Elements */
input[type="file"] {
    width: 100%;
    padding: 15px;
    border: 2px dashed #cbd5e0;
    border-radius: 10px;
    background: #f7fafc;
    font-size: 1rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

input[type="file"]:hover {
    border-color: #667eea;
    background: #edf2f7;
}

input[type="file"]:focus {
    outline: none;
    border-color: #764ba2;
    box-shadow: 0 0 0 3px rgba(118, 75, 162, 0.1);
}

/* Button Styles */
button {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 10px;
    margin-bottom: 10px;
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

button:hover::before {
    left: 100%;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

button:disabled:hover::before {
    left: -100%;
}

#btnStart {
    background: linear-gradient(90deg, #48bb78 0%, #38a169 100%);
}

#btnStop {
    background: linear-gradient(90deg, #f56565 0%, #e53e3e 100%);
}

#btnLive {
    background: linear-gradient(90deg, #ed8936 0%, #dd6b20 100%);
}

/* Video and Canvas */
video {
    width: 100%;
    height: 300px;
    background: #1a202c;
    border-radius: 10px;
    object-fit: cover;
    margin-bottom: 20px;
    border: 3px solid #e2e8f0;
}

canvas {
    display: none;
}

/* Result Containers */
.result {
    margin-top: 25px;
    padding: 20px;
    background: #f7fafc;
    border-radius: 10px;
    border-left: 4px solid #667eea;
    animation: slideIn 0.5s ease;
}

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

.result b {
    color: #2d3748;
    font-size: 1.1rem;
}

.result ol {
    margin-left: 20px;
    margin-top: 10px;
}

.result li {
    padding: 5px 0;
    color: #4a5568;
    border-bottom: 1px solid #e2e8f0;
}

.result li:last-child {
    border-bottom: none;
}

/* Toast Notifications */
.toast-root {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 16px 20px;
    border-radius: 10px;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    animation: toastSlideIn 0.3s ease;
    min-width: 300px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    background: linear-gradient(90deg, #48bb78 0%, #38a169 100%);
}

.toast.error {
    background: linear-gradient(90deg, #f56565 0%, #e53e3e 100%);
}

.toast.info {
    background: linear-gradient(90deg, #4299e1 0%, #3182ce 100%);
}

.toast.warning {
    background: linear-gradient(90deg, #ed8936 0%, #dd6b20 100%);
}

.toast-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    margin: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-close:hover {
    transform: scale(1.1);
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .app {
        padding: 20px;
    }
    
    h2 {
        font-size: 1.8rem;
    }
    
    .row {
        flex-direction: column;
    }
    
    .card {
        min-width: 100%;
    }
    
    video {
        height: 250px;
    }
    
    .toast {
        min-width: 280px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .app {
        padding: 15px;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    button {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .toast {
        min-width: 250px;
        left: 10px;
        right: 10px;
    }
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 10px;
}

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

/* Confidence Bars in Results */
.confidence-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    margin: 5px 0 10px 0;
    overflow: hidden;
}

.confidence-level {
    height: 100%;
    background: linear-gradient(90deg, #48bb78 0%, #38a169 100%);
    border-radius: 4px;
    width: 0%;
    transition: width 1s ease-out;
}