/* Yantrixa Veyu 1 - Custom Stylesheet */

/* Design Tokens & Theme Constants */
:root {
    --bg-base: #0a0705;
    --bg-primary: #110c09;
    --bg-secondary: #19120e;
    --bg-tertiary: #251b15;
    --border-color: #2a1f18;
    --border-hover: #3d2d23;
    
    --text-primary: #faf8f6;
    --text-secondary: #c5b8b0;
    --text-muted: #8a7c74;
    
    /* Solar Orange (replaces teal variables for instant mapping) */
    --teal-primary: #ff781f;
    --teal-dark: #e25b10;
    --teal-glow: rgba(255, 120, 31, 0.12);
    --teal-glow-heavy: rgba(255, 120, 31, 0.25);
    
    /* Gold Accent (replaces copper variables for compatibility) */
    --copper-primary: #ffb830;
    --copper-dark: #df991a;
    --copper-glow: rgba(255, 184, 48, 0.12);
    
    /* Message Bubbles */
    --msg-user: #2b180d;
    --msg-assistant: #140f0c;
    --border-user: #4c2914;
    
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-display: 'Outfit', sans-serif;
    --font-mono: 'Fira Code', monospace;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body, html {
    height: 100%;
    width: 100%;
    font-family: var(--font-sans);
    background-color: var(--bg-base);
    color: var(--text-primary);
    overflow: hidden;
    line-height: 1.5;
}

/* Scrollbar customization */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--teal-primary);
}

/* App Container */
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

/* DRAG & DROP OVERLAY */
#drop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(6, 9, 14, 0.9);
    border: 3px dashed var(--teal-primary);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

#drop-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.drop-message {
    text-align: center;
    color: var(--teal-primary);
    font-family: var(--font-display);
}

.drop-icon {
    width: 64px;
    height: 64px;
    stroke-width: 1.5;
    margin-bottom: 16px;
    animation: pulse 1.5s infinite alternate;
}

/* SIDEBAR */
.sidebar {
    width: 320px;
    background-color: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform var(--transition-normal), margin-left var(--transition-normal);
    z-index: 100;
}

.sidebar.collapsed {
    margin-left: -320px;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--teal-primary);
    box-shadow: 0 0 10px var(--teal-primary);
}

.logo h1 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text-primary) 30%, var(--teal-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#new-chat-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--teal-primary);
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

#new-chat-btn:hover {
    border-color: var(--teal-primary);
    background: var(--teal-glow);
    transform: translateY(-1px);
}

/* Configurations Panel */
.config-section {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-base);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.api-key-wrapper {
    display: flex;
    gap: 8px;
}

.config-section input, 
.config-section select, 
.config-section textarea {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    width: 100%;
    outline: none;
    transition: var(--transition-fast);
}

.config-section input:focus, 
.config-section select:focus, 
.config-section textarea:focus {
    border-color: var(--teal-primary);
    box-shadow: 0 0 8px var(--teal-glow);
}

.config-section textarea {
    resize: none;
}

#toggle-key-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: var(--transition-fast);
}

#toggle-key-btn:hover {
    color: var(--teal-primary);
    border-color: var(--teal-primary);
}

/* Chat History Section */
.history-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px 0;
    overflow: hidden;
}

.search-box {
    margin: 0 16px 12px 16px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px 8px 36px;
    border-radius: 8px;
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition-fast);
}

.search-box input:focus {
    border-color: var(--teal-primary);
    box-shadow: 0 0 8px var(--teal-glow);
}

#clear-search-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
}

#clear-search-btn:hover {
    color: var(--text-primary);
}

.history-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px 8px 16px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

#clear-all-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    transition: var(--transition-fast);
}

#clear-all-btn:hover {
    color: #ef4444;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 4px;
    transition: var(--transition-fast);
    position: relative;
    border: 1px solid transparent;
}

