/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: #343541;
    color: #ececf1;
    height: 100vh;
    overflow: hidden;
}

/* App Container */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: #202123;
    border-right: 1px solid #4a4b53;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 14px;
    border-bottom: 1px solid #4a4b53;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: 600;
    color: #ececf1;
}

.logo i {
    font-size: 20px;
    color: #10a37f;
}

.new-chat-btn {
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: 1px solid #565869;
    border-radius: 6px;
    color: #ececf1;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.new-chat-btn:hover {
    background: #2a2b32;
    border-color: #6b6c7b;
}

.sidebar-content {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
}

/* Session Setup */
.session-setup {
    background: #2a2b32;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
}

.session-setup h3 {
    color: #ececf1;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.session-setup p {
    color: #8e8ea0;
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.4;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    color: #ececf1;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    background: #40414f;
    border: 1px solid #565869;
    border-radius: 6px;
    color: #ececf1;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #10a37f;
}

.start-session-btn {
    width: 100%;
    padding: 12px 16px;
    background: #10a37f;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s ease;
}

.start-session-btn:hover {
    background: #0e906f;
}

/* Session Info */
.session-info {
    background: #2a2b32;
    border-radius: 8px;
    padding: 16px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: #ececf1;
    font-size: 14px;
}

.user-info i {
    color: #10a37f;
    font-size: 16px;
}

.end-session-btn {
    width: 100%;
    padding: 8px 12px;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.2s ease;
}

.end-session-btn:hover {
    background: #b91c1c;
}















/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #343541;
}

/* Chat Header */
.chat-header {
    padding: 20px 24px;
    border-bottom: 1px solid #4a4b53;
    background: #343541;
    display: flex;
    align-items: center;
    gap: 16px;
}

.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: #ececf1;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.mobile-menu-toggle:hover {
    background: #40414f;
}

.chat-title h1 {
    font-size: 20px;
    font-weight: 600;
    color: #ececf1;
    margin-bottom: 4px;
}

.chat-title p {
    font-size: 14px;
    color: #8e8ea0;
}

/* Chat Interface */
.chat-interface {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding-bottom: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    padding-bottom: 240px; /* Increased space for fixed chat input and sample questions */
    margin-bottom: 0;
}

/* Messages */
.message {
    display: flex;
    padding: 20px 24px;
    border-bottom: 1px solid #4a4b53;
    animation: fadeIn 0.3s ease;
}

.message:last-child {
    border-bottom: none;
    margin-bottom: 20px; /* Add extra space after the last message */
}

.message-avatar {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    flex-shrink: 0;
}

.bot-message .message-avatar {
    background: #10a37f;
    color: white;
}

.user-message .message-avatar {
    background: #ececf1;
    color: #343541;
}

.message-content {
    flex: 1;
    max-width: calc(100% - 46px);
}

.message-text {
    font-size: 16px;
    line-height: 1.6;
    color: #ececf1;
}

.user-message .message-text {
    color: #ececf1;
}

/* Sample Questions Container */
.sample-questions-container {
    position: fixed;
    bottom: 140px; /* Position above the chat input */
    left: 260px;
    right: 0;
    z-index: 99;
    background: #343541;
    border-top: 1px solid #4a4b53;
    padding: 20px 24px;
}

.sample-questions-wrapper {
    max-width: 768px;
    margin: 0 auto;
}

.sample-questions-wrapper h3 {
    color: #ececf1;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    text-align: center;
}

.sample-questions-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 500px;
    margin: 0 auto;
}

.sample-question-btn {
    background: #40414f;
    border: 1px solid #565869;
    border-radius: 8px;
    padding: 12px 16px;
    color: #ececf1;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sample-question-btn:hover {
    background: #2a2b32;
    border-color: #6b6c7b;
}

.sample-question-btn i {
    color: #10a37f;
    font-size: 14px;
    flex-shrink: 0;
}

/* Chat Input */
.chat-input-container {
    position: fixed;
    bottom: 0;
    left: 260px;
    right: 0;
    padding: 20px 24px;
    background: #343541;
    border-top: 1px solid #4a4b53;
    z-index: 100;
}

.chat-input-wrapper {
    max-width: 768px;
    margin: 0 auto;
}

.chat-input {
    position: relative;
    background: #40414f;
    border: 1px solid #565869;
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    transition: border-color 0.2s ease;
}

.chat-input:focus-within {
    border-color: #10a37f;
}

#messageInput {
    flex: 1;
    background: transparent;
    border: none;
    color: #ececf1;
    font-size: 16px;
    line-height: 1.5;
    resize: none;
    outline: none;
    font-family: inherit;
    min-height: 24px;
    max-height: 200px;
}

#messageInput::placeholder {
    color: #8e8ea0;
}

