/* style.css - Simplified for Direct Upload */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: #212121;
    color: #e8eaed;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* --- Auth & Shared Modal Styles --- */
.auth-container {
    text-align: center;
    padding: 40px;
    background: #2f2f2f;
    border-radius: 12px;
    border: 1px solid #404040;
    max-width: 400px;
    width: 100%;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
}

.auth-input {
    padding: 12px 16px;
    border: 1px solid #5f6368;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: #1a1a1a;
    color: #e8eaed;
    outline: none;
    transition: border-color 0.2s ease;
}

.auth-input:focus {
    border-color: #BB3542;
}

.sign-in-button {
    background-color: #BB3542;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.sign-in-button:hover {
    background-color: #d63e4d;
}


/* --- Main App Container --- */
.chat-container {
    width: 100%;
    max-width: 800px;
    height: 90vh;
    background: transparent;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid #404040;
    background: #2f2f2f;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info span {
    font-size: 14px;
}

.mode-toggle {
    display: flex;
    background: #1a1a1a;
    border-radius: 8px;
    padding: 4px;
}

.toggle-button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    background: transparent;
    color: #9aa0a6;
    transition: all 0.2s ease;
}

.toggle-button.active {
    background: #BB3542;
    color: white;
}

.welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.welcome-logo {
    font-size: 48px;
    font-weight: 300;
    color: rgba(232, 234, 237, 0.6);
}

.welcome-subtitle {
    font-size: 16px;
    color: #9aa0a6;
    margin-top: 16px;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    word-wrap: break-word;
}

.message.user {
    align-self: flex-end;
}

.message.assistant {
    align-self: flex-start;
}

.message-content {
    font-size: 15px;
    line-height: 1.4;
    white-space: pre-wrap;
}

.message-content ol,
.message-content ul {
    padding-left: 25px;
    margin-top: 1em;
    margin-bottom: 1em;
}

.message-content li {
    margin-bottom: 0.5em;
}

.message.user .message-content {
    background: #2f2f2f;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #404040;
}

.chat-input-container {
    padding: 20px;
}

.chat-input-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    padding: 12px 16px;
    border: 1px solid #5f6368;
    border-radius: 8px;
    font-size: 15px;
    resize: none;
    outline: none;
    background: #2f2f2f;
    color: #e8eaed;
}

.chat-input:focus {
    border-color: #BB3542;
}

.send-button {
    width: 44px;
    height: 44px;
    background: #BB3542;
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

.send-button svg {
    width: 20px;
    height: 20px;
}

.loader {
    width: 20px;
    aspect-ratio: 1;
    position: relative;
}
.loader:before,
.loader:after {
    content: "";
    position: absolute;
    border-radius: 50px;
    box-shadow: 0 0 0 2px inset #fff;
    animation: l4 2.5s infinite;
}
.loader:after {
    animation-delay: -1.25s;
}
@keyframes l4 {
    0% {
        inset: 0 10px 10px 0;
    }
    12.5% {
        inset: 0 10px 0 0;
    }
    25% {
        inset: 10px 10px 0 0;
    }
    37.5% {
        inset: 10px 0 0 0;
    }
    50% {
        inset: 10px 0 0 10px;
    }
    62.5% {
        inset: 0 0 0 10px;
    }
    75% {
        inset: 0 0 10px 10px;
    }
    87.5% {
        inset: 0 0 10px 0;
    }
    100% {
        inset: 0 10px 10px 0;
    }
}

/* --- EDITED: Database Interface & Direct Upload Styles --- */
.database-interface {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 20px;
}

.db-header {
    text-align: center;
    margin-bottom: 20px;
}

.db-header h3 {
    font-size: 24px;
    font-weight: 500;
}

.db-header p {
    color: #9aa0a6;
    margin-top: 8px;
    font-size: 15px;
}

.upload-zone {
    border: 2px dashed #5f6368;
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
    width: 100%;
    max-width: 700px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: #BB3542;
    background: rgba(187, 53, 66, 0.05);
}

.upload-zone-text {
    color: #e8eaed;
    font-size: 16px;
    font-weight: 500;
}

.file-input {
    display: none;
}

.selected-files-container {
    width: 100%;
    max-width: 500px;
    margin-top: 20px;
}

.selected-files {
    max-height: 180px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.selected-file {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #2f2f2f;
    border: 1px solid #404040;
    border-radius: 6px;
    margin-bottom: 8px;
}

.selected-file-name {
    font-size: 14px;
}

.remove-file {
    background: none;
    border: none;
    color: #9aa0a6;
    cursor: pointer;
    font-size: 18px;
}

.upload-actions {
    display: flex;
    justify-content: flex-end;
}

.confirm-upload {
    background: #BB3542;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.confirm-upload:disabled {
    background: #5f6368;
    cursor: not-allowed;
}

.upload-progress {
    margin: 15px 0 5px 0;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #404040;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #BB3542;
    width: 0%;
    transition: width 0.3s ease;
}

/* --- Citations Styles --- */
.sources-section {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #404040;
    display: block;
    width: 100%;
    clear: both;
}

.sources-section .sources-title {
    font-weight: 500;
    margin-bottom: 8px;
    color: #e8eaed;
    font-size: 14px;
    display: block;
}

.sources-section .source-item {
    display: block;
    margin-bottom: 4px;
    color: #9aa0a6;
    font-size: 13px;
    line-height: 1.4;
}

.sources-section .source-item:before {
    content: "- ";
    color: #9aa0a6;
}

/* --- Custom Uppy.js Styles --- */

/* Main container for the drag-drop UI */
#uppy-drag-drop .uppy-DragDrop-container {
    font-family: 'Inter', -apple-system, sans-serif; /* Match your body font */
    background: transparent;
    width: 100%;
    max-width: 700px;
}

/* The dashed drop zone itself */
#uppy-drag-drop .uppy-DragDrop-inner {
    background: transparent;
    padding: 60px 40px; /* Match your original upload-zone padding */
    transition: all 0.2s ease;
}