.history-item:hover {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

.history-item.active {
    background: var(--teal-glow);
    border-color: var(--teal-primary);
}

.history-item-details {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.history-item-details i {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
}

.history-item.active .history-item-details i {
    color: var(--teal-primary);
}

.history-title {
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.delete-chat-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    opacity: 0;
    transition: var(--transition-fast);
}

.history-item:hover .delete-chat-btn {
    opacity: 1;
}

.delete-chat-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* MAIN LAYOUT */
.main-layout {
    flex: 1;
    display: flex;
    overflow: hidden;
    height: 100%;
    min-width: 0;
}

/* CHAT CONTAINER */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--bg-base);
    min-width: 0;
}

.chat-header {
    height: 64px;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-primary);
}

.current-model-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 0.9rem;
}

.icon-teal {
    color: var(--teal-primary);
}

.chat-actions button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: var(--transition-fast);
}

.chat-actions button:hover {
    color: var(--teal-primary);
    background: var(--bg-tertiary);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Welcome Screen */
.welcome-screen {
    max-width: 600px;
    margin: auto;
    text-align: center;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.welcome-logo {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--teal-primary) 0%, var(--copper-primary) 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    box-shadow: 0 0 20px rgba(0, 235, 214, 0.2);
}

.welcome-icon {
    width: 32px;
    height: 32px;
    color: var(--bg-base);
}

.welcome-screen h2 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.welcome-sub {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 32px;
}

.suggestions-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
}

@media(min-width: 600px) {
    .suggestions-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.suggestion-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: var(--transition-fast);
}

.suggestion-card i {
    width: 24px;
    height: 24px;
    color: var(--copper-primary);
}

.suggestion-card span {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.suggestion-card:hover {
    border-color: var(--teal-primary);
    transform: translateY(-2px);
    background: var(--bg-tertiary);
}

/* Message Bubbles */
.message-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.message-wrapper.user {
    align-self: flex-end;
}

.message-wrapper.assistant {
    align-self: flex-start;
}

.message-meta {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
    padding: 0 4px;
}

.message-content {
    padding: 16px;
    border-radius: 12px;
    font-size: 0.925rem;
}

.message-wrapper.user .message-content {
    background-color: var(--msg-user);
    border: 1px solid var(--border-user);
    color: var(--text-primary);
    border-top-right-radius: 2px;
}

.message-wrapper.assistant .message-content {
    background-color: var(--msg-assistant);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-top-left-radius: 2px;
}

/* Uploaded media previews in chat */
.chat-attachment-preview {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chat-image-preview {
    max-width: 240px;
    max-height: 180px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    object-fit: cover;
}

.chat-file-preview-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.8rem;
}

.chat-file-preview-card i {
    width: 16px;
    height: 16px;
    color: var(--teal-primary);
}

/* Markdown styling inside assistant message */
.message-content p {
    margin-bottom: 12px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content ul, .message-content ol {
    margin-bottom: 12px;
    padding-left: 20px;
}

.message-content code {
    font-family: var(--font-mono);
    background-color: rgba(255, 255, 255, 0.08);
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 0.85em;
    color: var(--copper-primary);
}

.message-content pre {
    margin: 12px 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.message-content pre code {
    background-color: var(--bg-primary);
    display: block;
    padding: 14px;
    font-size: 0.85rem;
    overflow-x: auto;
    color: var(--text-primary);
}

.message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}

.message-content th, .message-content td {
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    text-align: left;
}

.message-content th {
    background-color: var(--bg-secondary);
    font-weight: 600;
}

/* Interactive Artifact Banner inside chat */
.artifact-trigger-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--copper-glow);
    border: 1px solid var(--copper-primary);
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 10px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.artifact-trigger-banner:hover {
    background: rgba(255, 159, 67, 0.25);
    transform: translateY(-1px);
}

.artifact-banner-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--copper-primary);
}

.artifact-banner-info i {
    width: 18px;
    height: 18px;
}

.artifact-trigger-banner span.btn-text {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    background: var(--copper-primary);
    color: var(--bg-base);
    padding: 4px 8px;
    border-radius: 4px;
}

/* Staged Files Preview */
.staged-files-container {
    padding: 10px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.staged-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.staged-files {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.file-badge {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-primary);
    animation: scaleIn 0.2s ease;
}

.file-badge i.file-icon {
    width: 14px;
    height: 14px;
    color: var(--teal-primary);
}

.file-badge button.remove-file-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: var(--transition-fast);
}

