/* Glassmorphism Theme for Ensemble Demos */

// SCSS Variables for internal use
$glass-blur: 10px;
$glass-blur-heavy: 20px;
$transition-speed: 0.3s;
$border-radius-base: 12px;
$border-radius-large: 16px;
$border-radius-xl: 24px;

// Mixin for glass effect
@mixin glass-effect($blur: $glass-blur) {
    backdrop-filter: blur($blur);
    -webkit-backdrop-filter: blur($blur);
}

// Mixin for hover transition
@mixin hover-transition {
    transition: all $transition-speed ease;
}

:root {
    /* Dark theme colors for glassmorphism effect */
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --surface-glass: rgba(255, 255, 255, 0.05);
    --surface-glass-hover: rgba(255, 255, 255, 0.08);
    --surface-glass-active: rgba(255, 255, 255, 0.1);
    --border-glass: rgba(255, 255, 255, 0.1);
    --border-glass-strong: rgba(255, 255, 255, 0.2);

    /* Accent colors */
    --accent-primary: #4a9eff;
    --accent-primary-glow: rgba(74, 158, 255, 0.4);
    --accent-secondary: #7c3aed;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-error: #ef4444;

    /* Text colors */
    --text-primary: rgba(255, 255, 255, 0.95);
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-tertiary: rgba(255, 255, 255, 0.5);

    /* Code background */
    --code-bg: rgba(255, 255, 255, 0.03);

    /* Shadows and effects */
    --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 40px rgba(74, 158, 255, 0.3);
    --blur-glass: blur(10px);
    --blur-heavy: blur(20px);

    /* Original variables for compatibility */
    --primary: #4a9eff;
    --primary-dark: #2d7dd2;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --background: #0f0f0f;
    --surface: rgba(255, 255, 255, 0.05);
    --text: rgba(255, 255, 255, 0.95);
    --border: rgba(255, 255, 255, 0.1);
}

/* Reset and base styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    line-height: 1.6;
    position: relative;
    overflow-x: hidden;
}

/* Consistent header styles for all demos */
.header-card {
    background: none;
    border: none;
    border-radius: 0;
    padding: 40px 0 20px;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    margin-bottom: 10px;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-card h1 {
    color: var(--accent-primary);
    margin: 0;
    display: flex;
    align-items: center;
    font-size: 32px;
    text-shadow: 0 0 20px var(--accent-primary-glow);
    gap: 1.2rem;
    padding-left: 0.2rem;
}

/* Demo cards with glassmorphism effects */
.demo-card {
    background: var(--surface-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
    will-change: transform, background, border-color, box-shadow;
    text-decoration: none;
    color: inherit;
}

.demo-card:hover {
    transform: translateY(-4px);
    background: var(--surface-glass-hover);
    border-color: var(--border-glass-strong);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 30px var(--accent-primary-glow);
}

.demo-card::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, var(--accent-primary-glow) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    border-radius: 50%;
    z-index: -1;
}

.demo-card:hover::before {
    width: 300px;
    height: 300px;
}

.demo-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 60px;
    filter: drop-shadow(0 0 10px var(--accent-primary-glow));
}

.demo-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.demo-description {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Nav tab hover effects */
.nav-tab {
    padding: 12px 24px;
    background: var(--surface-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    text-decoration: none;
}

.nav-tab:hover {
    background: var(--surface-glass-hover);
    border-color: var(--accent-primary);
    color: var(--text);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(74, 158, 255, 0.2);
}

.nav-tab.active {
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.2), rgba(74, 158, 255, 0.1));
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    text-shadow: 0 0 10px var(--accent-primary-glow);
}

/* Animated gradient background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 50%, var(--accent-primary-glow) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(124, 58, 237, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(16, 185, 129, 0.2) 0%, transparent 50%),
        linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    z-index: -2;
    /*animation: gradientShift 20s ease infinite;*/
}

@keyframes gradientShift {
    0%, 100% {
        background-size: 100% 100%, 100% 100%, 100% 100%, 100% 100%;
        background-position: 20% 50%, 80% 80%, 40% 20%, 0% 0%;
    }
    25% {
        background-size: 120% 120%, 110% 110%, 115% 115%, 100% 100%;
        background-position: 30% 60%, 70% 70%, 50% 30%, 0% 0%;
    }
    50% {
        background-size: 110% 110%, 120% 120%, 105% 105%, 100% 100%;
        background-position: 25% 40%, 85% 85%, 35% 25%, 0% 0%;
    }
    75% {
        background-size: 105% 105%, 105% 105%, 110% 110%, 100% 100%;
        background-position: 15% 55%, 75% 75%, 45% 15%, 0% 0%;
    }
}

/* Glass card component */
.glass-card {
    background: var(--surface-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-glass);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    will-change: transform;
    transform: translateZ(0); /* Enable GPU acceleration */
}

.glass-card:hover {
    background: var(--surface-glass-hover);
    border-color: var(--border-glass-strong);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glass), var(--shadow-glow);
}

/* Glass button styles */
.glass-button {
    background: var(--surface-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    gap: 12px;
}

.glass-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, var(--accent-primary-glow) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    border-radius: 50%;
}

.glass-button:hover {
    background: var(--surface-glass-hover);
    border-color: var(--accent-primary);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(74, 158, 255, 0.3);
}

