/* ============================================
   PaloYan AI — Premium Design System v2.0
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg-main: #070B14;
    --bg-sidebar: rgba(10, 15, 30, 0.85);
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --bg-user-msg: rgba(56, 189, 248, 0.08);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-bright: rgba(56, 189, 248, 0.3);
    --text-primary: #F1F5F9;
    --text-secondary: #64748B;
    --text-muted: #334155;
    --accent-cyan: #38BDF8;
    --accent-violet: #818CF8;
    --accent-green: #4ADE80;
    --accent-red: #F87171;
    --gradient-primary: linear-gradient(135deg, #38BDF8 0%, #818CF8 100%);
    --gradient-glow: linear-gradient(135deg, rgba(56,189,248,0.15) 0%, rgba(129,140,248,0.15) 100%);
    --sidebar-width: 295px;
    --header-height: 64px;
    --shadow-glow: 0 0 40px rgba(56, 189, 248, 0.15);
    --radius-xl: 20px;
    --radius-lg: 14px;
    --radius-md: 10px;
    --radius-sm: 6px;
}

/* ---- Reset ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html { scroll-behavior: smooth; }

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, sans-serif;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-cyan); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.8; text-decoration: underline; }

/* ---- Ambient Background ---- */
.ambient-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.ambient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
    animation: orb-drift 12s ease-in-out infinite alternate;
}

.orb-1 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, #38BDF8 0%, transparent 70%);
    top: -150px; left: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, #818CF8 0%, transparent 70%);
    bottom: -100px; right: 200px;
    animation-delay: -4s;
}

.orb-3 {
    width: 300px; height: 300px;
    background: radial-gradient(circle, #4ADE80 0%, transparent 70%);
    top: 50%; right: -50px;
    opacity: 0.15;
    animation-delay: -8s;
}

@keyframes orb-drift {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, -30px) scale(1.1); }
}

/* ---- App Layout ---- */
.app-container {
    display: flex;
    width: 100%;
    height: 100dvh;
    position: relative;
    z-index: 1;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    z-index: 100;
    position: relative;
    flex-shrink: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

/* Brand */
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 0;
}

.logo {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    filter: drop-shadow(0 0 12px rgba(56, 189, 248, 0.4));
}

.logo svg { width: 40px; height: 40px; }

.brand-text h2 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-tag {
    font-size: 0.65rem;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.2);
    color: var(--accent-cyan);
    padding: 1px 7px;
    border-radius: 20px;
    font-weight: 500;
    letter-spacing: 0.03em;
}

/* New Chat Button */
.new-chat-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 20px rgba(56, 189, 248, 0.25);
    font-family: 'Inter', sans-serif;
}

.new-chat-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.new-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(56, 189, 248, 0.35);
}

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

/* Section Label */
.section-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 8px;
    padding: 0 2px;
}

/* Mode Selector */
.mode-tabs {
    display: flex;
    background: rgba(255,255,255,0.04);
    border-radius: var(--radius-md);
    padding: 3px;
    border: 1px solid var(--border-color);
}

.mode-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}

.mode-tab svg { width: 14px; height: 14px; }

.mode-tab.active {
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(56, 189, 248, 0.25);
}

.mode-tab:hover:not(.active) {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* Settings Panel */
.settings-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.input-group label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.api-input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.api-input-wrapper:focus-within {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.15);
}

.api-input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 9px 12px;
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    font-family: 'JetBrains Mono', monospace;
}

.api-input-wrapper input::placeholder { color: var(--text-secondary); opacity: 0.6; }

.toggle-key-btn {
    background: transparent;
    border: none;
    padding: 0 10px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: color 0.2s;
    height: 100%;
}

.toggle-key-btn:hover { color: var(--text-primary); }
.toggle-key-btn svg { width: 15px; height: 15px; }

.input-group small {
    font-size: 0.72rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

.btn-primary {
    width: 100%;
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.2);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.3);
}

