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

body {
    overflow: hidden;
    background: #000510;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Canvas Container */
#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* UI Overlay */
#ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

#ui-overlay > * {
    pointer-events: auto;
}

/* Controls Panel */
.controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(0, 20, 40, 0.8);
    backdrop-filter: blur(10px);
    padding: 15px 25px;
    border-radius: 50px;
    border: 1px solid rgba(57, 204, 204, 0.3);
    box-shadow: 0 0 30px rgba(57, 204, 204, 0.2);
}

/* Theme Control */
.theme-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.theme-control label {
    color: #39CCCC;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.theme-buttons {
    display: flex;
    gap: 8px;
}

.theme-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.theme-btn:hover {
    transform: scale(1.2);
    box-shadow: 0 0 15px currentColor;
}

.theme-btn.active {
    border-color: white;
    box-shadow: 0 0 10px currentColor, 0 0 20px currentColor;
}

.info {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    font-family: monospace;
    border-left: 1px solid rgba(57, 204, 204, 0.3);
    padding-left: 20px;
}

#fps-counter {
    color: #39CCCC;
}

/* Start Message */
.start-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    transition: opacity 0.5s ease;
}

.start-message p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 3px;
    animation: pulse 2s ease-in-out infinite;
}

.start-message.hidden {
    opacity: 0;
    pointer-events: none;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* AI Status */
.ai-status-container {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 20, 40, 0.8);
    backdrop-filter: blur(10px);
    padding: 10px 30px;
    border-radius: 25px;
    border: 1px solid rgba(57, 204, 204, 0.3);
    box-shadow: 0 0 20px rgba(57, 204, 204, 0.2);
}

#ai-status {
    color: #39CCCC;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Microphone Button */
.mic-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #0074D9, #39CCCC);
    border: none;
    padding: 12px 24px;
    border-radius: 30px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mic-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(57, 204, 204, 0.6);
}

.mic-btn:active,
.mic-btn.listening {
    background: linear-gradient(135deg, #FF4136, #FF6347);
    box-shadow: 0 0 30px rgba(255, 65, 54, 0.6);
}

.mic-btn.speaking {
    background: linear-gradient(135deg, #2ECC40, #01FF70);
    box-shadow: 0 0 30px rgba(46, 204, 64, 0.6);
}

.mic-btn.error {
    background: linear-gradient(135deg, #FF4136, #85144b);
    box-shadow: 0 0 30px rgba(255, 65, 54, 0.8);
    animation: errorPulse 0.5s ease-in-out;
}

@keyframes errorPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Mic status indicator */
.mic-status {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #FF4136;
    border: 2px solid #000;
    display: none;
}

.mic-btn.listening .mic-status {
    display: block;
    background: #FF4136;
    animation: statusPulse 1s ease-in-out infinite;
}

.mic-btn.error .mic-status {
    display: block;
    background: #FF4136;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.mic-icon {
    font-size: 18px;
}

/* Settings Button */
.settings-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 20, 40, 0.8);
    border: 1px solid rgba(57, 204, 204, 0.3);
    color: #39CCCC;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-btn:hover {
    background: rgba(57, 204, 204, 0.2);
    transform: rotate(90deg);
    box-shadow: 0 0 15px rgba(57, 204, 204, 0.4);
}

/* Settings Panel */
.settings-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 10, 30, 0.95);
    backdrop-filter: blur(20px);
    padding: 30px;
    border-radius: 20px;
    border: 1px solid rgba(57, 204, 204, 0.3);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
    min-width: 300px;
    display: none;
    z-index: 100;
}

.settings-panel.active {
    display: block;
}

.settings-panel h3 {
    color: #39CCCC;
    margin-bottom: 20px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.setting-group input,
.setting-group select {
    width: 100%;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(57, 204, 204, 0.3);
    border-radius: 10px;
    color: white;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

.setting-group input:focus,
.setting-group select:focus {
    border-color: #39CCCC;
    box-shadow: 0 0 10px rgba(57, 204, 204, 0.3);
}

.setting-group button {
    margin-top: 10px;
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #0074D9, #39CCCC);
    border: none;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.setting-group button:hover {
    box-shadow: 0 0 15px rgba(57, 204, 204, 0.5);
}

#close-settings {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(57, 204, 204, 0.3);
    border-radius: 10px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#close-settings:hover {
    background: rgba(57, 204, 204, 0.2);
}

/* Responsive Design */
@media (max-width: 600px) {
    .controls {
        flex-direction: column;
        gap: 15px;
        padding: 20px;
        border-radius: 20px;
    }
    
    .theme-control {
        flex-direction: column;
        gap: 5px;
    }
    
    .info {
        border-left: none;
        border-top: 1px solid rgba(57, 204, 204, 0.3);
        padding-left: 0;
        padding-top: 10px;
    }
}

/* Loading State */
body.loading {
    cursor: wait;
}

body.loading::before {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(57, 204, 204, 0.3);
    border-top-color: #39CCCC;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
    z-index: 100;
}

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