.file-badge button.remove-file-btn:hover {
    color: #ef4444;
}

/* Input Panel */
.input-panel {
    padding: 16px 24px 24px 24px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-primary);
}

.input-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.attachment-controls {
    display: flex;
    gap: 8px;
}

.action-icon-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    transition: var(--transition-fast);
}

.action-icon-btn i {
    width: 14px;
    height: 14px;
}

.action-icon-btn:hover {
    border-color: var(--teal-primary);
    color: var(--teal-primary);
    background: var(--teal-glow);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--teal-primary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--teal-primary);
    box-shadow: 0 0 8px var(--teal-primary);
}

.status-dot.pulsing {
    animation: indicatorPulse 1.2s infinite alternate;
}

.input-form {
    display: flex;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px 12px;
    align-items: flex-end;
    transition: border-color var(--transition-fast);
}

.input-form:focus-within {
    border-color: var(--teal-primary);
    box-shadow: 0 0 10px var(--teal-glow);
}

.input-form textarea {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    padding: 8px 4px;
    resize: none;
    max-height: 200px;
    line-height: 1.4;
}

#send-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    flex-shrink: 0;
    margin-bottom: 2px;
}

#send-btn:not(:disabled) {
    background: var(--teal-primary);
    border-color: var(--teal-primary);
    color: var(--bg-base);
}

#send-btn:not(:disabled):hover {
    background: #00ffd0;
    transform: scale(1.03);
    box-shadow: 0 0 10px rgba(0, 235, 214, 0.4);
}

/* Voice Input Mic Button */
.mic-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    flex-shrink: 0;
    margin-bottom: 2px;
}

.mic-btn:hover {
    color: var(--teal-primary);
    background: var(--teal-glow);
}

.mic-btn.recording {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
    animation: micPulse 1.2s infinite alternate;
}

@keyframes micPulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
    100% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

/* ARTIFACTS PANEL (Split screen side view) */
.artifacts-panel {
    width: 50%;
    min-width: 350px;
    background-color: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: width var(--transition-normal), transform var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.artifacts-panel.closed {
    width: 0 !important;
    min-width: 0 !important;
    border-left: none;
    transform: translateX(100%);
}

.artifact-header {
    height: 64px;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-primary);
    flex-shrink: 0;
}

.artifact-title-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--copper-primary);
    min-width: 0;
}

#artifact-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.icon-copper {
    color: var(--copper-primary);
}

.artifact-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.tabs {
    display: flex;
    background: var(--bg-secondary);
    padding: 3px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.tab-btn.active {
    background: var(--bg-tertiary);
    color: var(--teal-primary);
}

.divider {
    width: 1px;
    height: 20px;
    background: var(--border-color);
}

.control-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: var(--transition-fast);
}

.control-btn:hover {
    color: var(--teal-primary);
    background: var(--bg-tertiary);
}

.control-btn.close-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Artifact Content Pane */
.artifact-content {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: var(--bg-base);
}

.pane {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    overflow: auto;
}

.pane.active {
    display: block;
}

#pane-preview iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #ffffff; /* Clean white canvas for rendering the iframe content */
}

#pane-code pre {
    margin: 0;
    padding: 20px;
    height: 100%;
    overflow: auto;
}

#pane-code code {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Helper Utilities */
.hidden {
    display: none !important;
}

/* Animations */
@keyframes pulse {
    0% { transform: scale(1); opacity: 0.7; }
    100% { transform: scale(1.05); opacity: 1; }
}

@keyframes indicatorPulse {
    0% { transform: scale(0.9); opacity: 0.6; box-shadow: 0 0 4px var(--teal-primary); }
    100% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 12px var(--teal-primary); }
}

@keyframes slideUp {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
    0% { opacity: 0; transform: scale(0.95); }
    100% { opacity: 1; transform: scale(1); }
}