#settings-msg {
    font-size: 0.78rem;
    margin-top: 8px;
    text-align: center;
    min-height: 18px;
    border-radius: var(--radius-sm);
    padding: 0 4px;
}

#settings-msg.success { color: var(--accent-green); }
#settings-msg.error { color: var(--accent-red); }

/* Sidebar Panels (Conversations, Templates, Tips) */
.conversations-panel,
.templates-panel,
.engineering-tips-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.theme-toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    padding: 4px;
    border-radius: var(--radius-sm);
}

.theme-toggle-btn:hover { background: rgba(255,255,255,0.05); color: var(--accent-cyan); }
.theme-icon { width: 16px; height: 16px; }

.conversations-list {
    max-height: 250px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 4px;
}
.conversations-list::-webkit-scrollbar,
.templates-grid::-webkit-scrollbar,
.tips-list::-webkit-scrollbar { 
    width: 4px; 
}

.conversations-list::-webkit-scrollbar-track,
.templates-grid::-webkit-scrollbar-track,
.tips-list::-webkit-scrollbar-track { 
    background: transparent; 
}

.conversations-list::-webkit-scrollbar-thumb,
.templates-grid::-webkit-scrollbar-thumb,
.tips-list::-webkit-scrollbar-thumb { 
    background: var(--border-color); 
    border-radius: 4px; 
}

.conversation-item {
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.conversation-item.active {
    background: rgba(56, 189, 248, 0.1);
    border-color: rgba(56, 189, 248, 0.25);
}
.conversation-item:hover:not(.active) {
    background: var(--bg-card-hover);
    border-color: var(--border-color);
}
.conversation-item-title {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.templates-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 8px;
}
.template-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    text-align: left;
    font-size: 0.8rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.4;
    min-height: 48px;
}
.template-btn:hover {
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.4);
    color: var(--accent-cyan);
    transform: translateX(2px);
}

