:root {
    --bg-dark: #0a0e1a;
    --bg-card: #131827;
    --bg-elevated: #1a1f35;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-success: #10b981;
    --accent-danger: #ef4444;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1a0f2e 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 2rem;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    font-size: 2.5rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 2rem;
    backdrop-filter: blur(10px);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background 0.3s ease;
}

.status-badge.connected .status-dot {
    background: var(--accent-success);
    animation: pulse 2s infinite;
}

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

/* Main Card */
.main-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 2.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(20px);
}

.visual-section {
    text-align: center;
    margin-bottom: 2rem;
}

.audio-visualizer {
    position: relative;
    width: 100%;
    height: 200px;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    border-radius: 1rem;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#visualizer-canvas {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0.8;
}

.mic-icon {
    position: relative;
    z-index: 1;
    color: var(--accent-primary);
    opacity: 0.6;
    transition: all 0.3s ease;
}

.mic-icon.active {
    opacity: 1;
    transform: scale(1.1);
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% {
        filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.5));
    }
    50% {
        filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.8));
    }
}

.state-indicator {
    position: relative;
    display: inline-block;
    padding: 0.75rem 1.5rem;
}

.pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border: 2px solid var(--accent-primary);
    border-radius: 2rem;
    opacity: 0;
}

.state-indicator.active .pulse-ring {
    animation: pulse-ring 2s ease-out infinite;
}

.pulse-ring.delay-1 {
    animation-delay: 0.3s !important;
}

.pulse-ring.delay-2 {
    animation-delay: 0.6s !important;
}

@keyframes pulse-ring {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

#state-text {
    position: relative;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Controls */
.controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--accent-danger);
    border-color: var(--accent-danger);
    transform: translateY(-2px);
}

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

.btn-icon {
    font-size: 1.2rem;
}

/* Info Panel */
.info-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* Conversation Card */
.conversation-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(20px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.btn-icon-small {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background 0.2s ease;
}

.btn-icon-small:hover {
    background: var(--bg-elevated);
}

.conversation-log {
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem;
}

.log-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.log-message {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 0.75rem;
    animation: slideIn 0.3s ease;
}

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

.log-message.user {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
    border-left: 3px solid var(--accent-primary);
}

.log-message.assistant {
    background: rgba(16, 185, 129, 0.1);
    border-left: 3px solid var(--accent-success);
}

.log-message.system {
    background: rgba(100, 116, 139, 0.1);
    border-left: 3px solid var(--text-muted);
    font-size: 0.875rem;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.message-role {
    font-weight: 600;
    text-transform: capitalize;
}

.message-time {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.message-content {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Footer */
.footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.footer p {
    margin-bottom: 0.5rem;
}

.footer strong {
    color: var(--accent-primary);
}

.footer-hint {
    background: var(--bg-elevated);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    display: inline-block;
    margin-top: 0.5rem;
}

/* Scrollbar */
.conversation-log::-webkit-scrollbar {
    width: 8px;
}

.conversation-log::-webkit-scrollbar-track {
    background: var(--bg-elevated);
    border-radius: 4px;
}

.conversation-log::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 4px;
}

.conversation-log::-webkit-scrollbar-thumb:hover {
    background: var(--accent-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .logo h1 {
        font-size: 1.5rem;
    }

    .main-card {
        padding: 1.5rem;
    }

    .controls {
        flex-direction: column;
    }

    .info-panel {
        grid-template-columns: 1fr;
    }
}
