/* Modern Professional Chat Interface */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Glossy Black Theme */
    --primary-color: #00d4ff;
    --primary-dark: #0099cc;
    --primary-light: #66e6ff;
    --secondary-color: #ff006e;
    --accent-color: #ffaa00;

    /* Black Theme Colors */
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2a;
    --bg-glossy: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 50%, #1a1a1a 100%);
    --bg-matte: #0f0f0f;

    /* Glossy Surfaces */
    --gloss-black: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 30%, #0a0a0a 60%, #1a1a1a 100%);
    --gloss-highlight: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%, rgba(0, 0, 0, 0.3) 100%);

    /* Text Colors for Black Theme */
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #999999;
    --text-light: #666666;

    /* Cyan Accents for Glossy Effect */
    --cyan-glow: #00d4ff;
    --cyan-bright: #33e6ff;
    --cyan-dark: #0099cc;

    /* Border Colors */
    --border-light: #333333;
    --border-medium: #555555;
    --border-dark: #777777;

    /* Status Colors */
    --success-color: #00ff88;
    --warning-color: #ffaa00;
    --error-color: #ff4444;
    --listening-color: #ff006e;

    /* Enhanced Shadows for Black Theme */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    --shadow-cyan: 0 0 20px rgba(0, 212, 255, 0.3);

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background:
        radial-gradient(circle at 20% 80%, rgba(0, 212, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 0, 110, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
        linear-gradient(135deg, #0a0a0a 0%, #000000 50%, #0a0a0a 100%);
    background-attachment: fixed;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    color: var(--text-primary);
    position: relative;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--space-md);
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0, 212, 255, 0.03) 2px,
            rgba(0, 212, 255, 0.03) 4px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(0, 212, 255, 0.03) 2px,
            rgba(0, 212, 255, 0.03) 4px
        );
    pointer-events: none;
    z-index: -1;
}

/* Chat Container */
.chat-container {
    width: 100%;
    max-width: 900px;
    height: 85vh;
    background: var(--gloss-black);
    border-radius: var(--radius-xl);
    box-shadow:
        var(--shadow-xl),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.chat-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 30% 20%, rgba(0, 212, 255, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 70% 80%, rgba(255, 0, 110, 0.05) 0%, transparent 40%),
        linear-gradient(135deg, transparent 0%, rgba(0, 212, 255, 0.02) 50%, transparent 100%);
    border-radius: var(--radius-xl);
    pointer-events: none;
    z-index: 0;
}

.chat-container > * {
    position: relative;
    z-index: 1;
}

/* Header */
.chat-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: var(--space-xl);
    text-align: center;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.05)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.08)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.chat-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--space-xs);
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.chat-header p {
    font-size: 0.95rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
    font-weight: 300;
}

/* Settings Bar */
.settings {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    margin-top: var(--space-lg);
    padding: var(--space-md) var(--space-xl);
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex-wrap: wrap;
}

.settings label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    font-weight: 500;
    min-width: fit-content;
}

.settings select {
    padding: var(--space-sm) var(--space-md);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    outline: none;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.95);
    color: #1a1a1a;
    font-weight: 600;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    text-shadow: none;
}

.settings select:hover {
    border-color: rgba(255, 255, 255, 0.5);
    background: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.settings select:focus {
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
    background: white;
}

/* Model Status */
.model-status {
    padding: var(--space-md) var(--space-xl);
    background: linear-gradient(90deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-bottom: 1px solid var(--border-light);
    font-size: 0.875rem;
    display: flex;
    gap: var(--space-xl);
    justify-content: center;
    flex-wrap: wrap;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.model-status p {
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.model-status strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* Chat Messages */
.chat-messages {
    flex-grow: 1;
    padding: var(--space-xl);
    overflow-y: auto;
    background:
        radial-gradient(circle at 20% 30%, rgba(0, 212, 255, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 0, 110, 0.08) 0%, transparent 50%),
        linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-primary) 100%);
    scroll-behavior: smooth;
    position: relative;
}

.chat-messages::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 1px,
            rgba(0, 212, 255, 0.02) 1px,
            rgba(0, 212, 255, 0.02) 2px
        );
    pointer-events: none;
    z-index: 0;
}

.chat-messages > * {
    position: relative;
    z-index: 1;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: var(--radius-full);
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--border-dark);
}

/* Messages */
.message {
    margin-bottom: var(--space-lg);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    max-width: 75%;
    position: relative;
    animation: messageSlideIn 0.3s ease-out;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

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

.user-message {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
}

.user-message::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: -8px;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-left-color: var(--primary-dark);
    border-bottom: 0;
}

.sarah-message {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-bottom-left-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}

.sarah-message::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -8px;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-right-color: var(--bg-primary);
    border-bottom: 0;
}

/* Chat Input */
.chat-input {
    padding: var(--space-xl);
    border-top: 1px solid var(--border-light);
    background:
        radial-gradient(ellipse at center bottom, rgba(0, 212, 255, 0.05) 0%, transparent 70%),
        var(--bg-primary);
    display: flex;
    gap: var(--space-md);
    align-items: center;
    position: relative;
    flex-shrink: 0;
}