/* Yantrixa Brand Logo Styles */
.logo-img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.header-logo-img {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.welcome-logo {
    background: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.welcome-logo-img {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    object-fit: cover;
    border: 2px solid var(--teal-primary);
    box-shadow: 0 0 20px var(--teal-glow-heavy);
}

/* Mobile Backdrop Overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.mobile-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Retry & Error Layout Styles */
.error-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
}

.error-text {
    color: #ef4444;
    font-weight: 500;
    margin: 0 !important;
}

.retry-btn {
    background: var(--teal-primary);
    color: var(--bg-base);
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: var(--transition-fast);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.retry-btn:hover {
    background: #ff934b;
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(255, 120, 31, 0.25);
}

.retry-btn i {
    width: 14px;
    height: 14px;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.retry-btn:hover i {
    transform: rotate(180deg);
}

/* ============================================================
   RESPONSIVE LAYOUT: Mobile (<= 480px), Tablet (481–768px), 
   Small Desktop (769–1024px)
   ============================================================ */

/* --- MOBILE: Phones (max-width: 480px) --- */
@media (max-width: 480px) {
    /* Mobile overlay is visible on small screens */
    .mobile-overlay {
        display: block;
    }

    /* Sidebar: Fixed off-screen drawer from left */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1001;
        width: 85vw;
        max-width: 320px;
        transform: translateX(-100%);
        margin-left: 0 !important;
        box-shadow: 8px 0 24px rgba(0, 0, 0, 0.5);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border-right: 1px solid var(--border-color);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar.collapsed {
        margin-left: 0;
        transform: translateX(-100%);
    }

    /* Mobile sidebar internals: touch-friendly sizes */
    .sidebar-header {
        padding: 14px 16px;
    }

    .logo h1 {
        font-size: 1.1rem;
    }

    .config-section {
        padding: 12px 16px;
        gap: 8px;
    }

    .config-section select {
        font-size: 16px; /* Prevents iOS auto-zoom on focus */
        padding: 10px 12px;
        min-height: 44px; /* Apple HIG minimum tap target */
        border-radius: 10px;
    }

    .history-section {
        padding: 12px 0;
    }

    .search-box {
        margin: 0 12px 10px 12px;
    }

    .search-box input {
        font-size: 16px; /* Prevents iOS auto-zoom on focus */
        padding: 10px 12px 10px 36px;
        min-height: 44px;
        border-radius: 10px;
    }

    .history-list-header {
        padding: 0 14px 6px 14px;
    }

    .history-list {
        padding: 0 6px;
    }

    .history-item {
        padding: 12px 10px;
        min-height: 44px;
    }

    .history-title {
        font-size: 0.82rem;
    }

    /* Main layout takes full width */
    .main-layout {
        width: 100%;
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for mobile browsers */
    }
    
    .chat-container {
        width: 100%;
    }

    /* Compact chat header */
    .chat-header {
        height: 52px;
        padding: 0 12px;
    }

    .current-model-info {
        gap: 6px;
        font-size: 0.85rem;
    }
    
    .header-logo-img {
        width: 22px;
        height: 22px;
    }

    /* Chat messages area: tighter padding */
    .chat-messages {
        padding: 12px;
        gap: 12px;
    }

    /* Messages use nearly full width */
    .message-wrapper {
        max-width: 95%;
    }

    .message-content {
        padding: 12px;
        font-size: 0.875rem;
    }
    
    .message-content pre code {
        font-size: 0.78rem;
        padding: 10px;
    }

    .message-content pre {
        margin: 8px 0;
    }
    
    /* Prevent code blocks from overflowing */
    .message-content pre,
    .message-content code {
        max-width: 100%;
        overflow-x: auto;
        word-break: break-word;
    }

    /* Welcome screen: compact for small phones */
    .welcome-screen {
        padding: 24px 16px;
        max-width: 100%;
    }

    .welcome-screen h2 {
        font-size: 1.25rem;
        margin-bottom: 8px;
    }

    .welcome-sub {
        font-size: 0.8rem;
        margin-bottom: 20px;
    }

    .welcome-logo-img {
        width: 56px;
        height: 56px;
        border-radius: 14px;
    }

    .suggestions-grid {
        grid-template-columns: 1fr !important;
        gap: 8px;
    }

    .suggestion-card {
        padding: 12px;
        flex-direction: row;
        gap: 10px;
    }

    .suggestion-card i {
        width: 20px;
        height: 20px;
    }

    /* Input panel: spacious mobile layout */
    .input-panel {
        padding: 10px 12px 14px 12px;
        /* Safe area for phones with home bar/notch */
        padding-bottom: max(14px, env(safe-area-inset-bottom));
        border-top: 1px solid var(--border-color);
    }

    .input-actions-bar {
        margin-bottom: 8px;
    }

    .action-icon-btn span {
        display: none; /* Hide "Image" / "File" text labels on mobile */
    }

    .action-icon-btn {
        padding: 8px 10px;
        min-height: 36px;
    }

    .input-form {
        border-radius: 16px;
        padding: 10px 14px;
        gap: 8px;
        background-color: var(--bg-secondary);
        border: 1.5px solid var(--border-color);
    }

    .input-form:focus-within {
        border-color: var(--teal-primary);
        box-shadow: 0 0 12px var(--teal-glow);
    }

    .input-form textarea {
        font-size: 16px; /* Prevents iOS auto-zoom on focus */
        padding: 8px 4px;
        min-height: 40px;
        max-height: 150px;
        line-height: 1.5;
    }
    
    #send-btn {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }

    .mic-btn {
        width: 40px;
        height: 40px;
    }

    /* Staged files: horizontal scroll */
    .staged-files-container {
        padding: 8px 12px;
    }

    .staged-files {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Artifact panel: fullscreen on mobile */
    .artifacts-panel {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100% !important;
        min-width: 100% !important;
        z-index: 1002;
        transform: translateX(0);
        border-left: none;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .artifacts-panel.closed {
        transform: translateX(100%);
        width: 0 !important;
        min-width: 0 !important;
    }

    .artifact-header {
        height: 48px;
        padding: 0 12px;
    }

    .artifact-title-wrapper {
        font-size: 0.8rem;
    }
    
    .artifact-controls {
        gap: 6px;
    }
    
    .tab-btn {
        padding: 4px 8px;
        font-size: 0.7rem;
    }

    /* Chat image previews: smaller on mobile */
    .chat-image-preview {
        max-width: 180px;
        max-height: 140px;
    }

    /* Artifact banner */
    .artifact-trigger-banner {
        padding: 10px 12px;
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    .artifact-banner-info {
        font-size: 0.78rem;
    }
}

/* --- TABLET: (481px to 768px) --- */
@media (min-width: 481px) and (max-width: 768px) {
    .mobile-overlay {
        display: block;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1001;
        width: 320px;
        transform: translateX(-100%);
        margin-left: 0 !important;
        box-shadow: 8px 0 24px rgba(0, 0, 0, 0.5);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar.collapsed {
        margin-left: 0;
        transform: translateX(-100%);
    }

    .main-layout {
        width: 100%;
        height: 100vh;
        height: 100dvh;
    }

    .chat-container {
        width: 100%;
    }

    .chat-header {
        height: 56px;
        padding: 0 16px;
    }

    .chat-messages {
        padding: 16px;
        gap: 16px;
    }

    .message-wrapper {
        max-width: 88%;
    }

    .welcome-screen {
        padding: 32px 20px;
    }
    
    .welcome-screen h2 {
        font-size: 1.5rem;
    }

    .input-panel {
        padding: 10px 16px 16px 16px;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }

    /* Artifacts: fullscreen overlay on tablet */
    .artifacts-panel {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100% !important;
        min-width: 100% !important;
        z-index: 1002;
        transform: translateX(0);
        border-left: none;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .artifacts-panel.closed {
        transform: translateX(100%);
        width: 0 !important;
        min-width: 0 !important;
    }
}

/* --- SMALL DESKTOP: (769px to 1024px) --- */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 260px;
    }

    .sidebar.collapsed {
        margin-left: -260px;
    }

    .message-wrapper {
        max-width: 85%;
    }

    .artifacts-panel {
        min-width: 300px;
    }
}

/* --- LARGE DESKTOP: Center chat messages like modern AI chat UIs --- */
@media (min-width: 1025px) {
    .chat-messages {
        max-width: 900px;
        margin: 0 auto;
        width: 100%;
    }
    
    .input-panel {
        max-width: 900px;
        margin: 0 auto;
        width: 100%;
    }
}