.glass-button:hover::before {
    width: 200px;
    height: 200px;
}

.glass-button:active {
    transform: translateY(0);
}

.glass-button.primary {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.glass-button.primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, #0076ff 0%, transparent 70%);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    border-radius: 50%;
    z-index: 0;
}

.glass-button.primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 0 20px #0076ff;
    border-color: transparent;
}

.glass-button.primary:hover::before {
    width: 200px;
    height: 200px;
}

.glass-button.primary:active {
    transform: translateY(0);
}

.glass-button.primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.glass-button.primary > * {
    position: relative;
    z-index: 1;
}

.glass-button.outline {
    background: var(--surface-glass);
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
}

.glass-button.danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.1));
    border-color: var(--accent-error);
    color: var(--accent-error);
    font-weight: 500;
}

.glass-button.danger::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(239, 68, 68, 0.3) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    border-radius: 50%;
}

.glass-button.danger:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.3), rgba(239, 68, 68, 0.2));
    border-color: var(--accent-error);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.glass-button.danger:hover:not(:disabled)::before {
    width: 200px;
    height: 200px;
}

.glass-button.danger:active {
    transform: translateY(0);
}

.glass-button.danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Primary button variant - clean and modern */
.primary-btn {
    background: var(--accent-primary);
    backdrop-filter: var(--blur-glass);
    color: white;
    padding: 10px 24px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    border: none;
}

.primary-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, #0076ff 0%, transparent 70%);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    border-radius: 50%;
    z-index: 0;
}

.primary-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 0 20px #0076ff;
}

.primary-btn:hover::before {
    width: 200px;
    height: 200px;
}

.primary-btn:active {
    transform: translateY(0);
}

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

.primary-btn > * {
    position: relative;
    z-index: 1;
}

/* Danger button variant */
.danger-btn {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.1));
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    color: var(--accent-error);
    padding: 10px 24px; /* Adjusted for 1px border to match primary button size */
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
}

.danger-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(239, 68, 68, 0.3) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    border-radius: 50%;
}

.danger-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.3), rgba(239, 68, 68, 0.2));
    border-color: var(--accent-error);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.danger-btn:hover:not(:disabled)::before {
    width: 200px;
    height: 200px;
}

.danger-btn:active {
    transform: translateY(0);
}

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

/* Glass input styles */
.glass-input,
.glass-textarea,
.glass-select {
    background: var(--surface-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.3s ease;
    width: 100%;
}

.glass-input:focus,
.glass-textarea:focus,
.glass-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--surface-glass-active);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.glass-input::placeholder,
.glass-textarea::placeholder {
    color: var(--text-tertiary);
}

/* Glass container for sections */
.glass-container {
    background: var(--surface-glass);
    backdrop-filter: var(--blur-heavy);
    -webkit-backdrop-filter: var(--blur-heavy);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 32px;
    box-shadow: var(--shadow-glass);
}

/* Glow text effect */
.glow-text {
    text-shadow: 0 0 20px var(--accent-primary-glow);
    color: var(--accent-primary);
}

/* Status indicators with glow */
.status-glow {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    position: relative;
}

.status-glow::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    background: inherit;
    filter: blur(8px);
    opacity: 0.6;
    animation: pulse 2s infinite;
}

.status-glow.success {
    background: var(--accent-success);
}

.status-glow.warning {
    background: var(--accent-warning);
}

.status-glow.error {
    background: var(--accent-error);
}

.status-glow.primary {
    background: var(--accent-primary);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.2); opacity: 0.3; }
}

@keyframes pulse-size {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

/* Hide scrollbar by default (macOS style) */
* {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

*::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* Tab Group Styles */
.tab-group {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px;
    background: var(--surface-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    margin-bottom: 20px;
}

/* Default tab variant */
.tab-group.default {
    background: var(--surface-glass);
    border: 1px solid var(--border-glass);
}

/* Underline tab variant */
.tab-group.underline {
    background: none;
    border: none;
    border-bottom: 1px solid var(--border-glass);
    border-radius: 0;
    padding: 0;
    gap: 0;
}

/* Pills tab variant */
.tab-group.pills {
    background: rgba(255, 255, 255, 0.03);
    padding: 6px;
    gap: 4px;
}

/* Tab button base styles */
.tab-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

/* Tab button hover state */
.tab-button:hover:not(.active) {
    color: var(--text-primary);
    background: var(--surface-glass-hover);
}

/* Active tab button */
.tab-button.active {
    color: var(--accent-primary);
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.15), rgba(74, 158, 255, 0.08));
    text-shadow: 0 0 10px var(--accent-primary-glow);
}

/* Tab button glow effect */
.tab-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, var(--accent-primary-glow) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    border-radius: 50%;
    opacity: 0;
}

.tab-button.active::before {
    opacity: 0.3;
    width: 100px;
    height: 100px;
}

/* Underline variant specifics */
.tab-group.underline .tab-button {
    background: none;
    border-radius: 0;
    padding: 12px 20px;
    margin: 0;
    position: relative;
    border-bottom: 2px solid transparent;
}

.tab-group.underline .tab-button:hover:not(.active) {
    background: none;
    color: var(--text-primary);
}