.chat-input::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        linear-gradient(90deg, transparent 0%, rgba(0, 212, 255, 0.02) 50%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}

.chat-input > * {
    position: relative;
    z-index: 1;
}

#user-input {
    flex-grow: 1;
    padding: var(--space-lg);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    outline: none;
    font-size: 1rem;
    font-family: inherit;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.2s ease;
    font-weight: 400;
}

#user-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background: var(--bg-primary);
}

#user-input::placeholder {
    color: var(--text-muted);
}

/* Buttons */
#send-button {
    padding: var(--space-lg) var(--space-xl);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
    min-width: 80px;
}

#send-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--primary-dark) 0%, #3730a3 100%);
}

#send-button:active {
    transform: translateY(0);
}

#mic-button {
    padding: var(--space-lg);
    background: var(--bg-secondary);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.2rem;
    min-width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

#mic-button:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-medium);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

#mic-button.listening {
    background: linear-gradient(135deg, var(--listening-color) 0%, #dc2626 100%);
    color: white;
    border-color: var(--listening-color);
    animation: listeningPulse 1.5s infinite;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
}

@keyframes listeningPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 30px rgba(239, 68, 68, 0.6);
    }
}

/* Settings Toggle */
#settings-toggle {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

#settings-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

/* Settings Panel */
.settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    max-height: 85vh;
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.settings-header {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    padding: var(--space-xl);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.settings-header h3 {
    color: var(--text-primary);
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.settings-header h3::before {
    content: '⚙️';
    font-size: 1rem;
}

#close-settings {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: var(--space-sm);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

#close-settings:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Settings Content */
.settings-content {
    padding: var(--space-xl);
    max-height: 60vh;
    overflow-y: auto;
}

.settings-content::-webkit-scrollbar {
    width: 6px;
}

.settings-content::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
}

.settings-content::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: var(--radius-full);
}

.settings-section {
    margin-bottom: var(--space-xl);
    padding: var(--space-lg);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h4 {
    margin-bottom: var(--space-lg);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.setting-group {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group label {
    min-width: 140px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.setting-group select,
.setting-group input {
    flex-grow: 1;
    padding: var(--space-md);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    outline: none;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 200px;
}

.setting-group select:hover,
.setting-group input:hover {
    border-color: var(--border-medium);
}

.setting-group select:focus,
.setting-group input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.setting-group button {
    padding: var(--space-md) var(--space-lg);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    min-width: 80px;
}

.setting-group button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    background: linear-gradient(135deg, var(--primary-dark) 0%, #3730a3 100%);
}

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

/* Chat Mode Toggle */
.chat-mode-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    position: relative;
}

.chat-mode-toggle input[type="checkbox"] {
    width: 44px;
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    border: none;
    outline: none;
    cursor: pointer;
    appearance: none;
    position: relative;
    transition: all 0.3s ease;
}

.chat-mode-toggle input[type="checkbox"]:checked {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
}

.chat-mode-toggle input[type="checkbox"]::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.chat-mode-toggle input[type="checkbox"]:checked::before {
    transform: translateX(20px);
}

/* Overlay */
.settings-panel::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: -1;
}

/* Error Messages */
.error-message {
    background: linear-gradient(135deg, #fef2f2 0%, #fde2e2 100%);
    color: #991b1b;
    border: 1px solid #fecaca;
    border-left: 4px solid var(--error-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: var(--space-md);
    }

    .chat-container {
        height: 90vh;
        border-radius: var(--radius-lg);
    }

    .chat-header {
        padding: var(--space-lg);
    }

    .chat-header h1 {
        font-size: 1.5rem;
    }

    .settings {
        flex-direction: column;
        gap: var(--space-sm);
        padding: var(--space-md);
    }

    .settings label {
        font-size: 0.8rem;
    }

    .model-status {
        flex-direction: column;
        gap: var(--space-sm);
        text-align: center;
        padding: var(--space-md);
    }

    .chat-messages {
        padding: var(--space-lg);
    }

    .message {
        max-width: 85%;
        padding: var(--space-md);
    }

    .chat-input {
        padding: var(--space-lg);
        gap: var(--space-sm);
    }

    .setting-group {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-sm);
    }

    .setting-group label {
        min-width: auto;
    }

    .settings-panel {
        width: 95%;
        max-height: 90vh;
    }

    .settings-content {
        padding: var(--space-lg);
    }
}

/* Loading Animation */
@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
}

/* Enhanced Button States */
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Focus Styles for Accessibility */
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Button Variants */
.primary-btn {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #0891b2 100%) !important;
}

.primary-btn:hover {
    background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%) !important;
}

.save-btn {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%) !important;
    padding: var(--space-sm) var(--space-md) !important;
    min-width: 60px !important;
}

.save-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
}

