/* Reset and base styles */
* {
    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%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Main content */
main {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* Camera selection */
.camera-selection {
    text-align: center;
    margin-bottom: 20px;
}

.camera-selection h2 {
    margin-bottom: 20px;
    color: #333;
}

.camera-dropdown {
    width: 100%;
    max-width: 400px;
    padding: 12px 15px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    margin-bottom: 15px;
    background: white;
}

.camera-dropdown:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #5a6fd8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* Video container */
.video-container {
    text-align: center;
}

.video-wrapper {
    position: relative;
    display: inline-block;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    margin-bottom: 20px;
    /* --- */
    aspect-ratio: 3/4;
    max-width: 400px;
    margin: 0 auto;
}

#videoElement {
    display: block;
    /*
    max-width: 100%;
    height: auto; 
    height: 100%;
    */
    display: block;
    left: 50%;
    transform: translateX(-50%);
    position: absolute;
    height: 100%;
}

.video-wrapper.portrait #videoElement {
    transform: translateX(0%);
    left: 0%;
    position: absolute;
}

/* Portrait video aspect ratio */
.video-wrapper.portrait {
    aspect-ratio: 3/4;
    max-width: 400px;
    margin: 0 auto;
}

.video-wrapper.portrait #videoElement {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#overlayCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}


#overlayCard {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: no-repeat center/100% url('overlay.svg');
}

/* Controls */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

.info {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.info span {
    background: #f8f9fa;
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid #e9ecef;
}

/* Loading indicator */
.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: #666;
    font-size: 16px;
}

/* Error display */
.error {
    text-align: center;
    padding: 30px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 10px;
    color: #721c24;
}

.error h3 {
    margin-bottom: 15px;
}

.error p {
    margin-bottom: 20px;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 30px;
    color: white;
    opacity: 0.8;
    font-size: 14px;
}

/* Responsive design */
/* @media (max-width: 768px) { */
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    header p {
        font-size: 1rem;
    }
    
    main {
        padding: 15px;
        border-radius: 10px;
    }
    
    .video-wrapper {
        max-width: 100%;
        width: 100%;
    }
    
    .video-wrapper.portrait {
        max-width: 300px;
        aspect-ratio: 3/4;
    }
    /*
    #videoElement {
        width: 100%;
        max-width: 100%;
        height: auto;
    }*/
    
    .controls {
        flex-direction: column;
        gap: 12px;
    }
    
    .info {
        justify-content: center;
        text-align: center;
        gap: 10px;
    }
    
    .info span {
        font-size: 12px;
        padding: 4px 8px;
    }
    
    .btn {
        width: 100%;
        max-width: 280px;
        padding: 14px 20px;
        font-size: 16px;
        min-height: 48px;
    }
    
    .camera-dropdown {
        width: 100%;
        padding: 14px 15px;
        font-size: 16px;
        min-height: 48px;
    }
/*} */

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    main {
        padding: 12px;
    }
    
    .info {
        flex-direction: column;
        gap: 8px;
    }
    
    .info span {
        font-size: 11px;
    }
}

/* Camera orientation classes */
.rotate-90ccw {
    transform: rotate(-90deg);
}

.rotate-90cw {
    transform: rotate(90deg);
}

/* Status indicators */
.status-active {
    background: #d4edda !important;
    color: #155724 !important;
    border-color: #c3e6cb !important;
}

.status-inactive {
    background: #f8d7da !important;
    color: #721c24 !important;
    border-color: #f5c6cb !important;
}

.status-processing {
    background: #fff3cd !important;
    color: #856404 !important;
    border-color: #ffeaa7 !important;
}

/* Acceleration indicators */
.acceleration-info {
    font-weight: 600;
}

.acceleration-webgpu {
    background: #e1f5fe !important;
    color: #01579b !important;
    border-color: #b3e5fc !important;
}

.acceleration-webgl {
    background: #e8f5e8 !important;
    color: #2e7d32 !important;
    border-color: #c8e6c9 !important;
}

.acceleration-wasm {
    background: #fff3e0 !important;
    color: #ef6c00 !important;
    border-color: #ffcc02 !important;
}