.tab-group.underline .tab-button.active {
    background: none;
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.tab-group.underline .tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-primary);
    box-shadow: 0 0 10px var(--accent-primary-glow);
}

/* Pills variant specifics */
.tab-group.pills .tab-button {
    border-radius: 20px;
    padding: 8px 20px;
}

.tab-group.pills .tab-button:hover:not(.active) {
    background: var(--surface-glass-hover);
}

.tab-group.pills .tab-button.active {
    background: var(--accent-primary);
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Tab icon styling */
.tab-icon {
    font-size: 16px;
    display: flex;
    align-items: center;
    transition: transform 0.3s ease;
}

.tab-button:hover .tab-icon {
    transform: scale(1.1);
}

.tab-button.active .tab-icon {
    filter: drop-shadow(0 0 8px var(--accent-primary-glow));
}

/* Tab label styling */
.tab-label {
    font-weight: inherit;
    transition: all 0.3s ease;
}

/* Responsive adjustments for tabs */
@media (max-width: 640px) {
    .tab-button {
        padding: 8px 12px;
        font-size: 13px;
    }

    .tab-icon {
        font-size: 14px;
    }

    .tab-group {
        gap: 4px;
    }

    .tab-group.underline .tab-button {
        padding: 10px 16px;
    }

    .tab-group.pills .tab-button {
        padding: 6px 16px;
    }
}

/* Loading animation */
.glass-loader {
    display: inline-block;
    width: 48px;
    height: 48px;
    position: relative;
}

.glass-loader::after {
    content: '';
    display: block;
    width: 38px;
    height: 38px;
    margin: 5px;
    border-radius: 50%;
    border: 3px solid var(--accent-primary);
    border-color: var(--accent-primary) transparent var(--accent-primary) transparent;
    animation: glass-loader 1.2s linear infinite;
}

@keyframes glass-loader {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive utilities */
@media (max-width: 768px) {
    .glass-card {
        padding: 16px;
        border-radius: 12px;
    }

    .glass-container {
        padding: 20px;
        border-radius: 16px;
    }

    .glass-button {
        padding: 10px 20px;
        font-size: 14px;
    }
}

/* Animation utilities */
.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

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

.slide-up {
    animation: slideUp 0.5s ease forwards;
}

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

/* Neon border effect */
.neon-border {
    position: relative;
}

.neon-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg, var(--accent-primary), var(--accent-secondary), var(--accent-primary));
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
    filter: blur(10px);
}

.neon-border:hover::before {
    opacity: 0.7;
}

/* Glass navigation bar */
.glass-nav {
    background: rgba(15, 15, 15, 0.8);
    backdrop-filter: var(--blur-heavy);
    -webkit-backdrop-filter: var(--blur-heavy);
    border-bottom: 1px solid var(--border-glass);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Active button state */
.glass-button-active {
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.3), rgba(74, 158, 255, 0.2));
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--accent-primary);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-shadow: 0 0 10px var(--accent-primary-glow);
}

/* Utility class to remove underlines from links */
.no-underline {
    text-decoration: none !important;
}

/* Links should inherit color */
a.glass-card {
    text-decoration: none;
    color: inherit;
}

/* Audio visualizer bars - frequency spectrum style */
.audio-bar {
    width: 3px; /* Reduced from 4px (25% reduction, close to 30%) */
    min-height: 4px;
    background: linear-gradient(to top, var(--accent-primary), var(--accent-primary-glow));
    border-radius: 2px;
    transition: height 0.08s ease-out; /* Slightly slower for frequency changes */
    transform-origin: bottom;
    box-shadow: 0 0 5px var(--accent-primary-glow);
    will-change: height; /* Optimize for animations */
}

/* Voice Demo specific styles */
.textarea-wrapper {
    position: relative;
    margin-bottom: 16px;
}

.textarea-wrapper textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    background: var(--surface-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    transition: all 0.3s ease;
}

.textarea-wrapper textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--surface-glass-active);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.char-counter {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--surface);
    padding: 2px 6px;
    border-radius: 4px;
}

.examples-section {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.generate-button-container {
    flex-shrink: 0;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-primary-glow);
}

.slider-value {
    min-width: 50px;
    text-align: right;
    font-weight: 500;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 4px;
    overflow: hidden;
    margin: 16px 0;
    display: none;
}

.progress-bar.active {
    display: block;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), rgba(74, 158, 255, 0.6));
    width: 0;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px var(--accent-primary-glow);
}

.audio-player-section {
    margin-top: 24px;
    padding: 20px;
    background: var(--surface-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
}

.audio-player {
    width: 100%;
    margin-top: 12px;
}

.download-btn {
    margin-top: 12px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.1));
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--accent-success);
    color: var(--accent-success);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.download-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.3), rgba(16, 185, 129, 0.2));
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.history-section {
    margin-top: 24px;
}

