/* Reset & Basics */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: #ffffff;
    color: #0d0d0d;
    height: 100vh;
    overflow: hidden; /* App container handles overflow */
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    width: 400px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-box h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.login-box p {
    color: #6b7280;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.login-box input {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    outline: none;
}

.login-box input:focus {
    border-color: #10a37f;
}

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

/* Logos */
.brand-logo {
    max-width: 180px;
    height: auto;
    object-fit: contain;
}

.login-logo {
    margin: 0 auto 12px auto;
}

.sidebar-logo {
    margin-bottom: 12px;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: #f9f9f9;
    border-right: 1px solid #e5e5e5;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e5e5e5;
}

.sidebar-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 12px;
    gap: 4px;
}

.nav-item {
    text-decoration: none;
    color: #4b5563;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
}

.nav-item:hover {
    background-color: #f3f4f6;
    color: #111827;
}

.nav-item.active {
    background-color: #e5e7eb;
    color: #111827;
    font-weight: 600;
}

/* Main Content Area */
.main-content {
    flex: 1;
    position: relative;
    background: #ffffff;
}

.view {
    display: none;
    height: 100%;
    flex-direction: column;
}

.view.active {
    display: flex;
}

.view-header {
    padding: 20px 40px;
    border-bottom: 1px solid #e5e5e5;
}

.view-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

/* Chat View Specifics */
.chat-history-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 40px;
    padding-bottom: 120px; /* Space for input box */
}

.chat-history {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Message Styles */
.message {
    display: flex;
    gap: 16px;
    max-width: 100%;
}

.user-message {
    flex-direction: row-reverse;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

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

.user-avatar {
    background-color: #e5e5e5;
    color: #333;
}

.message-content {
    background-color: #f7f7f8;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 1rem;
    line-height: 1.6;
    color: #374151;
    max-width: 85%;
    white-space: pre-wrap;
}

.user-message .message-content {
    background-color: #007bff;
    color: white;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
    height: 24px;
}
.typing-dot {
    width: 6px;
    height: 6px;
    background-color: #888;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

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

/* Chat Input Box */
.chat-input-area {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px 40px;
    background: linear-gradient(180deg, rgba(255,255,255,0) 0%, #ffffff 20%);
}

.input-container {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    box-shadow: 0 0 15px rgba(0,0,0,0.1);
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
}

#user-input {
    width: 100%;
    border: none;
    background: transparent;
    padding: 16px 48px 16px 16px;
    font-size: 1rem;
    resize: none;
    outline: none;
    max-height: 200px;
    overflow-y: hidden;
}

#send-btn {
    position: absolute;
    right: 12px;
    bottom: 10px;
    background: #10a37f;
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#send-btn:hover { background: #0b8a6a; }
#send-btn:disabled { background: #ccc; cursor: not-allowed; }

.disclaimer {
    text-align: center;
    font-size: 0.75rem;
    color: #888;
    margin-top: 8px;
}

/* Upload View Specifics */
.upload-container {
    padding: 40px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.upload-desc {
    color: #6b7280;
    margin-bottom: 24px;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid #e5e5e5;
    margin-bottom: 24px;
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 1rem;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: #111827;
}

.tab-btn.active {
    color: #10a37f;
    border-bottom-color: #10a37f;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* File Upload Zone */
.upload-box {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    background: #f9fafb;
    transition: border-color 0.2s;
}

.upload-box.dragover {
    border-color: #10a37f;
    background: #ecfdf5;
}

.upload-box svg {
    margin-bottom: 16px;
}

.upload-box p {
    font-size: 1.1rem;
    color: #374151;
    font-weight: 500;
    margin-bottom: 8px;
}

.upload-box .sub-text {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 24px;
}

/* Text Area Upload */
#raw-text-input {
    width: 100%;
    height: 300px;
    padding: 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    resize: vertical;
    outline: none;
    margin-bottom: 16px;
}

#raw-text-input:focus {
    border-color: #10a37f;
}

/* Generic Buttons */
.upload-action-btn {
    background: #10a37f;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.upload-action-btn:hover {
    background: #0b8a6a;
}

.upload-action-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.status-message {
    margin-top: 16px;
    font-size: 0.95rem;
}

.status-success { color: #10a37f; }
.status-error { color: #dc2626; }