/* Chat Mode Toggle Styling */
.chat-mode-toggle label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* Enhanced Message Styling */
.message strong {
    font-weight: 600;
    color: var(--primary-color);
}

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

.message code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.85em;
    color: var(--text-secondary);
}

/* Chat Image Styling */
.chat-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius-lg);
    margin: var(--space-sm) 0;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    border: 2px solid var(--border-light);
}

.chat-image:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.chat-image:active {
    transform: translateY(0);
}

/* Generated Image Styling */
.generated-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius-lg);
    margin: var(--space-sm) 0;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    border: 2px solid var(--border-light);
    display: block;
}

.generated-image:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.generated-image:active {
    transform: translateY(0);
}

/* Image Container */
.image-container {
    margin: var(--space-md) 0;
    text-align: center;
}

.image-container img {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

/* Image Caption */
.image-caption {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--border-light);
}

/* Chat Link Styling for Clickable Links */
.chat-link {
    color: var(--primary-color) !important;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
    display: inline;
}

.chat-link:hover {
    color: var(--primary-light) !important;
    border-bottom-color: var(--primary-color);
    text-decoration: none;
    background: rgba(0, 212, 255, 0.1);
    padding: 1px 2px;
    border-radius: var(--radius-sm);
}

.chat-link:visited {
    color: var(--primary-dark) !important;
}

.chat-link:active {
    color: var(--primary-dark) !important;
    transform: translateY(1px);
}

/* Ensure links work in both user and Sarah messages */
.user-message .chat-link {
    color: rgba(255, 255, 255, 0.9) !important;
}

.user-message .chat-link:hover {
    color: white !important;
    background: rgba(255, 255, 255, 0.1);
}

.sarah-message .chat-link {
    color: var(--primary-color) !important;
}

.sarah-message .chat-link:hover {
    color: var(--primary-light) !important;
    background: rgba(0, 212, 255, 0.1);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    color: var(--text-muted);
    font-size: 0.875rem;
    font-style: italic;
}

.typing-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
    animation: typingPulse 1.5s infinite;
}

@keyframes typingPulse {
    0%, 60%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    30% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Enhanced Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-full);
    transition: background 0.2s ease;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.4);
}

/* Settings Panel Animations */
.settings-panel {
    animation: settingsSlideIn 0.3s ease-out;
}

@keyframes settingsSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Improved Chat Bubbles */
.user-message {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    position: relative;
}

.user-message::before {
    content: '';
    position: absolute;
    bottom: 0;
    right: -6px;
    width: 0;
    height: 0;
    border: 6px solid transparent;
    border-left-color: var(--primary-dark);
    border-bottom: 0;
}

.sarah-message {
    background: var(--bg-primary);
    position: relative;
    border: 1px solid var(--border-light);
}

.sarah-message::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: -6px;
    width: 0;
    height: 0;
    border: 6px solid transparent;
    border-right-color: var(--bg-primary);
    border-bottom: 0;
}

/* Status Indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.status-indicator.online {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.status-indicator.offline {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
}

/* Enhanced Input Field */
#user-input {
    background: var(--bg-secondary);
    border: 2px solid var(--border-light);
    transition: all 0.3s ease;
}

#user-input:focus {
    background: var(--bg-primary);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    transform: translateY(-1px);
}

/* Professional Button Styling */
#send-button {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: none;
    color: white;
    font-weight: 600;
    letter-spacing: 0.025em;
    position: relative;
    overflow: hidden;
}

#send-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

#send-button:hover::before {
    left: 100%;
}

/* Modern Chat Header */
.chat-header h1 {
    background: linear-gradient(135deg, #ffffff 0%, rgba(255, 255, 255, 0.8) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
}

/* Responsive Enhancements */
@media (max-width: 480px) {
    .chat-header h1 {
        font-size: 1.25rem;
    }

    .chat-header p {
        font-size: 0.8rem;
    }

    .settings {
        padding: var(--space-sm);
        gap: var(--space-xs);
    }

    .settings label {
        font-size: 0.75rem;
        min-width: 60px;
    }

    .message {
        padding: var(--space-sm) var(--space-md);
        font-size: 0.9rem;
    }
}

/* Dark Mode Support (for future implementation) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1e293b;
        --bg-secondary: #334155;
        --bg-tertiary: #475569;
        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --text-muted: #94a3b8;
        --border-light: #475569;
        --border-medium: #64748b;
    }
}

/* Print Styles */
@media print {
    .chat-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .settings,
    #mic-button,
    #settings-toggle {
        display: none;
    }

    .message {
        page-break-inside: avoid;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --border-light: #000000;
        --border-medium: #000000;
        --primary-color: #0000ff;
        --text-primary: #000000;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .settings-panel {
        animation: none;
    }

    .message {
        animation: none;
    }
}

/* MCP Servers List */
.mcp-servers-list {
    margin-top: var(--space-lg);
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}

.mcp-server-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border-light);
    gap: var(--space-sm);
}