.history-item {
    padding: 12px;
    background: var(--surface-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.history-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 12px;
}

.history-controls {
    display: flex;
    gap: 8px;
}

.history-btn {
    padding: 6px 12px;
    font-size: 14px;
}

/* Additional styles from original embed-client.html to match exactly */

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

/* Shared Component Styles */

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.stats-grid.three-col {
    grid-template-columns: repeat(3, 1fr);
}

.stat-item {
    background: var(--surface-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.stat-icon {
    font-size: 16px;
}

.stat-value {
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
}

/* Model Selector */
.glass-select {
    width: 100%;
    background: var(--surface-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 12px;
    color: var(--text-primary);
    font-size: 16px;
    transition: all 0.3s ease;
    cursor: pointer;
    outline: none;
}

.glass-select:hover {
    border-color: var(--border-glass-strong);
    background: var(--surface-glass-hover);
}

.glass-select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.glass-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Settings Panel */
.settings-panel {
    margin-bottom: 20px;
}

.settings-panel h3 {
    margin-bottom: 16px;
    color: var(--text-primary);
    font-size: 18px;
}

.glass-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--surface-glass);
    border-radius: 3px;
    outline: none;
    transition: all 0.3s ease;
}

.glass-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.glass-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px var(--accent-primary-glow);
}

.glass-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.glass-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px var(--accent-primary-glow);
}

.toggle-label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.toggle-label input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.toggle-text {
    color: var(--text-primary);
}

/* Error Message */
.error-message {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-icon {
    font-size: 20px;
}

/* Code Modal Styles */
.modal-content {
    height: 100%;
}

.tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.code-content {
    position: relative;
}

.code-content pre {
    background: var(--code-bg);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 20px;
    overflow-x: auto;
    max-height: 500px;
    margin: 0;
}

.code-content code {
    color: var(--text-primary);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
}

.copy-button {
    position: absolute;
    top: 10px;
    right: 10px;
}

.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.card {
    background: var(--surface-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-glass);
}

.full-width {
    grid-column: 1 / -1;
}

.generate-code-btn {
    background: var(--surface-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.generate-code-btn:hover {
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.2), rgba(74, 158, 255, 0.1));
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--accent-primary-glow);
    text-shadow: 0 0 10px var(--accent-primary-glow);
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--surface-glass);
    backdrop-filter: var(--blur-heavy);
    -webkit-backdrop-filter: var(--blur-heavy);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
}

.modal-content {
    position: relative;
    background: transparent;
    padding: 0;
    max-width: 90vw;
    max-height: 90vh;
}

.modal-content.markdown-modal {
    border-radius: 16px;
    padding: 32px;
    overflow-y: auto;
    background: #263349;
    background: linear-gradient(135deg, rgb(74 158 255 / 40%) 0, transparent 100%), radial-gradient(circle at 80% 80%, rgba(124, 58, 237, .3) 0, transparent 50%), linear-gradient(191deg, rgba(16, 185, 129, .2) 0, transparent 50%), linear-gradient(209deg, var(--bg-primary) 0, var(--bg-secondary) 100%);
}

.modal-content.image-modal {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
}

.modal-content.image-modal img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.modal-tabs-section {
    border-bottom: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.03);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    margin: 0;
    font-size: 20px;
    color: var(--text);
}

.modal-close {
    position: fixed;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(0, 0, 0, 0.85);
    padding: 0;
    border-radius: 50%;
    transition: all 0.2s;
    z-index: 10;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
    color: rgba(0, 0, 0, 1);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.code-tabs {
    display: flex;
    gap: 8px;
    padding: 0 24px;
}

.code-tab {
    background: none;
    border: none;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.code-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.code-container {
    position: relative;
    background: var(--code-bg);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 20px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    overflow-x: auto;
    color: var(--text-primary);
}

.code-container pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-all;
}

.copy-button {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--surface-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-button:hover {
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.2), rgba(74, 158, 255, 0.1));
    transform: translateY(-1px);
    box-shadow: 0 2px 8px var(--accent-primary-glow);
}

.copy-button.copied {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.1));
    border-color: var(--accent-success);
    color: var(--accent-success);
}

h2 {
    margin-bottom: 16px;
    color: var(--text);
    font-size: 20px;
}

h3 {
    color: var(--text);
    font-size: 16px;
}

.connection-warning {
    background: var(--surface-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--accent-warning);
    color: var(--accent-warning);
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: fadeIn 0.3s ease;
}