.tips-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 8px;
}
.tip-item {
    background: rgba(255, 255, 255, 0.03);
    border-left: 2px solid var(--accent-violet);
    padding: 10px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.tip-item strong {
    font-size: 0.78rem;
    color: var(--text-primary);
}
.tip-item small {
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Search Panel in Main Page */
.search-panel {
    display: none; /* Hide for now to avoid disrupting layout unless accessed specially */
}

/* Features List (Capabilities) */
.features-list {
    margin-top: 8px;
}

.features-list ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.features-list li {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border-radius: var(--radius-lg);
    border: 1px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
}

.features-list li:hover {
    background: rgba(56, 189, 248, 0.05);
    border-color: rgba(56, 189, 248, 0.2);
    transform: translateX(4px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.feature-icon {
    font-size: 0.75rem;
    font-weight: 800;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

/* Unique Colors for Capabilities Icons */
#cap-writing .feature-icon { background: linear-gradient(135deg, #6366F1, #8B5CF6); box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3); }
#cap-dev .feature-icon     { background: linear-gradient(135deg, #06B6D4, #3B82F6); box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3); }
#cap-image-gen .feature-icon { background: linear-gradient(135deg, #EC4899, #F43F5E); box-shadow: 0 4px 12px rgba(236, 72, 153, 0.3); }
#cap-vision .feature-icon    { background: linear-gradient(135deg, #10B981, #059669); box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3); }

.features-list li:hover .feature-icon {
    transform: scale(1.1);
    filter: brightness(1.1) saturate(1.2);
}

.feature-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.feature-text span {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.3s;
}

.features-list li:hover .feature-text span {
    color: var(--accent-cyan);
}

.feature-text small {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

/* Sidebar close (mobile) */
.sidebar-close {
    display: none;
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 0.8rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sidebar-close:hover { color: var(--text-primary); }

/* Sidebar Overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 99;
}

/* ============================================
   MAIN CHAT AREA
   ============================================ */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
    overflow: hidden;
}

/* Header */
.chat-header {
    height: var(--header-height);
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(7, 11, 20, 0.8);
    backdrop-filter: blur(12px);
    flex-shrink: 0;
    z-index: 10;
}

.hamburger-btn {
    display: none;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.hamburger-btn svg { width: 18px; height: 18px; }
.hamburger-btn:hover { color: var(--text-primary); border-color: var(--border-bright); }

.header-info { flex: 1; }

.header-info h1 {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

.dot-live {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-cyan);
    display: inline-block;
    box-shadow: 0 0 6px var(--accent-cyan);
    animation: live-pulse 2s infinite;
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--accent-cyan); }
    50% { opacity: 0.6; box-shadow: 0 0 10px var(--accent-cyan); }
}

.status-badge span:last-child {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.clear-chat-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-chat-btn svg { width: 16px; height: 16px; }
.clear-chat-btn:hover { color: var(--accent-red); border-color: rgba(248, 113, 113, 0.3); background: rgba(248, 113, 113, 0.05); }

/* ---- Welcome Screen ---- */
.welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    text-align: center;
    gap: 20px;
    overflow-y: auto;
}

.welcome-icon {
    width: 72px;
    height: 72px;
    filter: drop-shadow(0 0 24px rgba(56, 189, 248, 0.5));
    animation: float 4s ease-in-out infinite;
}

.welcome-icon svg { width: 72px; height: 72px; }

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

.welcome-screen h2 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-screen > p {
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 440px;
    line-height: 1.6;
}

.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    max-width: 640px;
}

.chip {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 18px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s;
    font-family: 'Inter', sans-serif;
}

.chip:hover {
    background: rgba(56, 189, 248, 0.1);
    border-color: rgba(56, 189, 248, 0.3);
    color: var(--accent-cyan);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.15);
}

/* ---- Chat Container ---- */
.chat-container {
    flex: 1;
    padding: 28px 32px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

.chat-container::-webkit-scrollbar { width: 5px; }
.chat-container::-webkit-scrollbar-track { background: transparent; }
.chat-container::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
.chat-container::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* ---- Messages ---- */
.message {
    display: flex;
    gap: 14px;
    max-width: min(820px, 100%);
    width: 100%;
    animation: slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slide-in {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ai-message  { align-self: flex-start; }
.user-message { align-self: flex-end; flex-direction: row-reverse; }

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 4px;
}

.ai-avatar {
    background: var(--gradient-primary);
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.3);
}

.user-avatar {
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.25);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-cyan);
}

.message-content {
    background: var(--bg-card);
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    font-size: 0.92rem;
    line-height: 1.75;
    color: var(--text-primary);
    min-width: 0;
    overflow: hidden;
    word-break: break-word;
    backdrop-filter: blur(8px);
    flex: 1;
    max-width: 100%;
}

.user-message .message-content {
    background: rgba(56, 189, 248, 0.07);
    border-color: rgba(56, 189, 248, 0.18);
    flex: none;
    max-width: 75%;
}

.message-content p { margin-bottom: 0.8em; }
.message-content p:last-child { margin-bottom: 0; }
.message-content h1, .message-content h2, .message-content h3 {
    margin: 1em 0 0.5em;
    font-weight: 600;
    line-height: 1.3;
}
.message-content h1 { font-size: 1.3em; }
.message-content h2 { font-size: 1.15em; }
.message-content h3 { font-size: 1em; }

.message-content ul, .message-content ol {
    margin-left: 22px;
    margin-bottom: 0.8em;
}
.message-content li { margin-bottom: 4px; line-height: 1.65; }

.message-content strong { color: #fff; font-weight: 600; }

.message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 0.88em;
}
.message-content th, .message-content td {
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    text-align: left;
}
.message-content th {
    background: rgba(56, 189, 248, 0.1);
    font-weight: 600;
    color: var(--accent-cyan);
}

/* Inline code */
.message-content p code, .message-content li code {
    background: rgba(255,255,255,0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
    font-family: 'JetBrains Mono', monospace;
    color: #E2E8F0;
    border: 1px solid rgba(255,255,255,0.1);
}

/* ---- Code Blocks ---- */
.code-block-wrapper {
    position: relative;
    margin: 14px 0;
    border-radius: var(--radius-md);
    overflow: auto;
    max-height: min(68vh, 760px);
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1E1E2E;
    padding: 8px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    position: sticky;
    top: 0;
    z-index: 2;
}

.code-block-lang {
    font-size: 0.72rem;
    color: var(--accent-cyan);
    text-transform: lowercase;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.copy-code-btn {
    background: rgba(255,255,255,0.07);
    color: var(--text-secondary);
    border: none;
    padding: 4px 12px;
    border-radius: 5px;
    font-size: 0.73rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
}

.copy-code-btn:hover { background: rgba(255,255,255,0.14); color: #fff; }
.copy-code-btn.copied { background: rgba(74, 222, 128, 0.12); color: var(--accent-green); }

.message-content pre {
    background: #13131F !important;
    border-radius: 0 !important;
    padding: 16px 20px !important;
    margin: 0 !important;
    overflow: visible !important;
    border: none !important;
    box-shadow: none !important;
    min-width: max-content;
}

.code-block-wrapper::-webkit-scrollbar { width: 8px; height: 8px; }
.code-block-wrapper::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 999px; }
.code-block-wrapper::-webkit-scrollbar-track { background: transparent; }

.message-content code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.7;
}

/* ---- Typing Indicator ---- */
.typing-indicator {
    display: none;
    align-items: center;
    gap: 5px;
    padding: 14px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    width: fit-content;
    backdrop-filter: blur(8px);
}

.typing-indicator.active { display: flex; }

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

.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }
.dot:nth-child(3) { animation-delay: 0s; }

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

/* Streaming cursor */
.streaming-cursor {
    display: inline-block;
    animation: cursor-blink 0.8s infinite;
    color: var(--accent-cyan);
    font-weight: bold;
    margin-left: 1px;
}

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

/* Inline images in user bubble */
.user-msg-images {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.user-msg-img {
    max-width: 180px;
    max-height: 180px;
    border-radius: var(--radius-md);
    object-fit: cover;
    border: 1px solid rgba(56, 189, 248, 0.25);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: block;
}

/* ============================================
   IMAGE GENERATION PANEL
   ============================================ */
.image-gen-panel {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.image-gen-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.image-gen-icon {
    font-size: 3rem;
    filter: drop-shadow(0 4px 12px rgba(56, 189, 248, 0.4));
    animation: float 4s ease-in-out infinite;
}

.image-gen-header h2 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.image-gen-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    max-width: 500px;
}

.image-prompt-area {
    max-width: 700px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

#image-prompt {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    resize: vertical;
    outline: none;
    line-height: 1.6;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-height: 100px;
}

#image-prompt:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.12);
}

#image-prompt::placeholder { color: var(--text-secondary); }

.image-options {
    display: flex;
    gap: 14px;
}

.option-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.option-group label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.option-group select {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 9px 12px;
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2364748B' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 32px;
}

.option-group select:focus { border-color: var(--accent-cyan); }
.option-group select option { background: #1E293B; }

.generate-img-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 13px;
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 6px 24px rgba(56, 189, 248, 0.3);
}

.generate-img-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 36px rgba(56, 189, 248, 0.4);
}

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

/* Generated images grid */
.generated-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.generated-image-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all 0.3s;
    animation: slide-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.generated-image-card:hover {
    transform: translateY(-4px);
    border-color: rgba(56, 189, 248, 0.3);
    box-shadow: 0 16px 48px rgba(0,0,0,0.4), 0 0 0 1px rgba(56,189,248,0.1);
}

.generated-image-card img {
    width: 100%;
    aspect-ratio: auto;
    display: block;
    object-fit: cover;
    max-height: 360px;
}

.generated-image-card .card-footer {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border-color);
}

