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

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #8b5cf6;
    --bg-gradient-start: #6366f1;
    --bg-gradient-end: #8b5cf6;
    --bg-color: #f8fafc;
    --chat-bg: #ffffff;
    --user-msg-bg: #6366f1;
    --bot-msg-bg: #f1f5f9;
    --border-color: #e2e8f0;
    --text-color: #1e293b;
    --text-light: #64748b;
    --text-lighter: #94a3b8;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.25);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: var(--text-color);
}

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

/* Header Styles */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 24px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
}

.header-content .logo {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.subtitle {
    font-size: 13px;
    opacity: 0.9;
    font-weight: 400;
}

.clear-btn {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    padding: 10px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(10px);
}

.clear-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.clear-btn svg {
    stroke-width: 2;
}

/* Chat Container */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    background: var(--bg-color);
}

/* Welcome Message */
.welcome-message {
    background: white;
    padding: 48px 40px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
}

.welcome-icon {
    display: inline-flex;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    border-radius: 16px;
    margin-bottom: 24px;
}

.welcome-icon svg {
    stroke: white;
    stroke-width: 2;
}

.welcome-message h2 {
    color: var(--text-color);
    margin-bottom: 12px;
    font-size: 32px;
    font-weight: 700;
}

.welcome-desc {
    color: var(--text-light);
    margin-bottom: 32px;
    font-size: 16px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-color);
    border-radius: 12px;
    transition: all 0.3s ease;
    text-align: left;
}

.feature-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    border-radius: 10px;
    flex-shrink: 0;
}

.feature-icon svg {
    stroke: white;
}

.feature-item span {
    color: var(--text-color);
    font-weight: 600;
    font-size: 14px;
}

.start-prompt {
    color: var(--text-lighter);
    font-size: 14px;
    font-style: italic;
}

/* Messages */
.message {
    margin-bottom: 24px;
    animation: fadeIn 0.4s ease;
}

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

.message-label {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.message-content {
    display: inline-block;
    max-width: 75%;
    padding: 16px 20px;
    border-radius: 16px;
    line-height: 1.6;
    word-wrap: break-word;
    font-size: 15px;
}

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

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

.user-message .message-content {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: var(--shadow-md);
}

.bot-message {
    text-align: left;
}

.bot-message .message-content {
    background: white;
    color: var(--text-color);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

/* Typing Indicator */
.typing-indicator {
    display: inline-block;
    padding: 16px 20px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
}

.typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--text-lighter);
    border-radius: 50%;
    margin: 0 3px;
    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% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

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

#userInput {
    flex: 1;
    padding: 16px 20px;
    border: 2px solid var(--border-color);
    border-radius: 16px;
    font-size: 15px;
    resize: none;
    font-family: inherit;
    transition: all 0.3s ease;
    max-height: 150px;
    line-height: 1.5;
}

#userInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

#userInput::placeholder {
    color: var(--text-lighter);
}

.send-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 56px;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

.send-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.send-btn:active:not(:disabled) {
    transform: translateY(0);
}

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

.send-btn svg {
    stroke-width: 2.5;
}

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

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

.hidden {
    display: none !important;
}

/* Footer */
footer {
    text-align: center;
    padding: 16px;
    background: white;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-lighter);
    font-weight: 500;
}

/* Code Styling */
pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 12px 0;
    border: 1px solid #334155;
}

code {
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: 13px;
}

.bot-message .message-content code {
    background: #f1f5f9;
    color: #1e293b;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 600;
    border: 1px solid #e2e8f0;
}

/* Scrollbar Styling */
.chat-container::-webkit-scrollbar {
    width: 10px;
}

.chat-container::-webkit-scrollbar-track {
    background: var(--bg-color);
}

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

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

/* Mobile Responsive */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        height: 100vh;
        border-radius: 0;
        max-width: 100%;
    }

    header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        padding: 20px;
    }

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

    .welcome-message {
        padding: 32px 24px;
    }

    .welcome-message h2 {
        font-size: 24px;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .message-content {
        max-width: 85%;
        font-size: 14px;
    }

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

    #userInput {
        font-size: 16px;
        padding: 14px 16px;
    }

    .send-btn {
        min-width: 48px;
        min-height: 48px;
        padding: 12px;
    }
}