.input-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.text-inputs {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.text-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

input[type="text"] {
    flex: 1;
    padding: 12px 16px;
    background: var(--surface-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    color: var(--text);
    transition: all 0.3s ease;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--surface-glass-active);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

input[type="text"]::placeholder {
    color: var(--text-tertiary);
}

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

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


.secondary-btn {
    background: var(--surface-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    color: var(--text);
}

.secondary-btn:hover:not(:disabled) {
    background: var(--surface-glass-hover);
    border-color: var(--border-glass-strong);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}


.icon-btn {
    padding: 8px;
    background: transparent;
    color: var(--text-secondary);
}

.icon-btn:hover {
    background: var(--surface-glass-hover);
    color: var(--text-primary);
    border-radius: 8px;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-label {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-secondary);
}

select {
    padding: 10px 12px;
    background: var(--surface-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s ease;
}

select:hover {
    border-color: var(--border-glass-strong);
    background: var(--surface-glass-hover);
}

select:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--surface-glass-active);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--surface-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    border-radius: 4px;
    overflow: hidden;
    margin: 16px 0;
    display: none;
}

.progress-bar.active {
    display: block;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    width: 0;
    transition: width 0.3s ease;
    box-shadow: inset 0 0 10px var(--accent-primary-glow);
}

.embeddings-list {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.embedding-item {
    padding: 16px;
    background: var(--surface-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.embedding-item:hover {
    border-color: var(--accent-primary);
    background: var(--surface-glass-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--accent-primary-glow);
}

.embedding-item.selected {
    border-color: var(--accent-primary);
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.1), rgba(74, 158, 255, 0.05));
    box-shadow: 0 0 0 2px var(--accent-primary-glow);
}

.embedding-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.embedding-text {
    font-weight: 500;
    color: var(--text);
}

.embedding-meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-secondary);
}

.search-section {
    margin-bottom: 20px;
}

.search-input-wrapper {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-item {
    padding: 16px;
    background: var(--surface-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    border-left: 4px solid var(--accent-primary);
    box-shadow: inset 4px 0 0 0 var(--accent-primary-glow);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.similarity-score {
    font-size: 24px;
    font-weight: bold;
    color: var(--accent-primary);
    text-shadow: 0 0 10px var(--accent-primary-glow);
}

.similarity-bar {
    height: 8px;
    background: var(--surface-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.similarity-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-success), var(--accent-primary));
    transition: width 0.3s ease;
    box-shadow: inset 0 0 10px rgba(16, 185, 129, 0.3);
}

.analysis-section {
    padding: 20px;
    background: var(--surface-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    margin-top: 16px;
}

.analysis-content {
    white-space: pre-wrap;
    font-family: inherit;
    line-height: 1.6;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.stat-card {
    background: var(--surface-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: none !important;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    border-color: var(--border-glass-strong);
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: var(--accent-primary);
    text-shadow: 0 0 10px var(--accent-primary-glow);
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.example-btn {
    padding: 8px 16px;
    background: var(--surface-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
    font-size: 14px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.example-btn:hover {
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.2), rgba(74, 158, 255, 0.1));
    color: var(--text-primary);
    text-shadow: 0 0 10px var(--accent-primary-glow);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px var(--accent-primary-glow);
}

.error-message {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.05));
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--accent-error);
    padding: 12px 16px;
    border-radius: 12px;
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: inset 0 0 20px rgba(239, 68, 68, 0.1);
}

@media (max-width: 768px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
}

/* Listen Demo specific styles */
.status-section {
    padding: 0px 0px 10px 12px;
}

.control-header {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: space-between;
}

.control-header .status {
    flex: 1;
    min-width: 150px;
}

.control-header .model-select {
    min-width: 250px;
    max-width: 350px;
    flex: 1;
}

.control-header .controls {
    display: flex;
    gap: 12px;
}

.control-header .controls button {
    white-space: nowrap;
}

.status {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e0e0e0;
    transition: all 0.3s;
}

.status.connected .status-indicator {
    background: #0add00;
    animation: pulse-size 2s infinite;
}

.status.connecting .status-indicator {
    background: #e0e0e0; /* Keep default gray/white */
    animation: pulse 1s infinite;
}

.status.error .status-indicator {
    background: var(--error);
}

.controls {
    display: flex;
    gap: 12px;
}


.transcript-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.transcript-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.transcript-container {
    background: var(--surface-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 20px;
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 14px;
    line-height: 1.8;
}

.transcript-empty {
    color: var(--text-secondary);
    text-align: center;
    padding: 40px;
}

.transcript-line {
    margin-bottom: 8px;
    padding: 4px 0;
    animation: fadeIn 0.3s ease;
}

.transcript-line.preview {
    color: var(--accent-primary);
    font-style: italic;
    opacity: 0.9;
    text-shadow: 0 0 5px var(--accent-primary-glow);
}

.audio-visualizer {
    height: 120px;
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.05), rgba(74, 158, 255, 0.02));
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    margin: 20px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    overflow: hidden;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.2), 0 4px 20px rgba(74, 158, 255, 0.1);
    position: relative;
    gap: 2px;
    padding: 0 20px;
}

/* Time-domain audio visualizer - matching original exactly */
.audio-bar {
    width: 3px;
    background: #1a73e8;
    border-radius: 2px;
    transition: height 0.1s ease;
}


.model-select {
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    font-size: 15px;
    color: var(--text);
    transition: all 0.3s ease;
    font-weight: 500;
    max-width: 100%;
}

.model-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--surface-glass-active);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.model-select optgroup {
    font-weight: 600;
}

/* Message Component Styles */
.message {
    display: flex;
    flex-direction: column;
    gap: 3px;
    animation: fadeIn 0.3s ease;
}

.message.user {
    align-items: flex-end;
}

.message.assistant {
    align-items: flex-start;
}

.message-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    max-width: 100%;
    width: 100%;
}

.message.user .message-row {
    flex-direction: row-reverse;
}

.message-metadata {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    color: hsl(0deg 0% 100% / 30%);
    max-width: 100%;
    padding-left: 49px;
}

.message-details {
    display: flex;
    align-items: center;
    gap: 0;
    margin-left: auto;
}

.message.user .message-metadata {
    flex-direction: row-reverse;
    padding-left: 0;
    padding-right: 48px; /* 36px avatar + 12px gap */
}

.message.user .message-details {
    margin-left: 0;
    margin-right: auto;
}

.message-model {
    font-weight: 500;
}

