/* VoxAI Base CSS - Layout & Structural Reset */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400&family=Orbitron:wght@500;700&family=Rajdhani:wght@500;700&display=swap');

:root {
    /* Dimensions */
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --radius-md: 12px;
    --radius-lg: 24px;
    --radius-full: 999px;
    
    /* Z-Index */
    --z-modal: 1000;
    --z-overlay: 900;
    --z-topbar: 100;
}

* { box-sizing: border-box; margin: 0; padding: 0; outline: none; }
        
body {
    font-family: var(--font-main, 'Inter', sans-serif);
    background-color: var(--bg-body);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    overflow: hidden; /* App-like feel */
    font-size: 15px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- LAYOUT --- */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 8px;
    border-right: 1px solid var(--border);
    transition: transform 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
    z-index: 50;
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--bg-main-area, transparent); /* Optional inner bg */
}

.top-bar {
    height: var(--topbar-height);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    z-index: var(--z-topbar);
    background: var(--bg-topbar, transparent);
    backdrop-filter: var(--glass-blur, none);
}

/* --- COMPONENTS: SIDEBAR --- */
.new-chat-btn {
    background-color: var(--bg-surface);
    color: var(--text-secondary);
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    transition: all 0.2s;
    border: 1px solid var(--border-light, transparent);
    box-shadow: var(--shadow-sm, none);
}

.new-chat-btn:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
    border-color: var(--accent, transparent);
    box-shadow: var(--shadow-glow, none);
}

.sidebar-section {
    margin-top: 24px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    padding-left: 14px;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.nav-item {
    padding: 10px 16px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid transparent;
}

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

.nav-item.active {
    background-color: var(--bg-active, #2c3e50); 
    color: var(--text-active, #fff);
    border-color: var(--border-active, transparent);
}

.spacer { flex: 1; }

.user-profile {
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    margin-top: 10px;
}

.chat-history-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
}

.chat-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    background: var(--bg-surface);
    cursor: pointer;
    font-size: 12px;
}

.chat-history-item:hover {
    border-color: var(--accent);
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.chat-history-item.active {
    border-color: var(--accent);
    color: var(--text-primary);
}

.delete-chat {
    opacity: 0.5;
    font-size: 11px;
}

.delete-chat:hover {
    opacity: 1;
    color: #f87171;
}

.image-gallery {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 180px;
    overflow: hidden;
}

.gallery-empty {
    font-size: 12px;
    color: var(--text-muted);
    padding: 8px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    overflow-y: auto;
}

.gallery-thumb {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-surface);
}

.gallery-thumb img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    display: block;
}

.gallery-label {
    padding: 6px 8px;
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.credits-chip {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-surface);
}

.image-queue-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 280px;
}

.image-queue-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
}

.image-queue-clear-btn {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 11px;
    cursor: pointer;
}

.image-queue-clear-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    background: var(--bg-surface-hover);
}

.image-queue-empty {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 10px 6px;
}

.image-queue-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    overflow-y: auto;
}

.image-queue-item {
    border: 1px solid var(--border);
    background: var(--bg-body);
    border-radius: 9px;
    padding: 8px;
}

.image-queue-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.image-queue-prompt {
    font-size: 12px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 145px;
}

.image-queue-meta {
    margin-top: 5px;
    font-size: 10px;
    color: var(--text-muted);
}

.image-queue-actions {
    margin-top: 6px;
    display: flex;
    gap: 6px;
}

.image-queue-action-btn {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
    padding: 2px 7px;
    font-size: 10px;
    cursor: pointer;
}

.image-queue-action-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    background: var(--bg-surface-hover);
}

.image-queue-status {
    font-size: 10px;
    font-weight: 700;
    border-radius: 999px;
    padding: 2px 8px;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    white-space: nowrap;
}

.image-queue-status.queued {
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.45);
}

.image-queue-status.running {
    color: #60a5fa;
    border-color: rgba(96, 165, 250, 0.5);
}

.image-queue-status.done {
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.45);
}

