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

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --bg-color: #f3f4f6;
    --surface-color: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
}

.hidden {
    display: none !important;
}

/* ===== LOGIN SCREEN ===== */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    background: var(--surface-color);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 40px;
    max-width: 400px;
    width: 100%;
    animation: slideUp 0.5s ease-out;
}

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

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

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

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.login-form .input-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.login-form input {
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-login {
    padding: 14px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-login:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.error-message {
    color: var(--danger-color);
    font-size: 14px;
    margin-top: 10px;
    text-align: center;
    min-height: 20px;
}

/* ===== CHAT APP ===== */
.chat-app {
    min-height: 100vh;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-container {
    background: var(--surface-color);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    max-width: 1000px;
    width: 100%;
    height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content h1 {
    font-size: 24px;
    margin-bottom: 5px;
}

.header-content p {
    font-size: 14px;
    opacity: 0.9;
}

.btn-logout {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

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

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    background: var(--bg-color);
}

.welcome-message {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.welcome-message h2 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.welcome-message ul {
    margin: 20px 0;
    padding-left: 20px;
}

.welcome-message li {
    margin: 10px 0;
    color: var(--text-secondary);
}

.message {
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease-out;
}

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

.message-user {
    display: flex;
    justify-content: flex-end;
}

.message-user .message-content {
    background: var(--primary-color);
    color: white;
    padding: 12px 18px;
    border-radius: 18px 18px 4px 18px;
    max-width: 70%;
    word-wrap: break-word;
}

.message-assistant {
    display: flex;
    justify-content: flex-start;
}

.message-assistant .message-content {
    background: white;
    color: var(--text-primary);
    padding: 12px 18px;
    border-radius: 18px 18px 18px 4px;
    max-width: 70%;
    word-wrap: break-word;
    box-shadow: var(--shadow);
}

.message-content pre {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 10px 0;
}

.message-content code {
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.chat-input-container {
    padding: 20px 30px;
    background: white;
    border-top: 1px solid var(--border-color);
}

.chat-form {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.chat-form input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: 24px;
    font-size: 15px;
    transition: all 0.3s;
}

.chat-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

.btn-send {
    padding: 14px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.btn-send:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-send:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
}

.quick-questions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.quick-btn {
    padding: 8px 16px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
}

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

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay p {
    color: white;
    margin-top: 20px;
    font-size: 16px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .chat-container {
        height: 100vh;
        border-radius: 0;
    }

    .chat-header {
        padding: 15px 20px;
    }

    .header-content h1 {
        font-size: 20px;
    }

    .chat-messages {
        padding: 20px;
    }

    .message-content {
        max-width: 85% !important;
    }

    .quick-questions {
        flex-direction: column;
    }

    .quick-btn {
        width: 100%;
    }
}