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

body {
    background: linear-gradient(135deg, #0a0a1a 0%, #1a1a2e 50%, #16213e 100%);
    font-family: 'Segoe UI', 'system-ui', sans-serif;
    color: #ffffff;
    overflow-x: hidden;
    min-height: 100vh;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.header {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 255, 255, 0.2);
    position: relative;
    z-index: 100;
}

.app-title {
    font-size: 2.5rem;
    font-weight: bold;
    background: linear-gradient(45deg, #00ffff, #ff00ff, #ffff00);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease-in-out infinite;
    text-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.webcam-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ff4444;
    animation: pulse 2s infinite;
    box-shadow: 0 0 10px currentColor;
}

.status-dot.active {
    background: #00ff88;
    animation: none;
}

.status-dot.initializing {
    background: #ffaa00;
}

.status-dot.error {
    background: #ff4444;
}

.status-dot.privacy {
    background: #aa88ff;
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.debug-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.debug-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(0, 255, 255, 0.5);
}

/* Debug Panel */
.debug-panel {
    background: rgba(0, 0, 0, 0.9);
    border-bottom: 1px solid rgba(0, 255, 255, 0.3);
    padding: 1rem 2rem;
    display: none;
    max-height: 200px;
    overflow-y: auto;
}

.debug-panel h3 {
    color: #00ffff;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

#debugLog {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    padding: 0.5rem;
    max-height: 120px;
    overflow-y: auto;
    margin-bottom: 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
}

.debug-entry {
    margin-bottom: 0.25rem;
    display: flex;
    gap: 0.5rem;
}

.debug-entry.error { color: #ff6666; }
.debug-entry.warn { color: #ffaa00; }
.debug-entry.success { color: #66ff66; }
.debug-entry.info { color: #cccccc; }

.timestamp {
    color: #888;
    min-width: 80px;
}

.debug-panel button {
    background: rgba(0, 255, 255, 0.2);
    border: 1px solid rgba(0, 255, 255, 0.4);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    cursor: pointer;
    margin-right: 0.5rem;
    font-size: 0.75rem;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    padding: 1rem;
    gap: 1rem;
    min-height: 0;
}

.canvas-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    min-height: 0;
}

#canvas {
    border: 2px solid rgba(0, 255, 255, 0.3);
    border-radius: 50%;
    cursor: crosshair;
    box-shadow: 
        0 0 30px rgba(0, 255, 255, 0.3),
        inset 0 0 30px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
    max-width: 100%;
    max-height: 100%;
}

#canvas:hover {
    border-color: rgba(0, 255, 255, 0.6);
    box-shadow: 
        0 0 50px rgba(0, 255, 255, 0.5),
        inset 0 0 30px rgba(0, 0, 0, 0.5);
}

.canvas-overlay {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 10;
}

.control-btn {
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(0, 255, 255, 0.4);
    color: white;
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    font-size: 1.2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.control-btn:hover {
    background: rgba(0, 255, 255, 0.2);
    border-color: rgba(0, 255, 255, 0.8);
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.4);
}

.center-crosshair {
    position: absolute;
    pointer-events: none;
    display: none;
    z-index: 5;
}

/* Error Overlay */
.error-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 50%;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 20;
    backdrop-filter: blur(5px);
}

.error-content {
    text-align: center;
    color: white;
    padding: 2rem;
}

.error-content h3 {
    color: #ff6666;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.error-content p {
    margin-bottom: 1.5rem;
    color: #cccccc;
    line-height: 1.4;
}

.error-content button {
    background: rgba(0, 255, 255, 0.2);
    border: 1px solid rgba(0, 255, 255, 0.4);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    margin: 0.25rem;
    transition: all 0.3s ease;
}

.error-content button:hover {
    background: rgba(0, 255, 255, 0.4);
    transform: translateY(-2px);
}

/* Controls Panel */
.controls-panel {
    width: 320px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 255, 255, 0.2);
    border-radius: 15px;
    padding: 1.5rem;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.control-group {
    margin-bottom: 2rem;
}

.control-group h3 {
    color: #00ffff;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(0, 255, 255, 0.3);
    padding-bottom: 0.5rem;
}

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

.control-item label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #cccccc;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.slider-container input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    -webkit-appearance: none;
}

.slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(45deg, #00ffff, #ff00ff);
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.slider-container input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(45deg, #00ffff, #ff00ff);
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.slider-container span {
    color: #00ffff;
    font-weight: bold;
    font-size: 0.9rem;
    min-width: 40px;
    text-align: right;
}

select {
    width: 100%;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 5px;
    color: white;
    outline: none;
    font-size: 0.9rem;
}

select:focus {
    border-color: rgba(0, 255, 255, 0.6);
    box-shadow: 0 0 5px rgba(0, 255, 255, 0.3);
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    cursor: pointer;
    margin-bottom: 0 !important;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 0.5rem;
    accent-color: #00ffff;
    transform: scale(1.2);
}

/* Action Grid */
.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.action-btn {
    background: rgba(0, 255, 255, 0.2);
    border: 1px solid rgba(0, 255, 255, 0.4);
    color: white;
    padding: 0.75rem 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8rem;
    text-align: center;
}

.action-btn:hover {
    background: rgba(0, 255, 255, 0.4);
    border-color: rgba(0, 255, 255, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 255, 255, 0.3);
}

.action-btn.recording {
    background: rgba(255, 0, 0, 0.3);
    border-color: rgba(255, 0, 0, 0.6);
    animation: recordingPulse 1s infinite;
}

@keyframes recordingPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Custom Scrollbar */
.controls-panel::-webkit-scrollbar {
    width: 6px;
}

.controls-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.controls-panel::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 255, 0.5);
    border-radius: 3px;
}

.controls-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 255, 0.8);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }
    
    .controls-panel {
        width: 100%;
        max-height: 50vh;
        order: 2;
    }
    
    .canvas-container {
        order: 1;
        min-height: 50vh;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .app-title {
        font-size: 1.8rem;
    }
    
    .main-content {
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .controls-panel {
        padding: 1rem;
    }
    
    .control-group h3 {
        font-size: 0.8rem;
    }
    
    .action-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.25rem;
    }
    
    .canvas-overlay {
        top: 10px;
        right: 10px;
        gap: 5px;
    }
    
    .control-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .app-title {
        font-size: 1.5rem;
    }
    
    .webcam-status {
        font-size: 0.8rem;
    }
    
    .controls-panel {
        width: 100%;
        border-radius: 10px;
    }
    
    .action-grid {
        grid-template-columns: 1fr;
    }
}

/* Fullscreen Styles */
.canvas-container:fullscreen {
    background: black;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.canvas-container:fullscreen #canvas {
    width: 90vmin !important;
    height: 90vmin !important;
    max-width: none;
    max-height: none;
}

.canvas-container:fullscreen .canvas-overlay {
    position: fixed;
    top: 20px;
    right: 20px;
}

/* Loading States */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 255, 255, 0.3);
    border-top: 2px solid #00ffff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .app-title {
        animation: none;
    }
    
    .status-dot {
        animation: none;
    }
    
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .controls-panel {
        background: rgba(0, 0, 0, 0.9);
        border-color: #ffffff;
    }
    
    .control-btn {
        background: rgba(0, 0, 0, 0.9);
        border-color: #ffffff;
    }
    
    select, input {
        border-color: #ffffff;
    }
}