.card-footer .prompt-text {
    font-size: 0.78rem;
    color: var(--text-secondary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 8px;
}

.download-btn {
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.2);
    color: var(--accent-cyan);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
    text-decoration: none;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.download-btn:hover {
    background: rgba(56, 189, 248, 0.2);
    text-decoration: none;
}

.image-loading-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 60px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    animation: slide-in 0.3s ease forwards;
}

.image-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

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

.image-loading-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ============================================
   INPUT AREA
   ============================================ */
.input-area {
    padding: 12px 24px 20px;
    background: linear-gradient(to top, var(--bg-main) 50%, transparent);
    flex-shrink: 0;
}

.file-preview-container {
    max-width: 800px;
    margin: 0 auto 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.file-preview-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.preview-thumb {
    width: 46px;
    height: 46px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.remove-file-img {
    position: absolute;
    top: -6px; right: -6px;
    background: var(--accent-red);
    color: white;
    border-radius: 50%;
    width: 16px; height: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px;
    cursor: pointer;
    transition: transform 0.2s;
}

.remove-file-img:hover { transform: scale(1.1); }

.preview-name {
    max-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-preview-item .remove-file {
    cursor: pointer;
    color: var(--accent-red);
    font-weight: bold;
}

/* Input Wrapper */
.input-wrapper {
    max-width: 800px;
    margin: 0 auto;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(16px);
    transition: border-color 0.25s, box-shadow 0.25s;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.exact-recreate-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    background: linear-gradient(90deg, rgba(56,189,248,0.08), rgba(129,140,248,0.08));
}

.exact-recreate-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.exact-recreate-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #BAE6FD;
    background: rgba(14,165,233,0.14);
    border: 1px solid rgba(56,189,248,0.24);
}

.exact-recreate-text {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.copy-recreate-prompt-btn {
    background: rgba(255,255,255,0.08);
    color: var(--text-primary);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    font-family: 'Inter', sans-serif;
}

.copy-recreate-prompt-btn:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(56,189,248,0.25);
    color: #fff;
}

.copy-recreate-prompt-btn.copied {
    background: rgba(74, 222, 128, 0.12);
    border-color: rgba(74, 222, 128, 0.24);
    color: var(--accent-green);
}

.input-wrapper:focus-within {
    border-color: rgba(56, 189, 248, 0.4);
    box-shadow: 0 0 0 1px rgba(56,189,248,0.2), 0 8px 32px rgba(0,0,0,0.3);
}

.input-top-row {
    display: flex;
    align-items: flex-end;
    padding: 12px 12px 8px;
    gap: 8px;
}

.attachment-btn {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-bottom: 2px;
}

.attachment-btn svg { width: 18px; height: 18px; }

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

#user-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    resize: none;
    min-height: 22px;
    max-height: 200px;
    outline: none;
    padding: 4px 8px;
    line-height: 1.65;
    overflow-y: auto;
    scrollbar-width: none;
}

#user-input::-webkit-scrollbar { display: none; }
#user-input::placeholder { color: var(--text-secondary); }

.send-btn {
    background: var(--gradient-primary);
    color: white;
    border: none;
    width: 38px; height: 38px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-bottom: 2px;
    box-shadow: 0 4px 14px rgba(56, 189, 248, 0.3);
}

.send-btn svg { width: 17px; height: 17px; }

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.45);
}

