* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 30px;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 2.5em;
}

h3 {
    color: #555;
    margin-bottom: 15px;
    font-size: 1.2em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.main-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

/* Video Section */
.video-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.video-container {
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#video {
    width: 100%;
    height: auto;
    display: block;
    max-height: 500px;
}

#canvas {
    position: absolute;
    top: 0;
    left: 0;
}

.status {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #00ff00;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: bold;
}

.detections {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 15px;
    flex: 1;
}

.detections-list {
    max-height: 200px;
    overflow-y: auto;
    font-size: 0.9em;
    color: #555;
}

.detection-item {
    padding: 8px;
    margin: 5px 0;
    background: white;
    border-left: 3px solid #667eea;
    border-radius: 4px;
}

.detection-item.recognized {
    border-left-color: #4caf50;
    background: #e8f5e9;
}

.detection-item.unknown {
    border-left-color: #ff9800;
    background: #fff3e0;
}

/* Controls Section */
.controls-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.control-group {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.control-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
    font-size: 0.95em;
    color: #555;
}

.control-group input[type="range"],
.control-group input[type="number"] {
    flex: 1;
    max-width: 150px;
}

.control-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Buttons */
.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 8px 0;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-success {
    background: #4caf50;
    color: white;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-primary {
    background: #2196f3;
    color: white;
}

.btn-info {
    background: #00bcd4;
    color: white;
}

.btn-warning {
    background: #ff9800;
    color: white;
}

.btn-secondary {
    background: #9e9e9e;
    color: white;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85em;
    margin: 4px 2px;
    width: auto;
}

/* Results Section */
.results-section {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border-left: 4px solid #4caf50;
}

.results-list {
    max-height: 250px;
    overflow-y: auto;
    margin: 15px 0;
}

.result-item {
    padding: 12px;
    margin: 8px 0;
    background: white;
    border-radius: 6px;
    border-left: 3px solid #4caf50;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.result-item.error {
    border-left-color: #f44336;
    background: #ffebee;
}

.result-item.warning {
    border-left-color: #ff9800;
    background: #fff3e0;
}

.result-item.success {
    border-left-color: #4caf50;
    background: #e8f5e9;
}

.result-name {
    font-weight: bold;
    color: #333;
    font-size: 1.05em;
}

.result-confidence {
    font-size: 0.85em;
    color: #666;
    margin-top: 4px;
}

/* Captures Section */
.captures-section {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #2196f3;
}

.captures-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.capture-item {
    position: relative;
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.3s ease;
}

.capture-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.capture-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.capture-info {
    padding: 8px;
    font-size: 0.85em;
    color: #666;
    text-align: center;
    background: white;
}

.capture-time {
    font-weight: bold;
    color: #333;
}

.capture-delete {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(244, 67, 54, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 0.8em;
    display: none;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.capture-item:hover .capture-delete {
    display: flex;
}

.capture-delete:hover {
    background: rgba(244, 67, 54, 1);
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .captures-list {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 1.8em;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 0.85em;
    }
    
    .captures-list {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}
