/* Base Styles with Techy Theme */
:root {
    --primary-color: #00aaff;
    --primary-dark: #0077cc;
    --primary-glow: rgba(0, 170, 255, 0.4);
    --accent-color: #0fd662;
    --dark-bg: #0d1117;
    --dark-panel: #161b22;
    --dark-element: #21262d;
    --text-bright: #f0f6fc;
    --text-main: #c9d1d9;
    --text-secondary: #8b949e;
    --border-color: #30363d;
    --highlight-color: #bb86fc;
    --error-color: #ff5555;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

body {
    background-color: var(--dark-bg);
    color: var(--text-main);
    height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(1, 60, 90, 0.1) 0%, transparent 45%),
        radial-gradient(circle at 85% 30%, rgba(6, 90, 40, 0.08) 0%, transparent 45%);
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Header Styles with Tech Glow */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--dark-panel);
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.header-title {
    display: flex;
    align-items: center;
    color: var(--primary-color);
    text-shadow: 0 0 10px var(--primary-glow);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.header-title i {
    margin-right: 10px;
    font-size: 1.2rem;
    color: var(--primary-color);
    filter: drop-shadow(0 0 2px var(--primary-glow));
}

.header-title span {
    font-size: 1.1rem;
}

.warning-text {
    color: #e0a030;
    font-size: 0.8rem;
    margin-left: 10px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-button {
    background: none;
    border: none;
    color: #b0b0b0;
    font-size: 1rem;
    padding: 8px;
    margin-left: 4px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.icon-button:hover {
    background-color: var(--dark-element);
    color: var(--primary-color);
    box-shadow: 0 0 8px var(--primary-glow);
}

/* Model Selector Dropdown Styles */
.model-selector {
    position: relative;
    margin-right: 15px;
}

.dropdown-button {
    background-color: #3a3f46;
    color: #fff;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 14px;
    border: 1px solid #4e545e;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.dropdown-button:hover {
    background-color: #4e545e;
}

.custom-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #2d323a;
    border-radius: 6px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    display: none;
    z-index: 100;
    margin-top: 5px;
    max-height: 300px;
    overflow-y: auto;
    width: 220px;
    border: 1px solid #4e545e;
}

.dropdown-item {
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    transition: background-color 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background-color: #3a3f46;
}

.model-name {
    font-weight: bold;
    margin-bottom: 2px;
    color: #ffffff;
}

.model-provider {
    font-size: 12px;
    color: #a0a0a0;
}

/* Custom scrollbar for dropdown */
.custom-select-dropdown::-webkit-scrollbar {
    width: 6px;
}

.custom-select-dropdown::-webkit-scrollbar-track {
    background: #1e1e1e;
}

.custom-select-dropdown::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
    box-shadow: 0 0 5px var(--primary-glow);
}

/* Enhanced File Upload Styling */
.file-upload-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.upload-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--dark-element);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    font-size: 13px;
    overflow: hidden;
}

.upload-button:hover {
    background-color: #2a3240;
    border-color: var(--accent-color);
    box-shadow: 0 0 8px rgba(15, 214, 98, 0.4);
}

.upload-button i {
    color: var(--accent-color);
}

.supported-formats {
    font-size: 10px;
    color: #888888;
    margin-top: 4px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    position: absolute;
    top: 100%;
    width: max-content;
}

.file-upload-wrapper:hover .supported-formats {
    opacity: 1;
}

/* File upload progress and animation */
.upload-progress {
    position: absolute;
    bottom: -2px;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-color), var(--primary-color));
    width: 0%;
    transition: width 0.3s ease;
}

.upload-active .upload-progress {
    animation: upload-progress 1.5s ease forwards;
}

@keyframes upload-progress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* Welcome Section with Tech Animations */
.welcome-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%);
    transition: opacity 0.5s, transform 0.5s;
    text-align: center;
    z-index: 1;
    width: 90%;
    max-width: 600px;
}

.welcome-section.hidden {
    display: none;
    opacity: 0;
    transform: translate(-50%, -70%);
    pointer-events: none;
}

.ai-avatar {
    background: linear-gradient(135deg, var(--primary-color), #0088cc);
    box-shadow: 0 0 20px var(--primary-glow),
                inset 0 0 20px rgba(255,255,255,0.2);
    width: 90px;
    height: 90px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    position: relative;
}

.ai-avatar::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--text-bright);
    animation: spin 3s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.ai-avatar i {
    font-size: 40px;
    color: white;
}