.mcp-server-item:last-child {
    border-bottom: none;
}

.mcp-server-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.mcp-server-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.mcp-server-url {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: 'Monaco', 'Menlo', monospace;
}

.mcp-server-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.mcp-server-status {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.75rem;
    font-weight: 500;
}

.mcp-server-status.online {
    color: var(--success-color);
}

.mcp-server-status.offline {
    color: var(--error-color);
}

.mcp-server-actions {
    display: flex;
    gap: var(--space-xs);
}

.mcp-action-btn {
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.mcp-action-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.mcp-action-btn.delete:hover {
    background: var(--error-color);
    border-color: var(--error-color);
}

/* MCP Tools Display */
.mcp-tools-section {
    margin-top: var(--space-lg);
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.mcp-tools-section h5 {
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 600;
}

.mcp-tool-item {
    padding: var(--space-xs) var(--space-sm);
    margin-bottom: var(--space-xs);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-left: 3px solid var(--primary-color);
}

/* Enhanced MCP Section */
.settings-section.mcp-section {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border: 1px solid var(--primary-color);
}

.settings-section.mcp-section h4 {
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

/* Smooth Transitions */
* {
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

/* Sidebar Toggle Button in Header */
.sidebar-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: var(--radius-md);
    padding: var(--space-sm);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    margin-left: var(--space-sm);
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

/* Sandbox Panel */
.sandbox-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 400px;
    height: 100vh;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-light);
    box-shadow: var(--shadow-xl);
    z-index: 999;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    backdrop-filter: blur(20px);
}

.sandbox-panel.open {
    transform: translateX(0);
}

.sandbox-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(0, 212, 255, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 0, 110, 0.05) 0%, transparent 50%),
        linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-primary) 100%);
    pointer-events: none;
    z-index: 0;
}

.sandbox-panel > * {
    position: relative;
    z-index: 1;
}