.send-button {
    background: #10a37f;
    color: white;
    border: none;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.send-button:hover {
    background: #0e906f;
}

.send-button:disabled {
    background: #565869;
    cursor: not-allowed;
}

.input-footer {
    margin-top: 8px;
    text-align: center;
}

.disclaimer {
    font-size: 12px;
    color: #8e8ea0;
    line-height: 1.4;
}

/* Welcome Screen */
.welcome-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.welcome-content {
    max-width: 768px;
    text-align: center;
}

.welcome-icon {
    font-size: 48px;
    color: #10a37f;
    margin-bottom: 24px;
}

.welcome-content h1 {
    font-size: 32px;
    font-weight: 600;
    color: #ececf1;
    margin-bottom: 16px;
}

.welcome-content p {
    font-size: 16px;
    color: #8e8ea0;
    margin-bottom: 40px;
    line-height: 1.5;
}

.suggestion-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 32px;
}

.suggestion-card {
    background: #40414f;
    border: 1px solid #565869;
    border-radius: 8px;
    padding: 16px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #ececf1;
    font-size: 14px;
    line-height: 1.4;
}

.suggestion-card:hover {
    background: #2a2b32;
    border-color: #6b6c7b;
}

.suggestion-card i {
    color: #10a37f;
    font-size: 16px;
    flex-shrink: 0;
}

/* Main Session Setup */
.session-setup-main {
    background: #2a2b32;
    border-radius: 12px;
    padding: 32px;
    margin-top: 24px;
    text-align: left;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.session-setup-main .form-group {
    margin-bottom: 20px;
}

.session-setup-main .form-group label {
    display: block;
    color: #ececf1;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.session-setup-main .form-group input {
    width: 100%;
    padding: 12px 16px;
    background: #40414f;
    border: 1px solid #565869;
    border-radius: 8px;
    color: #ececf1;
    font-size: 16px;
    transition: border-color 0.2s ease;
}

.session-setup-main .form-group input:focus {
    outline: none;
    border-color: #10a37f;
    box-shadow: 0 0 0 2px rgba(16, 163, 127, 0.2);
}

.start-session-btn-main {
    width: 100%;
    padding: 14px 20px;
    background: #10a37f;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.start-session-btn-main:hover {
    background: #0e906f;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 163, 127, 0.3);
}

.start-session-btn-main:active {
    transform: translateY(0);
}

/* Markdown Styling */
.bot-message h1, .bot-message h2, .bot-message h3 {
    margin: 16px 0 8px 0;
    color: #ececf1;
    font-weight: 600;
}

.bot-message h2 {
    font-size: 1.2em;
    border-bottom: 1px solid #4a4b53;
    padding-bottom: 4px;
}

.bot-message p {
    margin: 8px 0;
    line-height: 1.6;
}

.bot-message ul, .bot-message ol {
    margin: 8px 0;
    padding-left: 20px;
}

.bot-message li {
    margin: 4px 0;
}

.bot-message code {
    background: #2a2b32;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
    color: #ececf1;
}

.bot-message pre {
    background: #2a2b32;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 12px 0;
}

.bot-message pre code {
    background: none;
    padding: 0;
}

.bot-message blockquote {
    border-left: 4px solid #10a37f;
    margin: 12px 0;
    padding-left: 16px;
    background: #2a2b32;
    font-style: italic;
    color: #8e8ea0;
}

.bot-message strong {
    font-weight: 600;
    color: #ececf1;
}

.bot-message em {
    font-style: italic;
    color: #8e8ea0;
}

/* Error Messages */
.error-message {
    background: #dc2626 !important;
    border: 1px solid #dc2626 !important;
    color: #fecaca !important;
}

.error-text {
    color: #f87171;
    font-size: 14px;
    margin-top: 5px;
}

/* Loading States */
.loading {
    opacity: 0.7;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #8e8ea0;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

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

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .sidebar-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .main-content {
        width: 100%;
    }
    
    .chat-header {
        padding: 16px 20px;
    }
    
    .sample-questions-container {
        position: fixed;
        bottom: 140px;
        left: 0;
        right: 0;
        padding: 16px 20px;
        z-index: 99;
    }
    
    .chat-input-container {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 16px 20px;
        z-index: 100;
    }
    
    .message {
        padding: 16px 20px;
    }
    
    .welcome-screen {
        padding: 24px 20px;
    }
    
    .suggestion-grid {
        grid-template-columns: 1fr;
    }
    
    .welcome-content h1 {
        font-size: 24px;
    }
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #565869;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #6b6c7b;
}

.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: #565869;
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: #6b6c7b;
}

/* Link Styles for Chat Messages */
.bot-message a {
    color: #10a37f;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.bot-message a:hover {
    color: #0e906f;
    border-bottom-color: #0e906f;
    text-decoration: none;
}

.bot-message a:visited {
    color: #8b5cf6;
}

.bot-message a:visited:hover {
    color: #7c3aed;
}

/* General link styles for the entire app */
a {
    color: #10a37f;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #0e906f;
    text-decoration: underline;
}

a:visited {
    color: #8b5cf6;
}

a:visited:hover {
    color: #7c3aed;
}