.send-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Bottom Toolbar */
.input-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 14px 10px;
    border-top: 1px solid rgba(255,255,255,0.04);
}

.input-toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toolbar-model-badge {
    font-size: 0.7rem;
    color: var(--text-secondary);
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.18);
    border-radius: 20px;
    padding: 2px 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
}

.toolbar-hint {
    font-size: 0.68rem;
    color: var(--text-secondary);
    opacity: 0.55;
}

.char-count {
    font-size: 0.68rem;
    color: var(--text-secondary);
    opacity: 0.55;
}

/* ============================================
   RESPONSIVE — MOBILE
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0; left: 0;
        height: 100dvh;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        z-index: 200;
        border-right: 1px solid var(--border-color);
        box-shadow: 4px 0 32px rgba(0,0,0,0.5);
    }

    .sidebar.open { transform: translateX(0); }

    .sidebar-close {
        display: flex !important;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .hamburger-btn { display: flex; }

    .chat-container { padding: 16px; }

    .input-area { padding: 10px 16px 16px; }

    .user-message .message-content { max-width: 90%; }

    .welcome-screen h2 { font-size: 1.4rem; }

    .suggestion-chips { gap: 8px; }
    .chip { font-size: 0.8rem; padding: 8px 14px; }

    .image-gen-panel { padding: 20px 16px; }
    .image-options { flex-direction: column; }

    .generated-images-grid { grid-template-columns: 1fr; }

    .exact-recreate-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .copy-recreate-prompt-btn {
        width: 100%;
    }

}

/* ============================================================
   MULTI-PROVIDER STYLES
   ============================================================ */