/* Sandbox Header */
.sandbox-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.sandbox-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.close-panel-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: var(--space-sm);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.close-panel-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Sandbox Tabs */
.sandbox-tabs {
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

.sandbox-tab-buttons {
    display: flex;
    gap: 2px;
    padding: var(--space-sm);
}

.sandbox-tab-btn {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.sandbox-tab-btn:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

.sandbox-tab-btn.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.sandbox-tab-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.3s ease;
}

.sandbox-tab-btn:hover::before {
    left: 100%;
}

/* Sandbox Content */
.sandbox-content {
    flex-grow: 1;
    overflow: hidden;
    position: relative;
}

.sandbox-tab-content {
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
}

.sandbox-tab-content.active {
    display: flex;
}

/* Code Sandbox Styles */
.code-sandbox {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.code-toolbar {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    flex-shrink: 0;
}

.code-toolbar button {
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.code-toolbar button:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.code-toolbar button.run-btn {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: white;
    border-color: var(--success-color);
}

.code-toolbar button.run-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

/* File Explorer */
.file-explorer {
    width: 100%;
    height: 200px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
    overflow-y: auto;
    flex-shrink: 0;
}

.file-tree {
    padding: var(--space-sm);
}

.file-item {
    padding: var(--space-xs) var(--space-sm);
    margin: 1px 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    transition: all 0.2s ease;
}

.file-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.file-item.selected {
    background: var(--primary-color);
    color: white;
}

.file-item::before {
    content: '📄';
    font-size: 0.7rem;
}

.file-item.folder::before {
    content: '📁';
}

.file-item.folder.open::before {
    content: '📂';
}

/* Code Editor */
.code-editor {
    flex-grow: 1;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.code-editor textarea {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    padding: var(--space-md);
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-primary);
    tab-size: 4;
}

/* Terminal Output */
.terminal-output {
    height: 150px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-light);
    overflow-y: auto;
    flex-shrink: 0;
}

.terminal-content {
    padding: var(--space-md);
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-all;
}

.terminal-prompt {
    color: var(--primary-color);
    font-weight: 600;
}

.terminal-output::-webkit-scrollbar {
    width: 6px;
}

.terminal-output::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

.terminal-output::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: var(--radius-full);
}

/* Webview Sandbox Styles */
.webview-sandbox {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.webview-toolbar {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    flex-shrink: 0;
}

.webview-toolbar input {
    flex-grow: 1;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.8rem;
}

.webview-toolbar button {
    padding: var(--space-sm) var(--space-md);
    background: var(--primary-color);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.webview-toolbar button:hover {
    background: var(--primary-dark);
}

/* WebRef Badge */
.webref-badge {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: white;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: auto;
}

/* WebRef Info Panel */
.webref-info {
    padding: var(--space-sm) var(--space-md);
    background: rgba(0, 212, 255, 0.1);
    border-top: 1px solid var(--primary-color);
    font-size: 0.8rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.webref-info p {
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* Webview Content */
.webview-content {
    flex-grow: 1;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.webview-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

.webview-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.webview-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Hybrid Sandbox (Split View) */
.hybrid-sandbox {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.hybrid-split {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hybrid-top,
.hybrid-bottom {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.hybrid-resize-handle {
    height: 4px;
    background: var(--border-light);
    cursor: row-resize;
    position: relative;
}

.hybrid-resize-handle::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 2px;
    background: var(--primary-color);
    border-radius: var(--radius-full);
}

.hybrid-resize-handle:hover {
    background: var(--primary-color);
}

/* Sandbox Actions */
.sandbox-actions {
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: var(--space-sm);
    flex-shrink: 0;
}

.sandbox-actions button {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sandbox-actions button:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.sandbox-actions button.delete-btn {
    background: var(--error-color);
    border-color: var(--error-color);
}

.sandbox-actions button.delete-btn:hover {
    background: #dc2626;
}

/* Sandbox Empty State */
.sandbox-empty {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
    text-align: center;
    color: var(--text-muted);
}

.sandbox-empty-icon {
    font-size: 3rem;
    margin-bottom: var(--space-lg);
    opacity: 0.5;
}

.sandbox-empty h4 {
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
}

.sandbox-empty p {
    font-size: 0.9rem;
    line-height: 1.6;
    max-width: 300px;
}

/* Responsive Sandbox Panel */
@media (max-width: 768px) {
    .sandbox-panel {
        width: 100vw;
    }

    .sandbox-tab-buttons {
        overflow-x: auto;
        padding: var(--space-xs);
    }

    .sandbox-tab-btn {
        white-space: nowrap;
        min-width: 80px;
    }
}

/* Enhanced Animations */
.sandbox-panel {
    animation: slideInFromLeft 0.3s ease-out;
}

@keyframes slideInFromLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

.sandbox-tab-content {
    animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Sandbox Status Indicators */
.sandbox-status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.sandbox-status.code {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

.sandbox-status.webview {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.sandbox-status.hybrid {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

/* Enhanced Code Editor */
.code-editor {
    position: relative;
}

.code-editor::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--primary-color) 50%, transparent 100%);
    opacity: 0.3;
}

/* Webview Enhancements */
.webview-content {
    position: relative;
}

.webview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

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

/* Sandbox Loading States */
.sandbox-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    z-index: 5;
}

.sandbox-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Enhanced File Explorer */
.file-explorer::-webkit-scrollbar {
    width: 4px;
}

.file-explorer::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

.file-explorer::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: var(--radius-full);
}

/* Terminal Enhancements */
.terminal-content {
    position: relative;
}

.terminal-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, var(--primary-color) 50%, transparent 100%);
    opacity: 0.2;
}

/* Sandbox Tab Management */
.sandbox-tab-btn {
    position: relative;
}

.sandbox-tab-btn .close-tab {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    background: rgba(239, 68, 68, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 0.7rem;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sandbox-tab-btn:hover .close-tab {
    display: flex;
    opacity: 1;
}

.sandbox-tab-btn .close-tab:hover {
    background: #dc2626;
}

/* Sandbox Creation Panel */
.sandbox-create-panel {
    padding: var(--space-lg);
    text-align: center;
}

.sandbox-create-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin: var(--space-lg) 0;
}

.sandbox-create-btn {
    padding: var(--space-md) var(--space-lg);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: var(--radius-lg);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.sandbox-create-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--primary-dark) 0%, #3730a3 100%);
}

.sandbox-create-btn.code-btn::before {
    content: '💻';
}

.sandbox-create-btn.webview-btn::before {
    content: '🌐';
}

.sandbox-create-btn.hybrid-btn::before {
    content: '🔗';
}

/* Media Player Styles */
.media-player {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    position: relative;
}

.media-player video,
.media-player audio {
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    outline: none;
    border: none;
}

.media-player img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: var(--bg-primary);
}

.media-player video {
    max-height: 100%;
}

.media-player audio {
    height: 60px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin: auto;
    padding: var(--space-sm);
}

.media-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.media-player:hover .media-controls {
    opacity: 1;
}

.media-controls button {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: var(--radius-full);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--bg-primary);
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
}

.media-controls button:hover {
    background: white;
    transform: scale(1.1);
}

.media-controls button:active {
    transform: scale(0.95);
}

.media-progress {
    flex-grow: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-full);
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.media-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--primary-light) 100%);
    border-radius: var(--radius-full);
    transition: width 0.1s ease;
}

.media-time {
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    min-width: 80px;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.media-volume {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.volume-slider {
    width: 80px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-full);
    position: relative;
    cursor: pointer;
}

.volume-level {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: white;
    border-radius: var(--radius-full);
}

.media-fullscreen-btn {
    margin-left: auto;
}

/* Media Player States */
.media-player.playing .play-btn::before {
    content: '⏸️';
}

.media-player:not(.playing) .play-btn::before {
    content: '▶️';
}

.media-player.muted .volume-btn::before {
    content: '🔇';
}

.media-player:not(.muted) .volume-btn::before {
    content: '🔊';
}

/* Media Info Panel */
.media-info {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(rgba(0, 0, 0, 0.8), transparent);
    padding: var(--space-md);
    color: white;
    font-size: 0.875rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.media-player:hover .media-info {
    opacity: 1;
}

.media-title {
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.media-size {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.8rem;
}

/* Loading State for Media */
.media-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    z-index: 5;
}

.media-loading::before {
    content: '';
    width: 24px;
    height: 24px;
    border: 2px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Error State for Media */
.media-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--error-color);
    z-index: 5;
    background: rgba(239, 68, 68, 0.1);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--error-color);
}

.media-error h4 {
    margin-bottom: var(--space-sm);
    font-size: 1rem;
}

.media-error p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Responsive Media Player */
@media (max-width: 768px) {
    .media-controls {
        padding: var(--space-md);
        gap: var(--space-sm);
    }
    
    .media-controls button {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .media-time {
        min-width: 60px;
        font-size: 0.8rem;
    }
    
    .volume-slider {
        width: 60px;
    }
    
    .media-info {
        padding: var(--space-sm);
        font-size: 0.8rem;
    }
}

/* Touch Device Optimizations */
@media (hover: none) {
    .media-controls {
        opacity: 1;
        background: rgba(0, 0, 0, 0.9);
    }
    
    .media-info {
        opacity: 1;
    }
}

/* Fullscreen Mode */
.media-player:fullscreen {
    background: black;
}

.media-player:fullscreen video {
    max-height: 100vh;
}

.media-player:fullscreen .media-controls {
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
}

/* Keyboard Navigation */
.media-player:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Accessibility */
.media-controls button:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Media Player in Sandbox Context */
.webview-content .media-player {
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.webview-content .media-player video,
.webview-content .media-player audio,
.webview-content .media-player img {
    border-radius: var(--radius-lg);
}

/* Enhanced Media Player for Different Content Types */
.media-player.video-player {
    background: #000;
}

.media-player.audio-player {
    background: var(--bg-secondary);
    justify-content: center;
    align-items: center;
    padding: var(--space-xl);
}

.media-player.image-player {
    background: var(--bg-primary);
    cursor: zoom-in;
}

.media-player.image-player.zoomed {
    cursor: zoom-out;
}

.media-player.image-player.zoomed img {
    object-fit: cover;
}

/* Media Player Animations */
@keyframes mediaFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.media-player {
    animation: mediaFadeIn 0.3s ease-out;
}

/* Media Quality Selector */
.media-quality {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    background: rgba(0, 0, 0, 0.8);
    border-radius: var(--radius-md);
    padding: var(--space-sm);
    color: white;
    font-size: 0.8rem;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.media-player:hover .media-quality {
    opacity: 1;
}

.media-quality select {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-sm);
    color: white;
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.8rem;
    outline: none;
    cursor: pointer;
}

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

/* Media Speed Control */
.media-speed {
    position: absolute;
    top: var(--space-md);
    left: var(--space-md);
    background: rgba(0, 0, 0, 0.8);
    border-radius: var(--radius-md);
    padding: var(--space-sm);
    color: white;
    font-size: 0.8rem;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.media-player:hover .media-speed {
    opacity: 1;
}

.media-speed select {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-sm);
    color: white;
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.8rem;
    outline: none;
    cursor: pointer;
}

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

/* Avatar Studio Styles */
.avatar-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    position: relative;
    overflow: hidden;
}

.avatar-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 50%, var(--primary-color) 100%);
    opacity: 0.8;
}

