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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    height: 100vh;
    overflow: hidden;
}

.page {
    height: 100vh;
}

/* ===== Login ===== */
.login-card {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 48px 40px;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    text-align: center;
    width: 380px;
    max-width: 90vw;
}

.login-card h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #1a1a1a;
}

.login-subtitle {
    color: #888;
    font-size: 14px;
    margin-bottom: 28px;
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#password-input {
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

#password-input:focus {
    border-color: #4a90d9;
}

#login-btn {
    padding: 12px;
    background: #4a90d9;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

#login-btn:hover {
    background: #3a7bc8;
}

.error-text {
    color: #e74c3c;
    font-size: 13px;
    margin-top: 12px;
}

/* ===== Chat Page ===== */
#chat-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: #fff;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.chat-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.btn-link {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 14px;
}

.btn-link:hover {
    color: #333;
}

/* ===== Messages ===== */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.welcome-msg {
    text-align: center;
    color: #888;
    padding: 40px 20px;
}

.welcome-msg p {
    margin-bottom: 8px;
}

.welcome-msg .hint {
    font-size: 13px;
    color: #aaa;
}

.msg {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.msg-user {
    align-self: flex-end;
    background: #4a90d9;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.msg-user .msg-file {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    margin-bottom: 6px;
}

.msg-agent {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #eee;
    border-bottom-left-radius: 4px;
}

.msg-status {
    align-self: flex-start;
    background: transparent;
    color: #888;
    font-style: italic;
    font-size: 13px;
    padding: 4px 16px;
}

.msg-result {
    align-self: flex-start;
    background: #f0faf0;
    border: 1px solid #c3e6c3;
    border-radius: 12px;
    padding: 16px;
}

.msg-result .result-title {
    font-weight: 700;
    margin-bottom: 8px;
    color: #2d7a2d;
}

.msg-result a {
    color: #4a90d9;
    text-decoration: none;
}

.msg-result a:hover {
    text-decoration: underline;
}

.msg-error {
    align-self: flex-start;
    background: #fef0f0;
    border: 1px solid #f5c6c6;
    color: #c0392b;
}

.download-btn {
    display: inline-block;
    margin-top: 8px;
    margin-right: 8px;
    padding: 6px 14px;
    background: #4a90d9;
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}

.download-btn:hover {
    background: #3a7bc8;
    text-decoration: none;
}

.file-link {
    display: block;
    margin: 4px 0;
    font-size: 13px;
}

/* ===== Input Area ===== */
.chat-input-area {
    padding: 12px 24px 20px;
    background: #fff;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

.file-zone {
    margin-bottom: 8px;
}

.file-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e8f0fe;
    color: #4a90d9;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 13px;
}

.file-remove {
    background: none;
    border: none;
    color: #4a90d9;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
}

.drop-hint {
    display: inline-block;
}

.file-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #888;
    cursor: pointer;
    font-size: 13px;
    padding: 4px 0;
}

.file-label:hover {
    color: #4a90d9;
}

.input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

#message-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 120px;
    transition: border-color 0.2s;
}

#message-input:focus {
    border-color: #4a90d9;
}

.send-btn {
    width: 42px;
    height: 42px;
    border: none;
    background: #4a90d9;
    color: #fff;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.send-btn:hover:not(:disabled) {
    background: #3a7bc8;
}

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

/* ===== Drag Overlay ===== */
.drag-overlay {
    position: fixed;
    inset: 0;
    background: rgba(74, 144, 217, 0.1);
    border: 3px dashed #4a90d9;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drag-content {
    text-align: center;
    color: #4a90d9;
}

.drag-content p {
    margin-top: 12px;
    font-size: 18px;
    font-weight: 600;
}

/* ===== Typing indicator ===== */
.typing-indicator {
    display: inline-flex;
    gap: 4px;
    padding: 8px 16px;
    align-self: flex-start;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #aaa;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.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% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-4px); }
}

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

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