.message-timestamp {
    opacity: 0.7;
}

.message-tags {
    display: flex;
    gap: 4px;
    align-items: center;
}

.message-tag {
    background: rgba(74, 158, 255, 0.15);
    color: var(--accent-primary);
    border: 1px solid rgba(74, 158, 255, 0.3);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    backdrop-filter: blur(8px);
    transition: all 0.2s ease;
}

.message-tag:hover {
    background: rgba(74, 158, 255, 0.25);
    border-color: rgba(74, 158, 255, 0.5);
    transform: translateY(-1px);
}

.message-agent-tags {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-left: 8px;
}

.message-agent-tag {
    background: rgba(138, 43, 226, 0.15);
    color: #ba6dff;
    border: 1px solid rgba(138, 43, 226, 0.3);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    backdrop-filter: blur(8px);
    transition: all 0.2s ease;
}

.message-agent-tag:hover {
    background: rgba(138, 43, 226, 0.25);
    border-color: rgba(138, 43, 226, 0.5);
    transform: translateY(-1px);
}

.message-request-stats {
    display: flex;
    gap: 6px;
    align-items: center;
    font-size: 11px;
    color: var(--text-tertiary);
    margin-left: 8px;
}

.request-cost {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    padding: 2px 6px;
    border-radius: 6px;
    font-weight: 500;
}

.request-duration {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    padding: 2px 6px;
    border-radius: 6px;
    font-weight: 500;
}

.duration-with-tools {
    color: var(--text-tertiary);
    font-size: 10px;
}

.message-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: opacity 0.2s ease;
    user-select: none;

    &:hover {
        opacity: 0.8;
    }

    &.expanded {
        padding: 0px 0px 13px;
        border-bottom: 1px solid hsla(0, 0%, 100%, .05);
    }
}

.expandable-content {
    will-change: max-height;
}

.expand-icon {
    display: inline-block;
    font-size: 12px;
}

.message-prefix {
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 8px;
}

.message-avatar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 600;
    color: white;
    background: none !important;
    backdrop-filter: none !important;

    svg {
        fill: hsl(0deg 0% 100% / 10%);
        max-width: 40%;
        max-height: 40%;
    }
}

.message-avatar.user {
    background: var(--accent-primary);
}

.message-avatar.assistant {
    background: var(--accent-secondary);
}

.message-content-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.message-content {
    flex: 1;
    min-width: 0;

   .glass {
        background: rgba(16, 185, 129, 0.05);
        backdrop-filter: var(--blur-glass);
        border: 1px solid rgba(16, 185, 129, 0.2);
        padding: 1rem 1.2rem;
        border-radius: 0.8rem;
        margin-top: 0;
        margin-bottom: 1rem;
        font-size: 0.93rem;

        &.thinking-content {
            background: rgba(124, 58, 237, .05);
            border-color: rgba(124, 58, 237, .3);
            font-style: italic;
            font-size: 0.85rem;
            line-height: 1.2rem;

            & + .tool-calls {
                margin-top: 2rem;
            }
        }

        &.tool-call {
            background: transparent;
            border-color: transparent;
            backdrop-filter: none;
            padding-top: 0;
        }

        ul, ol {
            padding-inline-start: 1em;
        }

        hr {
            border-color: rgba(16, 185, 129, 0.2);
            margin: 1rem 0;
        }

        p, ul, ol {
            margin: 0 0 0.5rem 0;
        }

        p:last-child, ul:last-child, ol:last-child {
            margin-bottom: 0;
        }

        pre {
            white-space: pre-wrap;
        }
    }

    &.user .glass {
        background: linear-gradient(135deg, rgba(74, 158, 255, 0.1), rgba(74, 158, 255, 0.05));
        border-color: rgba(74, 158, 255, 0.3);
    }

}