.avatar-section h5 {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.avatar-section h5::after {
    content: '';
    flex-grow: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border-light) 0%, transparent 100%);
    margin-left: var(--space-md);
}

/* Avatar Studio Form Elements */
.avatar-section textarea {
    width: 100%;
    min-height: 80px;
    padding: var(--space-md);
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    resize: vertical;
    transition: all 0.2s ease;
}

.avatar-section textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background: var(--bg-secondary);
}

.avatar-section textarea::placeholder {
    color: var(--text-muted);
}

/* Avatar Studio Buttons */
.avatar-section .primary-btn {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #0891b2 100%);
    color: white;
    border: none;
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.avatar-section .primary-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.avatar-section .primary-btn:hover::before {
    left: 100%;
}

.avatar-section .primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
}

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

.avatar-section .save-btn {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: white;
    border: none;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    min-width: 120px;
}

.avatar-section .save-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Image Upload Area */
#avatar-image-upload {
    width: 100%;
    padding: var(--space-md);
    background: var(--bg-primary);
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

#avatar-image-upload:hover {
    border-color: var(--primary-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
}

#avatar-image-upload:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Image Preview */
.image-preview {
    margin-top: var(--space-md);
    text-align: center;
}

.image-preview img {
    max-width: 200px;
    max-height: 200px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 2px solid var(--border-light);
    transition: all 0.3s ease;
}

.image-preview img:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

/* Audio Preview */
#tts-preview {
    width: 100%;
    height: 40px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    margin-top: var(--space-sm);
}