.image-queue-status.failed {
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.45);
}

.input-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.stats-pill {
    margin-left: auto;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-surface);
    max-width: 60%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attach-preview {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.attach-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 11px;
}

/* ── Upload-state modifier classes ─────────────────────────────────────── */

/* Uploading — pulsing border shows the file is being sent */
.attach-chip--uploading {
    border-color: var(--accent, #7c6fff);
    animation: attach-chip-pulse 1.4s ease-in-out infinite;
}
@keyframes attach-chip-pulse {
    0%, 100% { border-color: var(--accent, #7c6fff); opacity: 1; }
    50%       { border-color: var(--accent, #7c6fff); opacity: 0.55; }
}

/* Error — red border */
.attach-chip--error {
    border-color: #e05555;
}

/* Spinner — pure CSS rotating ring shown next to filename while uploading */
.attach-upload-spin {
    display: inline-block;
    width:  10px;
    height: 10px;
    border: 1.5px solid var(--accent, #7c6fff);
    border-top-color: transparent;
    border-radius: 50%;
    flex-shrink: 0;
    animation: attach-spin 0.65s linear infinite;
}
@keyframes attach-spin {
    to { transform: rotate(360deg); }
}

/* Progress percentage label */
.attach-upload-pct {
    font-size: 10px;
    opacity: 0.75;
    min-width: 26px;
    text-align: right;
    flex-shrink: 0;
}

/* Error warning badge */
.attach-upload-err {
    font-size: 11px;
    color: #e05555;
    flex-shrink: 0;
    cursor: default;
}

/* --- COMPONENTS: CHAT FEED --- */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    scroll-behavior: smooth;
}

.feed-container {
    width: 100%;
    max-width: 800px;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-bottom: 200px; /* Space for input + settings */
}

.message {
    display: flex;
    gap: 16px;
    line-height: 1.6;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
    position: relative;
}

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

.avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-avatar, 50%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: bold;
    box-shadow: var(--shadow-sm, none);
}

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

.message.user-msg .msg-content {
    background-color: var(--bg-user-msg, #2b2c2e);
    color: var(--text-user-msg, #e3e3e3);
    padding: 12px 18px;
    border-radius: 18px 18px 4px 18px;
    max-width: 85%;
    width: fit-content;
    box-shadow: var(--shadow-msg, none);
    border: 1px solid var(--border-light, transparent);
}

.message.ai-msg .msg-content {
    background: transparent;
    padding: 0;
    max-width: 100%;
    width: 100%;
    color: var(--text-primary);
}

.msg-content p { margin-bottom: 12px; }
.msg-content p:last-child { margin-bottom: 0; }

.msg-content code {
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg-code, rgba(255, 255, 255, 0.1));
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    color: var(--text-code, inherit);
}

.msg-content pre {
    background: var(--bg-pre, #1e1e1e);
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 12px 0;
    border: 1px solid var(--border);
}

/* --- COMPONENTS: IMAGE CARDS --- */
.image-card {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-top: 12px;
    max-width: 512px; /* Or variable */
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.image-card:hover {
    box-shadow: var(--shadow-glow, none);
}

.image-card img {
    width: 100%;
    display: block;
    cursor: pointer;
    transition: opacity 0.2s;
}

.image-card img:hover { opacity: 0.9; }

.image-card video {
    width: 100%;
    display: block;
    background: #000;
    max-height: 65vh;
}

.image-meta {
    padding: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-surface-hover);
    border-top: 1px solid var(--border);
}

.download-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}
.download-link:hover { text-decoration: underline; }

/* --- COMPONENTS: INPUT AREA --- */
.input-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-input-gradient, linear-gradient(to bottom, transparent, var(--bg-body) 20%));
    padding: 24px;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    z-index: 50;
    /* backdrop-filter: blur(4px); Optional */
}

.input-wrapper {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.input-box {
    width: 100%;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 12px 16px;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm, 0 4px 6px rgba(0,0,0,0.1));
}

.input-box:focus-within {
    background: var(--bg-surface-hover);
    border-color: var(--accent);
    box-shadow: var(--shadow-glow, 0 6px 12px rgba(0,0,0,0.2));
}

textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 16px;
    font-family: inherit;
    resize: none;
    max-height: 200px;
    padding-bottom: 4px;
    min-height: 24px;
    line-height: 1.5;
}

/* --- BUTTONS --- */
.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.action-btn:hover { 
    background: rgba(255,255,255,0.1); 
    color: var(--text-primary); 
}

.action-btn.send {
     background: var(--accent); 
     color: #fff; /* Always white on accent usually */
}
.action-btn.send:hover { opacity: 0.9; transform: scale(1.05); }

.premium-trial-upgrade-card {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.premium-trial-upgrade-btn {
    border: 1px solid color-mix(in srgb, var(--accent, #ff2e68) 72%, #ffffff 12%);
    background: linear-gradient(135deg, var(--accent, #ff2e68), #a855f7);
    color: #fff;
    border-radius: 999px;
    min-height: 34px;
    padding: 0 16px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 26px color-mix(in srgb, var(--accent, #ff2e68) 28%, transparent);
    transition: transform 0.16s ease, filter 0.16s ease, box-shadow 0.16s ease;
}

.premium-trial-upgrade-btn:hover,
.premium-trial-upgrade-btn:focus-visible {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: 0 13px 30px color-mix(in srgb, var(--accent, #ff2e68) 36%, transparent);
}

/* --- SETTINGS PANEL --- */
.settings-panel {
    background: var(--bg-surface);
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    display: none;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg, 0 10px 25px rgba(0,0,0,0.3));
    animation: slideUp 0.2s ease-out;
}

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

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

.setting-item label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
}

.setting-item input, .setting-item select {
    width: 100%;
    background: var(--bg-input, #111);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 10px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    transition: border-color 0.2s;
}

.setting-item input:focus, .setting-item select:focus {
    border-color: var(--accent);
}

/* --- MODALS --- */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
}

.modal {
    background: var(--bg-sidebar);
    width: 90%;
    max-width: 500px;
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 24px;
    box-shadow: var(--shadow-lg, 0 20px 50px rgba(0,0,0,0.5));
    position: relative;
}

.modal h2 { 
    font-size: 18px; 
    margin-bottom: 16px; 
    color: var(--text-primary);
    font-family: var(--font-headers, inherit);
}

.model-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.model-option {
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid transparent;
    transition: all 0.2s;
}

.model-option:hover { 
    background: var(--bg-surface-hover); 
    border-color: var(--border-light, transparent);
}
.model-option.selected { 
    border-color: var(--accent); 
    background: var(--bg-active, #2c3e50);
}

.fav-btn {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.fav-btn:hover,
.fav-btn.active {
    color: #ffd166;
    border-color: #ffd16666;
    background: rgba(255, 209, 102, 0.12);
}

.provider-back {
    font-size: 12px;
    color: var(--accent);
    cursor: pointer;
    margin-bottom: 10px;
    font-weight: 600;
}

.provider-back:hover {
    text-decoration: underline;
}

.provider-tile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.provider-tile-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.provider-tile-card:hover {
    border-color: var(--accent);
    background: var(--bg-surface-hover);
    transform: translateY(-1px);
}

.provider-tile-letter {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-bottom: 8px;
}

.provider-tile-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.provider-tile-count {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.empty-state {
    padding: 20px;
    text-align: center;
    opacity: 0.6;
    font-size: 13px;
}

.image-family-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.image-family-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.image-family-card:hover,
.image-family-card.selected {
    border-color: var(--accent);
    background: var(--bg-surface-hover);
}

.image-family-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

.image-family-model {
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-family-model.ready {
    color: #22c55e;
    font-weight: 600;
}

.image-family-model.not-ready {
    color: var(--text-muted);
}

.image-section-heading {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 14px 0 6px 2px;
}

.image-section-heading:first-child {
    padding-top: 0;
}

.image-family-card.provider {
    border-color: rgba(168, 85, 247, 0.25);
}

.image-family-card.provider:hover,
.image-family-card.provider.selected {
    border-color: #a855f7;
    background: rgba(168, 85, 247, 0.08);
}

/* --- TOP BAR --- */
.model-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-surface);
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    padding: 6px 14px;
    border-radius: 8px;
    transition: all 0.2s;
    border: 1px solid var(--border);
}

.model-selector:hover {
    background: var(--bg-surface-hover);
    border-color: var(--accent);
}

/* Scrollbar Utility */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* --- COMPONENTS: VIDEO CARDS --- */
.video-card {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-top: 12px;
    max-width: 640px;
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.video-card:hover {
    box-shadow: var(--shadow-glow, none);
}

.video-card video {
    width: 100%;
    display: block;
    border-radius: 8px;
    background: black;
    max-height: 420px;
}

/* --- COMPONENTS: CODE FILE CARDS --- */
.code-file-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
    cursor: pointer;
    max-width: 400px;
}

.code-file-card:hover {
    background: var(--bg-surface-hover);
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm, 0 4px 6px rgba(0,0,0,0.1));
}

.code-file-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    background: rgba(0, 200, 200, 0.12);
    border: 1px solid rgba(0, 200, 200, 0.2);
}

.code-file-info {
    flex: 1;
    min-width: 0;
}

.code-file-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.code-file-meta {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.code-file-download {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.code-file-copy {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.code-file-copy:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    border-color: var(--accent);
}

.code-file-download:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* --- WEB IDE --- */
#chat-image-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}
.ide-layout {
    display: flex;
    flex: 1;
    height: 100%;
    overflow: hidden;
}
.ide-sidebar {
    width: 240px;
    min-width: 180px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.ide-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-secondary);
}
.ide-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 12px;
}
.ide-btn:hover { background: rgba(255,255,255,0.05); }
.ide-file-tree {
    flex: 1;
    overflow-y: auto;
    font-size: 12px;
    font-family: 'Consolas', 'Courier New', monospace;
}
.ide-file-item {
    padding: 4px 12px 4px 20px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
}
.ide-file-item:hover { background: rgba(255,255,255,0.04); color: var(--text-primary); }
.ide-file-item.dir { color: var(--accent); font-weight: 600; padding-left: 12px; }
.ide-file-item.dir::before { content: '📁 '; }
.ide-file-item.file::before { content: '  📄 '; }
.ide-editor-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.ide-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
}
.ide-breadcrumbs {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ide-toolbar-actions {
    display: flex;
    gap: 6px;
}
.ide-tab-bar {
    display: flex;
    gap: 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    min-height: 32px;
}
.ide-tab {
    padding: 6px 16px;
    font-size: 11px;
    color: var(--text-muted);
    cursor: pointer;
    border-right: 1px solid var(--border);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}
.ide-tab:hover { color: var(--text-primary); }
.ide-tab.active { color: var(--text-primary); background: var(--bg-primary); border-bottom: 2px solid var(--accent); }
.ide-tab .close-tab {
    opacity: 0.3;
    cursor: pointer;
    font-size: 10px;
}
.ide-tab .close-tab:hover { opacity: 1; color: #f44336; }
.ide-editor {
    flex: 1;
    overflow: auto;
    background: var(--bg-primary);
}
#ide-editor-content {
    margin: 0;
    padding: 12px 16px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
    background: transparent;
    border: none;
    outline: none;
    min-height: 100%;
    white-space: pre;
    tab-size: 4;
}
.ide-statusbar {
    display: flex;
    justify-content: space-between;
    padding: 4px 12px;
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
}
.ide-recent-panel {
    width: 220px;
    border-left: 1px solid var(--border);
    background: var(--bg-surface);
    display: flex;
    flex-direction: column;
}
.ide-recent-title {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
}
.ide-recent-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ide-recent-item {
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 6px 8px;
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-body);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ide-recent-item:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}
.ide-recent-empty {
    font-size: 11px;
    color: var(--text-muted);
}