.message-text {
    line-height: 1.6;
    color: var(--text-primary);
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message-text p {
    margin: 0 0 8px 0;
}

.message-text p:last-child {
    margin-bottom: 0;
}

.message-text code {
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.message-text pre {
    background: var(--code-bg);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 12px;
    overflow-x: auto;
    margin: 8px 0;
}

.message-text pre code {
    background: none;
    padding: 0;
}

.message-text ul,
.message-text ol {
    margin: 8px 0;
    padding-left: 24px;
}

.message-text li {
    margin: 4px 0;
}

.message-text strong {
    font-weight: 600;
    color: var(--text-primary);
}

.message-text em {
    font-style: italic;
    opacity: 0.9;
}

.message-text a {
    color: var(--accent-primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.message-text a:hover {
    border-bottom-color: var(--accent-primary);
}

/* Thinking content styles */
.thinking-content {
    margin-top: 12px;
    padding: 12px;
    background: rgba(124, 58, 237, 0.05);
    border: 1px solid rgba(124, 58, 237, 0.2);
    border-radius: 8px;
}

.thinking-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--accent-secondary);
    font-weight: 500;
}

.thinking-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    white-space: pre-wrap;
}

/* Tool call styles */
.tool-calls {
    display: flex;
    flex-direction: column;
}

.tool-call, .tool-result {
    border-radius: 8px;
    font-size: 14px;
    padding: 10px;

    pre {
        white-space: pre-wrap;
    }

    .tool-arguments {
        color: #ababab;

        strong {
            font-weight: 400;;
        }
    }
}

.tool-result {
    border-top: 1px solid hsla(0, 0%, 100%, .05);

    ol, ul {
        max-width: 100%;
        word-wrap: break-word;
        word-break: break-all;

        li {
            word-wrap: break-word;
            word-break: break-all;
        }
    }
    p {
        word-wrap: break-word;
        word-break: break-all;
    }
}
.tool-call + .tool-result {
    padding-top: 20px;
    margin-top: 1rem;
}

.tool-call-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.tool-call-name {
    font-weight: 500;
    color: var(--accent-primary);
}

.tool-call-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.tool-call-status.running {
    color: var(--accent-warning);
}

.tool-call-status.completed {
    color: var(--accent-success);
}

.tool-call-status.error {
    color: var(--accent-error);
}

.tool-call-args {
    background: var(--code-bg);
    border: 1px solid var(--border-glass);
    border-radius: 6px;
    padding: 8px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    overflow-x: auto;
    margin-bottom: 8px;
}

.tool-call-result {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 6px;
    padding: 8px;
    font-size: 13px;
    color: var(--text-primary);
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

/* Conversation container styles */
.conversation {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0px 3%;
}

.conversation-container {
    flex: 1;
    overflow-y: auto;
    padding: 30px 0;
}

.conversation-wrapper {
    display: flex;
    min-height: 100%;
    padding: 20px 0;
}

.memory-tag-graph-wrapper {
    flex-shrink: 0;
    min-width: 40px;
    padding-left: 8px;
    padding-right: 8px;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100%;
    transition: width 200ms ease-out;
    animation: fadeIn 300ms ease-in;
}

.memory-tag-graph {
    position: relative;
    height: 100%;
    
    svg {
        display: block;
        position: relative;
        
        // Smooth transitions for all hover effects
        circle, line, path, rect, text {
            transition: all 0.2s ease;
        }
        
        // Add animation for new tags
        @keyframes fadeInScale {
            from {
                opacity: 0;
                transform: scale(0.8);
            }
            to {
                opacity: 1;
                transform: scale(1);
            }
        }
        
        // Glow effect for hovered elements
        circle[filter="blur(2px)"] {
            animation: pulse 2s infinite;
        }
        
        @keyframes pulse {
            0%, 100% {
                opacity: 0.2;
            }
            50% {
                opacity: 0.4;
            }
        }
        
        // Label hover effects
        g[style*="cursor: pointer"]:hover text {
            transform: translateY(-1px);
        }
    }
}

.messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-left: 0;
}

/* Thread styles */
.message-thread {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--surface-glass);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    margin-right: 8px;
}

.thread-icon {
    font-size: 14px;
}

.thread-main {
    border-color: rgba(74, 158, 255, 0.3);
    background: rgba(74, 158, 255, 0.1);
    color: var(--accent-primary);
}

.thread-metamemory {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.thread-metacognition {
    border-color: rgba(124, 58, 237, 0.3);
    background: rgba(124, 58, 237, 0.1);
    color: #7c3aed;
}

/* Thread message styling */
.message.thread-main {
    border-left: 3px solid rgba(74, 158, 255, 0.5);
    padding-left: 13px;
}

.message.thread-metamemory {
    border-left: 3px solid rgba(239, 68, 68, 0.5);
    padding-left: 13px;
    background: linear-gradient(to right, rgba(239, 68, 68, 0.05) 0%, transparent 100%);
}

.message.thread-metacognition {
    border-left: 3px solid rgba(124, 58, 237, 0.5);
    padding-left: 13px;
    background: linear-gradient(to right, rgba(124, 58, 237, 0.05) 0%, transparent 100%);
}

/* Compact mode */
.message.compact {
    padding: 8px 0;
}

.message.compact .message-metadata {
    display: none;
}

/* Empty state */
.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
    font-size: 14px;
}

/* Loading indicator */
.loading-indicator {
    display: flex;
    padding: 30px 50px;
}

.loading-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.loading-dots .dot {
    width: 8px;
    height: 8px;
    background-color: var(--text-tertiary);
    border-radius: 50%;
    animation: loading-pulse 1.4s ease-in-out infinite;
}

