/* Variables */
:root {
    /* Light theme (default) */
    --bg-primary: #ffffff;
    --bg-secondary: #f0f7ff;
    --sidebar-bg: linear-gradient(180deg, #f2f9ff 0%, #e6f3ff 100%);
    --text-primary: #343541;
    --text-secondary: #6e6e80;
    --border-color: #d0e3ff;
    --accent-color: #0ea5e9; /* Light blue accent */
    --hover-color: #e1f5fe;
    --shadow-color: rgba(0, 120, 212, 0.05);
    --user-msg-bg: #ffffff;
    --assistant-msg-bg: #f0f7ff;
    --placeholder-color: #8e8ea0;
    --scrollbar-thumb: #c2c2c2;
    --example-bg: #ffffff;
    --input-bg: #ffffff;
    --error-color: #ef4146;
    
    /* Common variables for both themes */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
    
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    
    --transition: 0.2s ease;
    --sidebar-width: 260px;
}

/* Dark mode variables - Improved with more attractive colors */
.dark-theme {
    --bg-primary: #1a1b26;
    --bg-secondary: #24283b;
    --sidebar-bg: #16161e;
    --text-primary: #c0caf5;
    --text-secondary: #a9b1d6;
    --border-color: #414868;
    --hover-color: #2b2d42;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --user-msg-bg: #1a1b26;
    --assistant-msg-bg: #24283b;
    --placeholder-color: #8e8ea0;
    --scrollbar-thumb: #414868;
    --example-bg: #232433;
    --input-bg: #24283b;
    --error-color: #f7768e;
    --accent-color: #7aa2f7; /* Soft blue accent for dark theme */
}

/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Apply dark theme by default to match the UI in the images */
body.dark-theme {
    --bg-primary: #1a1b26;
    --bg-secondary: #24283b;
    --sidebar-bg: #16161e;
    --text-primary: #c0caf5;
    --text-secondary: #a9b1d6;
    --border-color: #414868;
    --hover-color: #2b2d42;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --user-msg-bg: #1a1b26;
    --assistant-msg-bg: #24283b;
    --placeholder-color: #8e8ea0;
    --scrollbar-thumb: #414868;
    --example-bg: #232433;
    --input-bg: #24283b;
    --error-color: #f7768e;
    --accent-color: #7aa2f7;
}

/* App layout */
.app-container {
    display: flex;
    height: 100vh;
    max-height: 100vh;
    width: 100%;
}

/* Sidebar styles */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform 0.3s ease, background-color 0.3s ease;
    z-index: 10;
}

.sidebar-header {
    padding: 12px;
}

.new-chat-button {
    width: 100%;
    padding: 12px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.new-chat-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    filter: brightness(1.1);
}

.conversation-list-container, .sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.conversation-list {
    display: flex;
    flex-direction: column;
}

.conversation-item {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 5px;
    margin: 2px 8px;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.conversation-item:hover {
    background-color: var(--hover-color);
}

.conversation-item.active {
    background-color: var(--hover-color);
    font-weight: 500;
}

.conversation-icon {
    width: 18px;
    height: 18px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--accent-color);
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-color);
}

.user-menu {
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-menu:hover {
    background-color: var(--hover-color);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    background-color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    color: white;
    margin-right: 12px;
}

.user-info {
    flex: 1;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 5px;
    margin-left: auto;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background-color: var(--hover-color);
    color: var(--accent-color);
}

/* Main content area */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--bg-primary);
    position: relative;
    transition: background-color 0.3s ease;
}

.mobile-header {
    display: none;
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    gap: 15px;
    background-color: var(--bg-primary);
    z-index: 5;
}

.mobile-header h1 {
    font-size: 18px;
    font-weight: 500;
}

.toggle-sidebar {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.toggle-sidebar:hover {
    background-color: var(--hover-color);
    color: var(--accent-color);
}

/* Messages area */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    scroll-behavior: smooth;
}

/* No messages (empty state) */
.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    height: 100%;
    padding: 20px;
}

.empty-state-content {
    max-width: 800px;
    text-align: center;
}

