* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.chat-container {
    width: 80%;
    /* max-width: 800px; */
    height: 80vh;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
    font-size: 1.5em;
    font-weight: bold;
}

.connection-status {
    padding: 10px;
    text-align: center;
    font-size: 0.9em;
    background: #f0f0f0;
}

.status-connected {
    background: #d4edda;
    color: #155724;
}

.status-disconnected {
    background: #f8d7da;
    color: #721c24;
}

.messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f5f5f5;
}

.message {
    margin-bottom: 15px;
    padding: 12px 15px;
    border-radius: 10px;
    max-width: 80%;
    word-wrap: break-word;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-sent {
    background: #667eea;
    color: white;
    margin-left: auto;
    text-align: right;
}

.message-received {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
}

.message-system {
    background: #fff3cd;
    color: #856404;
    text-align: center;
    margin: 10px auto;
    font-size: 0.9em;
}

.input-container {
    display: flex;
    padding: 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

#messageInput {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 1em;
    outline: none;
    transition: border-color 0.3s;
}

#messageInput:focus {
    border-color: #667eea;
}

#sendButton {
    margin-left: 10px;
    padding: 12px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: transform 0.2s, box-shadow 0.2s;
}

#sendButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

#sendButton:active {
    transform: translateY(0);
}

#sendButton:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}



.notifications-container {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: 90%;
    max-width: 400px;
    pointer-events: none;
}

.notification {
    background: white;
    padding: 12px 20px;
    margin-bottom: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 0.9em;
    text-align: center;
    animation: slideDown 0.3s ease-out;
    transition: opacity 0.3s;
    pointer-events: auto;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notification-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.notification-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.notification-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

/* login styles */

/* Add to existing style.css */

.login-container {
    padding: 30px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    outline: none;
    transition: border-color 0.3s;
}

.form-group input:focus {
    border-color: #667eea;
}

.login-button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.error-message {
    margin-top: 15px;
    padding: 10px;
    background: #f8d7da;
    color: #721c24;
    border-radius: 5px;
    text-align: center;
    display: none;
}

.error-message:not(:empty) {
    display: block;
}

.demo-credentials {
    margin-top: 25px;
    padding: 15px;
    background: #f0f0f0;
    border-radius: 8px;
    font-size: 0.9em;
}

.demo-credentials p {
    margin: 5px 0;
}

.demo-credentials code {
    background: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
}

.user-info {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    float: right;
    font-size: 0.8em;
}

.logout-button {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid white;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.3s;
}

.logout-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.message-ai {
    background: #e8f4f8;
    border-left: 4px solid #667eea;
}

.message-sources {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
    font-size: 0.85em;
}

.source-item {
    padding: 4px 0;
    color: #666;
}


/* start markdown output chat formatting */

/* AI Message Formatting */
.message-ai {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-left: 4px solid #667eea;
    max-width: 85%;
}

.ai-answer {
    line-height: 1.6;
}

.ai-answer p {
    margin: 0 0 12px 0;
}

.ai-answer p:last-child {
    margin-bottom: 0;
}

.ai-answer strong {
    color: #2c3e50;
    font-weight: 600;
}

.ai-answer em {
    font-style: italic;
    color: #555;
}

.ai-answer code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #e74c3c;
}

.ai-answer ul,
.ai-answer ol {
    margin: 10px 0;
    padding-left: 20px;
}

.ai-answer li {
    margin: 5px 0;
}

.ai-answer h1,
.ai-answer h2,
.ai-answer h3 {
    margin-top: 15px;
    margin-bottom: 10px;
    color: #2c3e50;
}

.ai-answer h1 {
    font-size: 1.3em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 5px;
}

.ai-answer h2 {
    font-size: 1.2em;
}

.ai-answer h3 {
    font-size: 1.1em;
}

/* Custom list styling (for Option 1) */
.list-item {
    margin: 8px 0;
    display: flex;
    align-items: flex-start;
}

.list-number {
    color: #667eea;
    font-weight: bold;
    margin-right: 8px;
    min-width: 25px;
}

.bullet {
    color: #667eea;
    margin-right: 8px;
    font-size: 1.2em;
}

/* Sources styling */
.message-sources {
    margin-top: 15px;
    padding-top: 12px;
    border-top: 2px solid rgba(102, 126, 234, 0.2);
}

.sources-header {
    font-size: 0.9em;
    margin-bottom: 8px;
    color: #555;
}

.sources-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.source-item {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 6px;
    font-size: 0.85em;
    transition: background 0.2s;
    cursor: pointer;
}

.source-item:hover {
    background: rgba(255, 255, 255, 0.9);
}

.source-icon {
    margin-right: 8px;
    font-size: 1.1em;
}

.source-name {
    color: #555;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Code blocks */
.ai-answer pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 10px 0;
}

.ai-answer pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

/* Blockquotes */
.ai-answer blockquote {
    border-left: 4px solid #667eea;
    padding-left: 15px;
    margin: 10px 0;
    color: #555;
    font-style: italic;
}

/* Links */
.ai-answer a {
    color: #667eea;
    text-decoration: none;
    border-bottom: 1px solid #667eea;
}

.ai-answer a:hover {
    color: #764ba2;
    border-bottom-color: #764ba2;
}

/* check above linse if used */
/* Typing Indicator */
.typing-indicator {
    background: white;
    border: 1px solid #e0e0e0;
    max-width: 200px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
}

.typing-animation {
    display: flex;
    align-items: center;
    gap: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #667eea;
    animation: typingBounce 1.4s infinite ease-in-out;
}

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

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

.typing-dot:nth-child(3) {
    animation-delay: 0s;
}

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

.typing-text {
    font-size: 0.85em;
    color: #666;
    font-style: italic;
}

/* status processing optional */
.status-processing {
    background: #fff3cd;
    color: #856404;
}

/* clear history button */
.clear-history-button {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid white;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1em;
    transition: background 0.3s;
}

.clear-history-button:hover {
    background: rgba(255, 100, 100, 0.3);
}