.loading-dots .dot:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots .dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes loading-pulse {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Code Modal Specific Fixes */
.code-modal {
    .modal-tabs-section {
        padding: 0 24px;
        margin: 0 -24px;
        background: transparent;
        border-bottom: none;
    }
    
    .tab-group.underline {
        margin-bottom: 0;
        background: transparent;
        border-bottom: 1px solid var(--border-glass);
    }
    
    .code-modal-content {
        padding: 0;
        margin: 0;
    }
    
    /* Fix for code display container */
    .code-display {
        margin: 0;
        border-radius: 0;
        border: none;
        background: var(--code-bg);
    }
    
    .code-display pre {
        margin: 0;
        padding: 24px;
        border-radius: 0;
        border: none;
        background: transparent;
        max-height: 60vh;
        overflow: auto;
    }
    
    /* Fix the copy button position */
    .code-display .copy-button {
        position: absolute;
        top: 12px;
        right: 12px;
        z-index: 10;
    }
    
    /* Remove extra padding from modal body */
    .enhanced-modal-body {
        padding: 0;
    }
    
    /* Ensure tab panel has no extra spacing */
    .tab-panel {
        padding: 0;
    }
}

/* Code Display Component Styles */
.code-display {
    position: relative;
    background: var(--code-bg, #1e1e1e);
    border-radius: 8px;
    overflow: hidden;
    
    .code-container {
        position: relative;
        overflow: auto;
        
        /* Custom scrollbar for code */
        &::-webkit-scrollbar {
            width: 8px;
            height: 8px;
            display: block;
        }
        
        &::-webkit-scrollbar-track {
            background: rgba(255, 255, 255, 0.05);
        }
        
        &::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.2);
            border-radius: 4px;
            
            &:hover {
                background: rgba(255, 255, 255, 0.3);
            }
        }
    }
    
    pre {
        margin: 0;
        padding: 20px;
        font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
        font-size: 14px;
        line-height: 1.6;
        color: #d4d4d4;
        white-space: pre;
        overflow-x: auto;
    }
    
    code {
        font-family: inherit;
        font-size: inherit;
        color: inherit;
        background: none;
        padding: 0;
    }
    
    /* Copy button styling */
    .copy-button {
        position: absolute;
        background: var(--surface-glass);
        backdrop-filter: var(--blur-glass);
        -webkit-backdrop-filter: var(--blur-glass);
        border: 1px solid var(--border-glass);
        color: var(--text-secondary);
        padding: 6px 12px;
        border-radius: 8px;
        font-size: 13px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s ease;
        display: flex;
        align-items: center;
        gap: 6px;
        z-index: 10;
        
        &.top {
            top: 12px;
            right: 12px;
        }
        
        &.bottom {
            bottom: 12px;
            right: 12px;
        }
        
        &:hover {
            background: var(--surface-glass-hover);
            color: var(--text-primary);
            border-color: var(--border-glass-strong);
            transform: translateY(-1px);
        }
        
        &.copied {
            color: var(--accent-success);
            border-color: var(--accent-success);
        }
        
        svg {
            width: 16px;
            height: 16px;
        }
    }
}
/* Final merged and refined style.scss */

/* Grid and Layout */
.conversation-wrapper {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: 8px; /* Reduced gap for closer integration */
}

/* Animations */
.tag-introduction, .tagged-message {
    animation: fadeIn 300ms ease-in;
}

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

/* Highlighted Message */
.message.highlighted {
    background: rgba(255,255,255,0.03); /* Softer background */
    border-left: 3px solid rgba(255,255,255,0.2); /* Thinner, softer border */
    transition: background 300ms ease-in-out, border-left 300ms;
}

/* Tagged Message Indicator */
.tagged-message {
    position: relative;
}

/* Branch spacing for visual separation */
.tag-introduction {
    margin-top: 50px;
    padding: 0px 4px 0px;
    background: none;
    border: none;
    cursor: default;
}

.tag-header {
    transition: opacity 0.2s ease;
    
    &:hover {
        opacity: 0.8;
    }
}

.tag-description {
    color: hsla(0, 0%, 100%, .3);
    font-size: 12px;
    margin: 4px 0 0;
    line-height: 1.3;
    animation: fadeIn 0.3s ease;
}

.tag-introduction:first-child {
    margin-top: 0; /* No extra spacing for the very first tag */
}

.message.branch-end {
    margin-bottom: 10px;
}

.message.branch-end:last-child {
    margin-bottom: 0; /* No extra spacing after the very last message */
}

/* Message Images */
.message-images {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.transparent-grid-bg, .transparent-grid-bg-small, .transparent-grid-bg-large {
    background: #ffffff;
    background: conic-gradient(#ffffff 90deg, #f0f0f0 90deg 180deg, #ffffff 180deg 270deg, #f0f0f0 270deg);
    background-repeat: repeat;
    background-size: 40px 40px;
    background-position: top left;
}
.transparent-grid-bg-small {
    background-size: 17px 17px;
}
.transparent-grid-bg-large {
    background-size: 70px 70px;
}

.message-image-container {
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    cursor: pointer;
    height: 140px;
    overflow: hidden;
    transition: all .2s ease;
    width: 200px;
    
    &:hover {
        border-color: var(--accent-primary);
        transform: translateY(-2px);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    }
}

/* No Content Component */
.no-content {
    color: var(--text-secondary);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 200px;
    padding: 20px;
}

.message-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.2s ease;
    
    .message-image-container:hover & {
        transform: scale(1.05);
    }
}

.image-modal-content {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    
    img {
        border-radius: 8px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    }
}

/* Removed ::before */

/* Media Queries */
@media (max-width: 768px) {
    .with-graph .conversation-wrapper {
        grid-template-columns: 1fr;
    }
    .memory-tag-graph-wrapper {
        display: none;
    }
}

/* Message Body Refinements (to fix bubble borders) */
.message-body.glass {
    border: 1px solid rgba(var(--color), 0.15); /* Softer border opacity */
    border-radius: 12px; /* Ensure consistent rounding */
    background: rgba(var(--color), 0.03); /* Lighter background */
    backdrop-filter: blur(8px); /* Slightly less blur if overwhelming */
}

.float {
    animation: floatAnimation 3s ease-in-out infinite;
}

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

.message-body {
    a {
        color: #fff;
    }
}