/* Provider Grid */
.provider-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.provider-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
    position: relative;
    overflow: hidden;
}

.provider-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.2s;
}

.provider-btn:hover { transform: translateY(-1px); }
.provider-btn:hover::before { opacity: 0.06; }

.provider-btn.active {
    border-color: var(--provider-color, var(--accent-cyan));
    background: rgba(var(--provider-rgb, 56,189,248), 0.08);
    box-shadow: 0 0 0 1px var(--provider-color, var(--accent-cyan)), 0 4px 12px rgba(0,0,0,0.2);
}

.provider-btn.active::before { background: var(--provider-color); opacity: 0.05; }

.provider-icon {
    font-size: 1.3rem;
    line-height: 1;
}

.provider-name {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

/* ========================================
   CONVERSATIONS PANEL & CHAT HISTORY
   ======================================== */
.conversations-panel {
    border-top: 1px solid var(--border-color);
    padding: 12px 0;
    margin: 12px 0;
}

.conversations-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px 8px;
}

.conversations-header .section-label {
    margin: 0;
}

.theme-toggle-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.theme-toggle-btn:hover {
    background: rgba(255,255,255,0.08);
    color: var(--accent-cyan);
}

.conversations-list {
    max-height: 140px;
    overflow-y: auto;
    padding: 0 8px;
}

.conversation-item {
    padding: 10px 12px;
    margin: 4px 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.conversation-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-bright);
    color: var(--text-primary);
}

.conversation-item.active {
    background: rgba(56,189,248,0.1);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.conversation-item-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.8rem;
}

.conversation-item-actions {
    display: flex;
    gap: 4px;
    margin-left: 8px;
}

.conversation-item-actions button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 2px 4px;
    font-size: 0.75rem;
    transition: color 0.2s;
}

.conversation-item-actions button:hover {
    color: var(--accent-red);
}

/* ========================================
   TEMPLATES PANEL
   ======================================== */
.templates-panel {
    border-top: 1px solid var(--border-color);
    padding: 12px 16px;
}

.templates-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    max-height: 140px;
    overflow-y: auto;
}

.template-btn {
    padding: 8px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: left;
    font-size: 0.8rem;
    transition: all 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.template-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

/* ========================================
   PROMPT ENGINEERING TIPS
   ======================================== */
.engineering-tips-panel {
    border-top: 1px solid var(--border-color);
    padding: 12px 16px;
    font-size: 0.75rem;
}

.engineering-tips-panel .section-label {
    margin-bottom: 8px;
}

.tips-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 140px;
    overflow-y: auto;
}

.tip-item {
    padding: 8px;
    background: rgba(56,189,248,0.05);
    border-left: 3px solid var(--accent-cyan);
    border-radius: 4px;
    line-height: 1.3;
}

.tip-item strong {
    color: var(--accent-cyan);
    display: block;
    font-size: 0.75rem;
    margin-bottom: 2px;
}

.tip-item small {
    color: var(--text-secondary);
    font-size: 0.7rem;
}
:root[data-theme="light"] {
    --bg-main: #FFFFFF;
    --bg-sidebar: rgba(245, 245, 247, 0.95);
    --bg-card: rgba(0, 0, 0, 0.05);
    --bg-card-hover: rgba(0, 0, 0, 0.08);
    --bg-user-msg: rgba(56, 189, 248, 0.12);
    --border-color: rgba(0, 0, 0, 0.12);
    --border-bright: rgba(56, 189, 248, 0.3);
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
}