#tts-preview::-webkit-media-controls-panel {
    background: var(--bg-secondary);
}

#tts-preview::-webkit-media-controls-current-time-display,
#tts-preview::-webkit-media-controls-time-remaining-display {
    color: var(--text-primary);
}

#tts-preview::-webkit-media-controls-timeline {
    background: var(--border-light);
    border-radius: 0;
}

#tts-preview::-webkit-media-controls-play-button,
#tts-preview::-webkit-media-controls-mute-button {
    background: var(--primary-color);
    border-radius: var(--radius-sm);
}

/* Video Preview */
#animation-preview {
    width: 100%;
    max-height: 300px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-top: var(--space-sm);
}

#animation-preview::-webkit-media-controls-panel {
    background: var(--bg-secondary);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

#animation-preview::-webkit-media-controls-current-time-display,
#animation-preview::-webkit-media-controls-time-remaining-display {
    color: var(--text-primary);
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin: var(--space-md) 0;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-fill::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progressShimmer 2s infinite;
}

@keyframes progressShimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    z-index: 1;
}

/* Avatar List Dropdown */
#avatar-list {
    width: 100%;
    padding: var(--space-md);
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

#avatar-list:hover {
    border-color: var(--border-medium);
}

#avatar-list:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#avatar-list option {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: var(--space-sm);
}

/* Current Active Avatar Display */
#current-active-avatar {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
}

/* Avatar Studio Animations */
@keyframes avatarSectionSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.avatar-section {
    animation: avatarSectionSlideIn 0.3s ease-out;
}

/* Enhanced Avatar Section Styling */
.avatar-section:nth-child(1) {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.05) 0%, var(--bg-secondary) 100%);
    border-left: 4px solid var(--primary-color);
}

.avatar-section:nth-child(2) {
    background: linear-gradient(135deg, rgba(255, 0, 110, 0.05) 0%, var(--bg-secondary) 100%);
    border-left: 4px solid var(--secondary-color);
}

.avatar-section:nth-child(3) {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, var(--bg-secondary) 100%);
    border-left: 4px solid var(--success-color);
}

/* Avatar Studio Icons */
.avatar-section h5::before {
    content: '';
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
    margin-right: var(--space-sm);
    position: relative;
}

.avatar-section:nth-child(1) h5::before {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.avatar-section:nth-child(2) h5::before {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #0891b2 100%);
    box-shadow: 0 0 10px rgba(255, 0, 110, 0.3);
}

.avatar-section:nth-child(3) h5::before {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

/* Responsive Avatar Studio */
@media (max-width: 768px) {
    .avatar-section {
        padding: var(--space-md);
        margin-bottom: var(--space-md);
    }

    .avatar-section h5 {
        font-size: 0.9rem;
        margin-bottom: var(--space-md);
    }

    .avatar-section textarea {
        min-height: 60px;
        font-size: 0.8rem;
    }

    .image-preview img {
        max-width: 150px;
        max-height: 150px;
    }

    #animation-preview {
        max-height: 200px;
    }

    .avatar-section .primary-btn,
    .avatar-section .save-btn {
        width: 100%;
        margin-top: var(--space-sm);
    }
}

/* Avatar Studio Loading States */
.avatar-generating {
    position: relative;
    pointer-events: none;
}

.avatar-generating::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}

/* Avatar Studio Success States */
.avatar-success {
    border-color: var(--success-color);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, var(--bg-secondary) 100%);
}

.avatar-success h5::before {
    background: var(--success-color);
    animation: successPulse 2s infinite;
}

@keyframes successPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 20px rgba(16, 185, 129, 0.6);
    }
}

/* Avatar Studio Error States */
.avatar-error {
    border-color: var(--error-color);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.05) 0%, var(--bg-secondary) 100%);
}

.avatar-error h5::before {
    background: var(--error-color);
    animation: errorShake 0.5s ease-in-out;
}

@keyframes errorShake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

/* Avatar Studio File Display */
.avatar-file-info {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    margin-top: var(--space-sm);
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.avatar-file-info::before {
    content: '📎';
    font-size: 0.9rem;
}

.avatar-file-name {
    font-weight: 600;
    color: var(--text-primary);
    flex-grow: 1;
}

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

/* Avatar Studio Media Controls */
.avatar-media-controls {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
    padding: var(--space-sm);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.avatar-media-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: var(--space-xs) var(--space-sm);
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.avatar-media-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.avatar-media-btn.delete:hover {
    background: var(--error-color);
    border-color: var(--error-color);
}

/* Avatar Studio Progress Enhancements */
.progress-bar {
    position: relative;
    overflow: hidden;
}

.progress-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(255, 255, 255, 0.1) 2px,
            rgba(255, 255, 255, 0.1) 4px
        );
    animation: progressMove 2s linear infinite;
    opacity: 0.3;
}

@keyframes progressMove {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Avatar Studio Hover Effects */
.avatar-section {
    transition: all 0.3s ease;
}

.avatar-section:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-medium);
}

