:root {
    --bg-color: #0f172a;
    --chat-bg: #1e293b;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --user-msg-bg: #3b82f6;
    --ai-msg-bg: #334155;
    --font-family: 'Outfit', system-ui, -apple-system, sans-serif;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
}

/* Background Effect */
.background-glob {
    position: absolute;
    top: -20%;
    left: -10%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, rgba(15, 23, 42, 0) 70%);
    z-index: -1;
    filter: blur(80px);
    animation: flow 10s ease-in-out infinite alternate;
}

@keyframes flow {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(10%, 10%);
    }
}

.app-container {
    width: 100%;
    max-width: 900px;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-left: 1px solid var(--glass-border);
    border-right: 1px solid var(--glass-border);
}

/* Header */
.chat-header {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    font-size: 1.5rem;
}

.logo h1 {
    font-weight: 600;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.icon-btn:hover {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.05);
}

/* Chat History */
.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    scroll-behavior: smooth;
}

.welcome-message {
    text-align: center;
    margin-top: 20%;
    color: var(--text-muted);
}

.welcome-message h2 {
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

/* Messages */
.message {
    display: flex;
    gap: 1rem;
    max-width: 85%;
    animation: fadeIn 0.3s ease-out;
}

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

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

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.message.user .message-avatar {
    background: var(--primary-color);
}

.message.ai .message-avatar {
    background: linear-gradient(135deg, #FF0080 0%, #7928CA 100%);
    /* Gemini-ish gradient */
}

.message-content {
    background: var(--ai-msg-bg);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    border-top-left-radius: 2px;
    color: var(--text-color);
    font-size: 1rem;
    line-height: 1.6;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message.user .message-content {
    background: var(--user-msg-bg);
    border-radius: var(--radius-md);
    border-top-right-radius: 2px;
}

/* Input Area */
.chat-input-area {
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.95);
    border-top: 1px solid var(--border-color);
}

.input-wrapper {
    display: flex;
    gap: 0.75rem;
    background: var(--chat-bg);
    padding: 0.75rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    transition: border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--primary-color);
}

textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-color);
    font-family: inherit;
    font-size: 1rem;
    resize: none;
    outline: none;
    max-height: 150px;
}

.send-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

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

.send-btn:disabled {
    background: var(--border-color);
    cursor: not-allowed;
    opacity: 0.7;
}

.disclaimer {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
}

/* Markdown Styles within Message */
.message-content p {
    margin-bottom: 0.5rem;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}

.message-content pre {
    background: #0d1117;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.5rem 0;
}

.message-content pre code {
    background: transparent;
    padding: 0;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-content {
    background: var(--chat-bg);
    width: 90%;
    max-width: 400px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: scaleIn 0.2s ease-out;
}

@keyframes scaleIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 1.5rem;
}

.modal-body label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.modal-body input {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-color);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.modal-body input:focus {
    border-color: var(--primary-color);
}

.helper-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
}

.helper-text a {
    color: var(--primary-color);
    text-decoration: none;
}

.modal-footer {
    padding: 1.25rem;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: flex-end;
}

.primary-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

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

/* Mobile Responsive */
@media (max-width: 600px) {
    .app-container {
        border: none;
    }

    .message {
        max-width: 95%;
    }
}