@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-color: #0f172a;
    --secondary-bg: #1e293b;
    --text-color: #e2e8f0;
    --text-dim: #94a3b8;
    --input-bg: #1e293b;
    --border-color: #2d3c54;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    --user-gradient: linear-gradient(135deg, #3b82f6, #2563eb);
    --ai-gradient: linear-gradient(135deg, #6366f1, #4f46e5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: radial-gradient(circle at center, var(--secondary-bg) 0%, var(--bg-color) 100%);
    color: var(--text-color);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.main {
    width: 100%;
    height: calc(100vh - 80px);
    position: fixed;
    bottom: 0;
    backdrop-filter: blur(20px);
}

.chat-app {
    display: flex;
    height: calc(100vh - 80px);
    bottom: 0;
    width: 100%;
    max-width: 880px;
    margin: 0 auto;
}

.welcome-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 5;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    background: radial-gradient(circle at center, var(--secondary-bg) 0%, var(--bg-color) 100%);
}

.welcome-screen.hidden {
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
}

.welcome-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 30px;
    background: linear-gradient(135deg, var(--accent) 0%, #60a5fa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 2px 10px rgba(59, 130, 246, 0.5);
}

.welcome-subtitle {
    font-size: 1.2rem;
    color: var(--text-dim);
    margin-bottom: 2rem;
    opacity: 0.8;
}

.welcome-prompt {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.prompt-text {
    color: var(--text-dim);
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--accent);
    animation: typingDot 1.4s infinite;
}

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

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

@keyframes typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

.chat-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px 0 80px 0;
    scroll-behavior: smooth;
}

.message {
    padding: 16px;
    margin: 10px 16px;
    line-height: 1.6;
    font-size: 15px;
    max-width: 880px;
    border-radius: 12px;
    transition: all 0.3s ease;
    animation: messageIn 0.3s ease forwards;
    opacity: 0;
    transform: translateY(10px);
}

@keyframes messageIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    background: var(--user-gradient);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.1);
    margin-left: auto;
    margin-right: 16px;
    width: fit-content;
}

.message.ai {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    margin-right: auto;
    margin-left: 16px;
    max-width: 80%;
}

.message-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.message-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: white;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.message-body {
    word-wrap: break-word;
    flex-grow: 1;
}

think {
    display: none;
}

.input-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(to top, var(--bg-color) 80%, transparent);
    z-index: 10;
}

.input-wrapper {
    max-width: 880px;
    margin: 0 auto;
    position: relative;
}

.input-box {
    display: flex;
    align-items: center;
    background-color: var(--input-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.input-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

#message-input {
    flex-grow: 1;
    border: none;
    background: transparent;
    padding: 16px;
    color: var(--text-color);
    font-size: 15px;
    outline: none;
}

#message-input::placeholder {
    color: var(--text-dim);
}

.send-button {
    background: var(--accent);
    border: none;
    min-width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin: 6px;
    transition: all 0.2s ease;
}

.send-button:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.send-button:active {
    transform: scale(0.95);
}

.send-button svg {
    width: 20px;
    height: 20px;
    stroke: white;
    transition: transform 0.2s ease;
}

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

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

pre {
    background-color: rgba(0, 0, 0, 0.3);
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 12px 0;
    font-family: 'Fira Code', monospace;
    border: 1px solid var(--border-color);
}

code {
    background-color: rgba(0, 0, 0, 0.2);
    padding: 3px 6px;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    font-size: 0.9em;
}

.clear-button {
    position: absolute;
    top: -50px;
    right: 0;
    background: var(--secondary-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(10px);
}

.clear-button:hover {
    background: var(--accent);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.clear-button:active {
    transform: translateY(0);
}

.clear-button svg {
    width: 16px;
    height: 16px;
}

@media (max-width: 900px) {
    .input-wrapper {
        padding: 0 15px;
    }
    
    .message {
        max-width: 90%;
    }
    
    .welcome-title {
        font-size: 2.5rem;
        padding: 0 20px;
    }
}