/* The text label like "Drop files here or" */
#uppy-drag-drop .uppy-DragDrop-label {
    font-size: 16px;
    color: #e8eaed; /* Your primary text color */
    font-weight: 500;
}

/* The "browse" link text */
#uppy-drag-drop .uppy-DragDrop-browse {
    color: #BB3542; /* Your primary accent color */
    text-decoration: none;
    font-weight: 500;
}

/* Highlight effect when dragging a file over */
#uppy-drag-drop .uppy-DragDrop-container.uppy-is-drag-over .uppy-DragDrop-inner {
    border-color: #BB3542; /* Use your accent color for hover */
    background: rgba(187, 53, 66, 0.05); /* Subtle background glow on hover */
}

/* Styling the status bar below the drop zone */
/* --- Style the "Upload X files" button --- */
#uppy-status-bar .uppy-StatusBar-actionBtn--upload {
    background-color: #BB3542 !important; 
    border: none !important;
    border-radius: 8px; /* Match your other buttons */
    font-weight: 500;
    font-size: 14px;
    padding: 10px 20px;
    transition: background-color 0.2s ease;
}

#uppy-status-bar .uppy-StatusBar-actionBtn--upload:hover {
    background-color: #d63e4d; /* Hover color from your sign-in button */
}

#uppy-status-bar .uppy-StatusBar-actionBtn--upload:disabled {
    background-color: #5f6368; /* Disabled color from your other buttons */
}

/* --- File List & Search Styles --- */

.file-management-section {
    width: 100%;
    max-width: 700px;
    margin-top: 40px;
    border-top: 1px solid #404040;
    padding-top: 30px;
}

.file-list-title {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 20px;
    text-align: center;
}

.search-container {
    margin-bottom: 20px;
}

#fileSearchInput {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #5f6368;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: #2f2f2f; /* Darker background to stand out */
    color: #e8eaed;
    outline: none;
    transition: border-color 0.2s ease;
}

#fileSearchInput:focus {
    border-color: #BB3542;
}

#fileListLoader {
    display: flex;
    justify-content: center;
    padding: 20px;
}

.managed-file-item {
    padding: 8px 12px;
    font-size: 14px;
    color: #e8eaed;
    border: 1px solid #404040;
    border-radius: 4px;
    margin-bottom: 8px;
    background: transparent;
}

#fileListContainer {
    max-height: 400px;
    overflow-y: auto;
    background: transparent;
    padding: 0 0 80px 0;
}

.no-files-message {
    color: #9aa0a6;
    text-align: center;
    padding: 20px;
}