.welcome-section h1 {
    color: var(--text-bright);
    font-size: 2.2rem;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(0,170,255,0.3);
    margin-bottom: 20px;
    position: relative;
}

.welcome-section h1::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
}

.disclaimer {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 30px;
    max-width: 80%;
}

/* Chat Container */
.chat-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    position: relative;
    background: linear-gradient(to bottom, rgba(13, 17, 23, 0.9), var(--dark-bg));
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
    box-shadow: 0 0 5px var(--primary-glow);
}

/* Message Styles */
.message {
    margin-bottom: 16px;
    max-width: 85%;
    word-break: break-word;
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-message {
    align-self: flex-end;
    background-color: #193147;
    color: var(--text-bright);
    border-radius: 12px 12px 0 12px;
    padding: 12px 16px;
    margin-left: auto;
    border-left: 3px solid var(--primary-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.assistant-message {
    align-self: flex-start;
    background-color: #1e2832;
    color: var(--text-bright);
    border-radius: 12px 12px 12px 0;
    padding: 12px 16px;
    line-height: 1.5;
    border-left: 3px solid var(--accent-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.system-message {
    background-color: #232c3a;
    color: var(--text-bright);
    border-radius: 12px;
    padding: 12px 16px;
    margin: 16px auto;
    max-width: 90%;
    text-align: center;
    border-top: 2px solid var(--highlight-color);
}

.message-heading {
    margin: 16px 0 8px;
    color: var(--primary-color);
}

.message h1, .message h2, .message h3 {
    color: var(--primary-color);
}

.message p {
    margin: 8px 0;
}

.message ul {
    margin: 8px 0;
    padding-left: 24px;
}

.message li {
    margin: 4px 0;
}

.loading-message {
    min-height: 40px;
    display: flex;
    align-items: center;
}

/* File Message Enhancement */
.file-message {
    background-color: #121620;
    padding: 0;
    border: 1px solid #333333;
    border-radius: 8px;
    overflow: hidden;
    border-left: none;
}

.file-info {
    width: 100%;
}

.file-header {
    display: flex;
    align-items: center;
    background-color: #1b1f2b;
    padding: 10px 16px;
    border-bottom: 1px solid #333333;
}

.file-icon {
    margin-right: 10px;
    font-size: 18px;
}

.file-icon.js { color: #f7df1e; }
.file-icon.py { color: #3572a5; }
.file-icon.java { color: #b07219; }
.file-icon.html { color: #e34c26; }
.file-icon.css { color: #563d7c; }
.file-icon.cpp { color: #f34b7d; }
.file-icon.c { color: #555555; }

.file-details {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.file-name {
    font-weight: 600;
    color: var(--text-bright);
    font-size: 14px;
}

.file-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.file-size, .file-type {
    color: var(--text-secondary);
    font-size: 12px;
}

.file-actions {
    display: flex;
    gap: 8px;
}

.file-button {
    background-color: #283244;
    border: none;
    color: var(--text-main);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.file-button:hover {
    background-color: #3a445a;
    color: var(--text-bright);
}

.file-content {
    background-color: #0d1117;
    padding: 16px;
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-main);
    white-space: pre;
}

/* Input Container */
.input-container {
    display: flex;
    flex-direction: column;
    background-color: var(--dark-panel);
    padding: 14px 18px;
    border-top: 1px solid var(--border-color);
}

.input-row {
    display: flex;
    align-items: flex-end;
}

textarea {
    flex: 1;
    background-color: var(--dark-element);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-bright);
    padding: 10px 14px;
    resize: none;
    outline: none;
    font-size: 14px;
    line-height: 1.5;
    max-height: 200px;
    transition: all 0.3s ease;
    caret-color: var(--primary-color);
}

textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

/* Send Button */
#sendButton {
    background: linear-gradient(135deg, var(--primary-color), #0088cc);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 10px 14px;
    margin-left: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 170, 255, 0.4);
}

#sendButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(0, 170, 255, 0.6);
}

#sendButton:disabled {
    background: linear-gradient(135deg, #555, #333);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Code Block Styling */
.code-block {
    margin: 14px 0;
    border-radius: 6px;
    overflow: hidden;
    background-color: #111622;
    border: 1px solid var(--border-color);
    position: relative;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.code-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary-color), var(--accent-color));
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #131b2c;
    padding: 8px 14px;
    border-bottom: 1px solid #1e2635;
}

.code-header span {
    color: #a0a0a0;
    font-size: 0.85rem;
}

.code-header button {
    background-color: #283244;
    color: var(--text-main);
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.code-header button:hover {
    background-color: #3a445a;
    color: var(--text-bright);
}

.code-header button.copied {
    background-color: #2e7d32;
    color: white;
}

.code-block pre {
    margin: 0;
    padding: 12px 12px 12px 20px;
    overflow-x: auto;
    background-color: #0d1117;
}

.code-block code {
    color: var(--text-bright);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

.inline-code {
    background-color: #1a1f2a;
    color: var(--text-bright);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.9rem;
    border: 1px solid #333;
}

/* Error Styling */
.error-container {
    display: flex;
    background-color: #331a1a;
    border-left: 3px solid var(--error-color);
    border-radius: 4px;
    padding: 12px;
}

.error-icon {
    font-size: 24px;
    margin-right: 12px;
    color: var(--error-color);
}

.error-content {
    flex: 1;
}

.error-title {
    font-weight: bold;
    margin-bottom: 4px;
    color: var(--error-color);
}

.error-message {
    color: var(--text-bright);
    margin-bottom: 8px;
    word-break: break-all;
}

.error-help {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background: var(--text-bright);
    border-radius: 50%;
    display: block;
    margin: 0 2px;
    opacity: 0.4;
    animation: typing 1s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-6px);
    }
}

/* File drag and drop area */
.drag-drop-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
}

.drag-drop-overlay.visible {
    display: flex;
}

.drag-drop-message {
    color: white;
    font-size: 24px;
    font-weight: 600;
}

.drag-drop-icon {
    font-size: 48px;
    color: var(--primary-color);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

/* Highlight styles for key terms */
.highlight-important {
    color: #ff8c00;
}

.highlight-note {
    color: var(--primary-color);
}

.highlight-warning {
    color: #ffd700;
}

.highlight-error {
    color: var(--error-color);
}

.highlight-success {
    color: var(--accent-color);
}

/* Chat History Sidebar */
.chat-history-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    background-color: var(--dark-panel);
    border-right: 1px solid var(--border-color);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.chat-history-drawer.open {
    transform: translateX(0);
    box-shadow: 3px 0 15px rgba(0, 0, 0, 0.3);
}

.chat-history-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-history-title {
    color: var(--text-bright);
    font-size: 1rem;
    font-weight: 600;
}

.chat-history-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.chat-history-close:hover {
    background-color: var(--dark-element);
    color: var(--text-bright);
}

.chat-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.chat-history-item {
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--dark-element);
}

.chat-history-item:hover {
    background-color: #2a2f37;
}

.chat-history-item.active {
    border-color: var(--primary-color);
    background-color: #233344;
}

.chat-item-content {
    flex: 1;
    overflow: hidden;
}

.chat-item-title {
    display: block;
    color: var(--text-main);
    font-size: 0.9rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-date {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.chat-delete-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    opacity: 0.7;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-delete-btn:hover {
    color: var(--error-color);
    background-color: rgba(255, 85, 85, 0.1);
    opacity: 1;
}

 /* Tooltip for New Chat Button */
#newChatButton {
    position: relative;
}

#newChatButton::after {
    content: "New Chat";
    position: absolute;
    background-color: var(--dark-element);
    color: var(--text-bright);
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 12px;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    z-index: 100;
}

#newChatButton:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Chat History Toggle Button */
.chat-history-toggle {
    position: fixed;
    left: 10px;
    bottom: 20px;
    width: 44px;
    height: 44px;
    border-radius: 22px;
    background-color: var(--primary-dark);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    z-index: 99;
    transition: all 0.3s ease;
}

.chat-history-toggle:hover {
    background-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--primary-glow);
}

.chat-history-toggle i {
    font-size: 1.2rem;
}

/* Main container adjustments for sidebar */
.container.with-sidebar {
    padding-left: 280px; /* Same as sidebar width */
}

/* Responsive styles for chat history */
@media (max-width: 768px) {
    .chat-history-drawer {
        width: 250px;
    }
    
    .container.with-sidebar {
        padding-left: 0;
    }
    
    .chat-history-toggle {
        width: 40px;
        height: 40px;
        left: 8px;
        bottom: 15px;
    }
}