:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --primary-color: #6366f1;
    --secondary-color: #475569;
    --text-color: #f8fafc;
    --accent-color: #818cf8;
    --success-color: #10b981;
    --error-color: #ef4444;
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.15) 0%, transparent 40%);
}

.app-container {
    display: flex;
    width: 95%;
    max-width: 1400px;
    height: 90vh;
    gap: 20px;
}

/* Sidebar */
.sidebar {
    width: 300px;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: var(--glass-border);
    border-radius: 24px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    max-height: 100%;
}

.sidebar button {
    width: 100%;
    justify-content: center;
}

.sidebar h2 {
    font-size: 1.2rem;
    margin: 0 0 10px 0;
    color: var(--accent-color);
    font-weight: 600;
}

/* Tabs */
.tabs-nav {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px;
    border-radius: 12px;
}

.tab-btn {
    flex: 1;
    padding: 8px;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

.sidebar-actions {
    margin-top: auto;
}

.form-group,
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 0.9rem;
    color: #94a3b8;
    font-weight: 500;
}

select,
textarea {
    background: rgba(15, 23, 42, 0.6);
    border: var(--glass-border);
    border-radius: 12px;
    padding: 12px;
    color: var(--text-color);
    font-family: inherit;
    resize: vertical;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    cursor: pointer;
}

select:focus,

select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Main Content */
.main-content {
    flex: 1;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: var(--glass-border);
    border-radius: 24px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: var(--glass-border);
}

h1 {
    font-size: 1.8rem;
    margin: 0;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Status Indicators */
.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.disconnected {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.status-badge.connecting {
    background: rgba(234, 179, 8, 0.1);
    color: #eab308;
}

.status-badge.connected {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.status-badge.recording {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
    animation: pulse 2s infinite;
}

/* Transcript Area */
.transcript-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: rgba(15, 23, 42, 0.3);
    border-radius: 16px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.transcript-entry {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.5;
    animation: fadeIn 0.3s ease;
}

.transcript-entry.user {
    align-self: flex-end;
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.transcript-entry.assistant {
    align-self: flex-start;
    background: var(--secondary-color);
    color: white;
    border-bottom-left-radius: 4px;
}

.transcript-entry .role {
    font-size: 0.75rem;
    opacity: 0.8;
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}

.transcript-entry.temporary {
    opacity: 0.7;
}

.transcript-entry.streaming {
    opacity: 0.85;
    animation: pulse 1.5s ease-in-out infinite;
}

.transcript-entry.streaming .text::after {
    content: '▋';
    animation: blink 1s step-end infinite;
    margin-left: 2px;
    color: var(--accent-color);
}

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

@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

/* Controls */
.controls {
    display: flex;
    gap: 16px;
    justify-content: center;
    padding-top: 20px;
}

button {
    padding: 12px 24px;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.primary-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.5);
    filter: brightness(1.1);
}

.danger-btn {
    background: linear-gradient(135deg, var(--error-color) 0%, #f87171 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.danger-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.4);
    filter: brightness(1.1);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none;
    filter: grayscale(0.5);
}

/* Visualizer & Stats */
/* Visualizer & Stats */
.visualizer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(15, 23, 42, 0.3);
    border: var(--glass-border);
    border-radius: 16px;
    padding: 16px;
}

.session-stats {
    display: flex;
    justify-content: space-between;
    padding: 0;
    font-size: 0.85rem;
    color: #94a3b8;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-item span {
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    color: var(--accent-color);
    font-weight: 600;
}

.stat-label {
    font-family: 'Inter', sans-serif !important;
    color: #94a3b8 !important;
    font-size: 0.8rem;
    margin-right: 4px;
}

canvas {
    width: 100%;
    height: 60px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
}

/* Chat Input */
.chat-input-container {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    padding: 10px;
    background: rgba(15, 23, 42, 0.3);
    border: var(--glass-border);
    border-radius: 12px;
}

.chat-input-container input {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text-color);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
}

.chat-input-container input:focus {
    border-color: var(--accent-color);
    background: rgba(0, 0, 0, 0.3);
}

.chat-input-container input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: var(--accent-gradient);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.icon-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #475569;
}

/* Animations */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(99, 102, 241, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    }
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(8px);
    color: white;
    padding: 14px 20px;
    border-radius: 12px;
    border: var(--glass-border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid var(--error-color);
}

.toast.warning {
    border-left: 4px solid #eab308;
}

.toast.info {
    border-left: 4px solid var(--primary-color);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Debug Sidebar */
.debug-sidebar {
    width: 350px;
    background: #1e1e1e;
    border: var(--glass-border);
    border-radius: 24px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    max-height: 100%;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    color: #00ff00;
    transition: all 0.3s ease;
}

#debug-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#debug-content>div {
    word-break: break-word;
    line-height: 1.4;
}