/* Avatar Studio Disabled States */
.avatar-section.disabled {
    opacity: 0.6;
    pointer-events: none;
}

.avatar-section.disabled::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-lg);
    z-index: 5;
}

/* Avatar Studio Tooltips */
.avatar-tooltip {
    position: relative;
    cursor: help;
}

.avatar-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
    z-index: 1000;
}

.avatar-tooltip:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

/* Avatar Studio Mobile Enhancements */
@media (max-width: 480px) {
    .avatar-section h5 {
        font-size: 0.85rem;
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-xs);
    }

    .avatar-section h5::after {
        display: none;
    }

    .avatar-file-info {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-xs);
    }

    .avatar-media-controls {
        flex-wrap: wrap;
    }
}

/* Avatar Studio Dark Mode Enhancements */
@media (prefers-color-scheme: dark) {
    .avatar-section {
        background: var(--bg-tertiary);
        border-color: var(--border-medium);
    }

    .avatar-section textarea,
    #avatar-image-upload,
    #avatar-list {
        background: var(--bg-primary);
        border-color: var(--border-medium);
    }
}

/* Avatar Studio Print Styles */
@media print {
    .avatar-section {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .avatar-section .primary-btn,
    .avatar-section .save-btn {
        display: none;
    }
}

/* Avatar Studio Accessibility */
.avatar-section button:focus-visible,
.avatar-section input:focus-visible,
.avatar-section select:focus-visible,
.avatar-section textarea:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Avatar Studio High Contrast */
@media (prefers-contrast: high) {
    .avatar-section {
        border-width: 2px;
        border-color: var(--text-primary);
    }

    .avatar-section h5 {
        color: var(--text-primary);
        font-weight: 700;
    }
}

/* Avatar Studio Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .avatar-section {
        animation: none;
        transition: none;
    }

    .avatar-section:hover {
        transform: none;
    }

    .progress-fill::before {
        animation: none;
    }
}

/* Avatar Studio Delete Button */
.delete-btn {
    background: linear-gradient(135deg, var(--error-color) 0%, #dc2626 100%);
    color: white;
    border: none;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    min-width: 80px;
    justify-content: center;
}

.delete-btn:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.delete-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.delete-btn::before {
    content: '🗑️';
    font-size: 0.9rem;
}

/* Avatar Preview Section */
.avatar-preview {
    margin-top: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    text-align: center;
}

.avatar-preview h6 {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.avatar-preview video {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 2px solid var(--border-light);
    background: var(--bg-primary);
}

.avatar-preview .no-avatar {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-style: italic;
    padding: var(--space-lg);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px dashed var(--border-light);
}

/* Avatar List Item with Delete and Checkboxes */
.avatar-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-xs);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.avatar-list-item:hover {
    background: var(--bg-secondary);
    border-color: var(--border-medium);
}

.avatar-list-item.selected {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-color: var(--primary-color);
}

.avatar-list-item.selected .avatar-list-name,
.avatar-list-item.selected .avatar-list-date {
    color: white;
}

/* Avatar List Checkbox */
.avatar-list-checkbox {
    margin-right: var(--space-sm);
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-medium);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
}

.avatar-list-checkbox:checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.avatar-list-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.avatar-list-checkbox:hover {
    border-color: var(--primary-color);
    transform: scale(1.1);
}

.avatar-list-checkbox:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Bulk Actions Container */
.bulk-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    padding: var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
}

.bulk-actions.hidden {
    display: none;
}

/* Select All Checkbox */
.select-all-checkbox {
    margin-right: var(--space-sm);
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-medium);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
}

.select-all-checkbox:checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.select-all-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.select-all-checkbox:hover {
    border-color: var(--primary-color);
    transform: scale(1.1);
}

.select-all-label {
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

/* Delete Selected Button */
.delete-selected-btn {
    background: linear-gradient(135deg, var(--error-color) 0%, #dc2626 100%);
    color: white;
    border: none;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    min-width: 120px;
    justify-content: center;
    margin-left: auto;
}

.delete-selected-btn:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.delete-selected-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.delete-selected-btn::before {
    content: '🗑️';
    font-size: 0.9rem;
}

/* Selected Count */
.selected-count {
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 600;
    background: var(--primary-color);
    color: white;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-full);
    min-width: 24px;
    text-align: center;
}

/* Avatar List Layout with Checkbox */
.avatar-list-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-left: var(--space-sm);
}

.avatar-list-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-grow: 1;
}

.avatar-list-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.avatar-list-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.avatar-list-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.avatar-list-actions {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
}

.avatar-list-play {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.avatar-list-play:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.avatar-list-play::before {
    content: '▶️';
    font-size: 0.7rem;
}

/* Avatar Studio Responsive Enhancements */
@media (max-width: 768px) {
    .avatar-list-item {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }
    
    .avatar-list-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .avatar-preview video {
        max-height: 200px;
    }
}
