* {
    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;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    width: 100%;
    padding: 40px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    color: #333;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    font-size: 1rem;
}

.status-panel {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
}

/* State Panel Styles */
.state-panel {
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    animation: slideIn 0.4s ease-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.state-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.state-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.state-info h3 {
    margin: 0 0 5px 0;
    font-size: 1.2rem;
}

.state-info p {
    margin: 0;
    font-size: 1rem;
    opacity: 0.9;
}

/* Emergency State */
.state-panel.state-emergency {
    background: linear-gradient(135deg, #ff4444 0%, #cc0000 100%);
    color: white;
    border: 3px solid #ff0000;
    animation: emergencyPulse 1s infinite, slideIn 0.4s ease-out;
}

@keyframes emergencyPulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(255, 0, 0, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(255, 0, 0, 0.8);
    }
}

.state-panel.state-emergency .state-info h3 {
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: 1px;
}

/* Request State (Item Request) */
.state-panel.state-request {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
}

/* Assistance State (Room Help) */
.state-panel.state-assistance {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
}

/* Chat State */
.state-panel.state-chat {
    background: linear-gradient(135deg, #9C27B0 0%, #7B1FA2 100%);
    color: white;
}

/* Normal State */
.state-panel.state-normal {
    background: #e3f2fd;
    color: #333;
    border-left: 4px solid #2196F3;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #6c757d;
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: #28a745;
}

.status-dot.active {
    background: #007bff;
    animation: pulse 1s infinite;
}

.status-dot.speaking {
    background: #ffc107;
    animation: pulse 0.5s infinite;
}

.status-dot.error {
    background: #dc3545;
    animation: none;
}

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

#statusText {
    color: #333;
    font-weight: 500;
}

.controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 30px;
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

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

.btn-secondary:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.4);
}

.audio-visualizer {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#canvas {
    width: 100%;
    height: 100%;
}

.transcript-panel {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.transcript-panel h2 {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 15px;
}

.transcript {
    max-height: 300px;
    overflow-y: auto;
}

.message {
    margin-bottom: 15px;
    padding: 12px;
    border-radius: 8px;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
}

.message.assistant {
    background: #f3e5f5;
    border-left: 4px solid #9c27b0;
}

.message-role {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    margin-bottom: 5px;
    color: #666;
}

.message-text {
    color: #333;
    line-height: 1.5;
}

footer {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid #dc3545;
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 2rem;
    }

    .btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
}