.empty-state-title {
    font-size: 40px;
    font-weight: 600;
    margin-bottom: 10px;
    background: linear-gradient(90deg, var(--accent-color), #7dc4fc);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.empty-state-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.examples, .examples-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    margin-top: 20px;
    max-width: 800px;
    width: 100%;
}

.example {
    background-color: var(--example-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.example:hover {
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.example-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--accent-color);
}

.example-text {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Message styles */
.message-row, .user-row, .assistant-row {
    padding: 20px;
    display: flex;
    gap: 20px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    transition: background-color 0.3s ease;
}

.user-row, .message-row.user {
    background-color: var(--user-msg-bg);
}

.assistant-row, .message-row.assistant {
    background-color: var(--assistant-msg-bg);
}

.message-avatar {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    background-color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    flex-shrink: 0;
    transition: background-color 0.3s ease;
}

.user-avatar, .message-row.user .message-avatar {
    background-color: #3b82f6;
}

.message-content {
    font-size: 15px;
    line-height: 1.6;
    overflow-wrap: break-word;
    flex: 1;
}

.message-content p {
    margin-bottom: 0.8em;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content pre {
    background-color: var(--bg-secondary);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1em 0;
    border: 1px solid var(--border-color);
}

.message-content code {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

.message-content .error {
    color: var(--error-color);
    padding: 8px 12px;
    border-radius: 6px;
    background-color: rgba(247, 118, 142, 0.1);
    border-left: 3px solid var(--error-color);
}

/* Thinking indicator animation */
.thinking-indicator, .typing-indicator {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    padding: 8px 0;
    color: var(--text-secondary);
}

.dot {
    width: 6px;
    height: 6px;
    background-color: var(--accent-color);
    border-radius: 50%;
    opacity: 0.7;
    animation: pulse 1.5s infinite ease-in-out;
}

.dot:nth-child(1) {
    animation-delay: 0s;
}

.dot:nth-child(2) {
    animation-delay: 0.3s;
}

.dot:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Input area */
.message-input-container, .input-area {
    padding: 15px;
    border-top: 1px solid var(--border-color);
    position: sticky;
    bottom: 0;
    background-color: var(--bg-primary);
    margin: 0 auto;
    max-width: 800px;
    width: 100%;
    transition: background-color 0.3s ease;
}

.message-form, .input-container {
    position: relative;
}

.input-wrapper {
    position: relative;
    display: flex;
    border: 1px solid var(--border-color);
    background-color: var(--input-bg);
    border-radius: 10px;
    box-shadow: 0 2px 6px var(--shadow-color);
    transition: all 0.2s ease;
}

.input-wrapper:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(122, 162, 247, 0.2);
}

#message-input, #message, .input-field {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    resize: none;
    padding: 12px 50px 12px 12px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text-primary);
    min-height: 24px;
    max-height: 200px;
    transition: color 0.3s ease;
}

#message-input::placeholder, #message::placeholder, .input-field::placeholder {
    color: var(--placeholder-color);
}

#send-button, .send-button {
    position: absolute;
    right: 8px;
    bottom: 8px;
    background-color: transparent;
    color: var(--accent-color);
    border: none;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
}

#send-button:hover:not(:disabled), .send-button:hover:not(:disabled) {
    background-color: var(--hover-color);
    transform: translateY(-1px);
}

#send-button:disabled, .send-button:disabled {
    color: var(--border-color);
    cursor: not-allowed;
}

.disclaimer, .input-info {
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 10px;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-thumb);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--accent-color);
}

/* Responsive styles */
@media (max-width: 768px) {
    .sidebar {
        left: -280px;
        z-index: 1000;
        box-shadow: 0 0 15px rgba(0,0,0,0.2);
    }
    .sidebar.visible {
        left: 12px;
    }
    .main {
        margin-left: 12px;
        width: calc(100% - 24px);
    }
    .message-row {
        padding: 12px 10px;
        margin-bottom: 8px;
    }
    .message-content {
        padding: 0 8px;
        font-size: 15px;
    }
    .input-area {
        position: sticky;
        bottom: 0;
        background-color: inherit;
        padding: 8px 0;
        z-index: 900;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0,0,0,0.5);
        z-index: 999;
    }
    .sidebar-overlay.active {
        display: block;
    }
    .input-container {
        padding: 10px 8px;
        border-radius: 18px !important;
    }
    .input-field {
        font-size: 15px;
        padding: 8px 2px;
    }
    .input-tool-button, .send-button {
        width: 36px;
        height: 36px;
    }
    .input-tools {
        gap: 6px;
    }
    .copy-message-button {
        width: 28px;
        height: 28px;
        top: 4px;
        right: 4px;
    }
}
@media (max-width: 480px) {
    .empty-state-title {
        font-size: 2rem;
    }
    .examples {
        grid-template-columns: 1fr;
    }
    .app-header {
        padding: 0 8px;
    }
    .header-subtitle {
        display: none;
    }
    .input-container {
        padding: 6px 4px;
    }
    .input-tool-button, .send-button {
        width: 28px;
        height: 28px;
    }
    .input-tools {
        gap: 2px;
    }
    .message-row {
        padding: 10px 4px;
        margin-bottom: 6px;
    }
    .message-content {
        font-size: 14px;
        padding: 0 4px;
    }
    .sidebar {
        width: 90vw;
        min-width: unset;
        left: -100vw;
    }
    .sidebar.visible {
        left: 5vw;
    }
}

/* Caution banner styles */
.caution-banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(247, 118, 142, 0.2);
    border-bottom: 1px solid var(--error-color);
    color: var(--text-primary);
    padding: 8px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.caution-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.caution-content i.bi-exclamation-triangle-fill {
    color: var(--error-color);
    font-size: 16px;
}

.close-caution {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    margin-left: auto;
    border-radius: 4px;
}

.close-caution:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Dark theme caution banner adjustments */
.dark-theme .caution-banner {
    background-color: rgba(247, 118, 142, 0.1);
}