/* Face Detection App Styles */

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

#app {
    width: 100%;
    max-width: 1200px;
    padding: 20px;
}

.loading {
    text-align: center;
    color: #666;
    padding: 40px;
}

.loading h2 {
    margin-bottom: 10px;
    color: #333;
}

.container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 30px;
    text-align: center;
}

.container h1 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 2.5em;
}

.video-container {
    position: relative;
    width: 640px;
    height: 480px;
    margin: 20px auto;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror the video horizontally */
}

#overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    transform: scaleX(-1); /* Mirror the canvas to match video */
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
    align-items: center;
}

.mode-selector {
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.mode-selector label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #555;
    cursor: pointer;
}

.mode-selector input[type="radio"] {
    margin: 0;
    transform: scale(1.2);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-secondary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-diagnostic {
    background: #ffc107;
    color: #000;
}

.btn-diagnostic:hover {
    background: #ffb400;
}

.camera-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.camera-selector label {
    font-weight: 500;
    color: #555;
}

.camera-selector select {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    min-width: 200px;
}

.threshold-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.threshold-control label {
    font-weight: 500;
    color: #555;
}

.threshold-control input[type="range"] {
    width: 200px;
    margin: 0 10px;
}

.stats {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    min-height: 20px;
}

.error {
    text-align: center;
    color: #dc3545;
    padding: 40px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 20px;
}

.error h2 {
    margin-bottom: 15px;
}

.error button {
    margin-top: 20px;
    padding: 12px 24px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
}

.error button:hover {
    background: #0056b3;
}

.diagnostics {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.diagnostics h3 {
    margin: 0 0 15px 0;
    color: #333;
    text-align: center;
}

.diagnostic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.diagnostic-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.metric-label {
    font-weight: 600;
    color: #495057;
}

.diagnostic-item span:last-child {
    font-weight: 700;
    color: #007bff;
    font-family: 'Courier New', monospace;
}

.diagnostic-charts {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    margin-top: 20px;
}

.diagnostic-charts canvas {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #f8f9fa;
}

/* Responsive design */
@media (max-width: 768px) {
    .video-container {
        width: 100%;
        max-width: 480px;
        height: 360px;
    }
    
    #overlay {
        /* Inherits absolute positioning from main styles */
    }
    
    .container {
        padding: 20px;
    }
    
    .container h1 {
        font-size: 2em;
    }
    
    .mode-selector {
        flex-direction: column;
        gap: 10px;
    }
    
    .controls {
        gap: 15px;
    }
    
    .diagnostic-grid {
        grid-template-columns: 1fr;
    }
    
    .diagnostic-charts {
        flex-direction: column;
        align-items: center;
    }
    
    .diagnostic-charts canvas {
        width: 100%;
        max-width: 300px;
    }
}