/* ========================================
   SEARCH & FILTER UI
   ======================================== */
.search-panel {
    border-top: 1px solid var(--border-color);
    padding: 12px 16px;
    display: none;
}

.search-panel.active {
    display: block;
}

.search-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.1);
}

/* ========================================
   PROMPT TEMPLATES
   ======================================== */
.templates-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.template-btn {
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: left;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.template-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

/* ========================================
   EXPORT DIALOG
   ======================================== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

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

.export-modal {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.export-modal h3 {
    margin: 0 0 16px;
    font-size: 1.2rem;
}

.export-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.export-option-btn {
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.export-option-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.modal-close {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}

.modal-close-btn {
    padding: 8px 16px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close-btn:hover {
    border-color: var(--accent-red);
    color: var(--accent-red);
}
}

.provider-btn.active .provider-name {
    color: var(--provider-color, var(--accent-cyan));
}

.provider-free-tag {
    position: absolute;
    top: 3px;
    right: 4px;
    font-size: 0.5rem;
    font-weight: 700;
    color: #4ADE80;
    background: rgba(74,222,128,0.12);
    border: 1px solid rgba(74,222,128,0.2);
    border-radius: 3px;
    padding: 1px 3px;
    letter-spacing: 0.04em;
}

/* Provider Config Panel */
.provider-config {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.provider-config-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.provider-config-icon { font-size: 1.1rem; }

.provider-config-info { flex: 1; }

.provider-config-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
}

.provider-config-sub {
    font-size: 0.68rem;
    color: var(--text-secondary);
    margin-top: 1px;
    display: block;
}

.config-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.config-field label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.config-input-row {
    display: flex;
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.config-input-row:focus-within {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 2px rgba(56,189,248,0.12);
}

.config-input-row input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 8px 10px;
    color: var(--text-primary);
    font-size: 0.8rem;
    outline: none;
    font-family: 'JetBrains Mono', monospace;
}

.config-input-row input::placeholder { color: var(--text-secondary); opacity: 0.5; }

.config-toggle-btn {
    background: transparent;
    border: none;
    padding: 0 9px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.config-toggle-btn:hover { color: var(--text-primary); }
.config-toggle-btn svg { width: 14px; height: 14px; }

.config-select {
    width: 100%;
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 10px;
    color: var(--text-primary);
    font-size: 0.82rem;
    outline: none;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2364748B' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 30px;
}

.config-select:focus { border-color: var(--accent-cyan); }
.config-select option { background: #1E293B; }

.config-key-link {
    font-size: 0.7rem;
    color: var(--accent-cyan);
    opacity: 0.8;
    transition: opacity 0.2s;
}

.config-key-link:hover { opacity: 1; text-decoration: underline; }

.ollama-note {
    font-size: 0.72rem;
    color: var(--text-secondary);
    background: rgba(52,211,153,0.08);
    border: 1px solid rgba(52,211,153,0.15);
    border-radius: var(--radius-sm);
    padding: 7px 10px;
    line-height: 1.5;
}

.save-provider-btn {
    width: 100%;
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    padding: 9px;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 4px 14px rgba(56,189,248,0.2);
}

.save-provider-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(56,189,248,0.3);
}

.settings-msg {
    font-size: 0.75rem;
    text-align: center;
    min-height: 16px;
    border-radius: var(--radius-sm);
}

.settings-msg.success { color: #4ADE80; }
.settings-msg.error   { color: #F87171; }

/* Provider pills on welcome screen */
.provider-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 4px;
}

.provider-pill {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: rgba(255,255,255,0.03);
    font-size: 0.75rem;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.provider-pill.connected {
    border-color: rgba(74,222,128,0.3);
    background: rgba(74,222,128,0.07);
    color: #4ADE80;
}

.provider-pill .pill-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}


