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

:root {
    --primary-color: #0078d4;
    --primary-hover: #106ebe;
    --secondary-color: #6c757d;
    --background: #f5f5f5;
    --surface: #ffffff;
    --text-primary: #323130;
    --text-secondary: #605e5c;
    --border-color: #e1dfdd;
    --user-message-bg: #0078d4;
    --agent-message-bg: #f3f2f1;
    --error-color: #d13438;
    --success-color: #107c10;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.section {
    width: 100%;
    height: 100%;
}

.hidden {
    display: none !important;
}

/* Login Section */
.login-card {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 48px;
    max-width: 400px;
    margin: 0 auto;
    text-align: center;
}

.login-card h1 {
    font-size: 28px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.login-card p {
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 16px;
}

/* Buttons */
.btn {
    border: none;
    border-radius: 4px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
}

.btn-send {
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-send:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: scale(1.05);
}

/* Chat Section */
.chat-container {
    width: 100%;
    max-width: 1200px;
    height: 100vh;
    margin: 0 auto;
    background: var(--surface);
    display: flex;
    flex-direction: column;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface);
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.status {
    font-size: 13px;
    color: var(--text-secondary);
}

.status.connected {
    color: var(--success-color);
}

.status.connecting {
    color: var(--primary-color);
}

.status.error {
    color: var(--error-color);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: var(--background);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    max-width: 70%;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-text {
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.user-message .message-text {
    background: var(--user-message-bg);
    color: white;
    border-bottom-right-radius: 4px;
}

.agent-message .message-text {
    background: var(--agent-message-bg);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: var(--text-secondary);
    padding: 0 4px;
}

.user-message .message-time {
    text-align: right;
}

.system-message {
    align-self: center;
    max-width: 100%;
}

.system-message .message-text {
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    padding: 8px 16px;
    text-align: center;
}

/* Typing Indicator */
.typing-indicator .typing-dots {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--agent-message-bg);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Chat Input */
.chat-input-container {
    display: flex;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--surface);
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    max-height: 150px;
    overflow-y: auto;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color);
}

.chat-input:disabled {
    background: var(--background);
    cursor: not-allowed;
}

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

.chat-messages::-webkit-scrollbar-track {
    background: var(--background);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .login-card {
        padding: 32px 24px;
        margin: 16px;
    }

    .chat-messages {
        padding: 16px;
    }

    .message {
        max-width: 85%;
    }

    .chat-header {
        padding: 12px 16px;
    }

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

    .chat-input-container {
        padding: 12px 16px;
    }
}
