@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-main: #212121;
    --bg-sidebar: #171717;
    --bg-input: #2f2f2f;
    --text-primary: #ececec;
    --text-secondary: #b4b4b4;
    --accent: #10a37f;
    --border: rgba(255, 255, 255, 0.1);
    --bubble-user: #303030;
    --bubble-bot: transparent;
    --grad-bg: linear-gradient(135deg, #10a37f 0%, #1a7fcc 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 12px;
    transition: transform 0.3s ease;
    border-right: 1px solid var(--border);
    position: fixed;
    left: 0;
    top: 0;
}

.new-chat-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    font-weight: 500;
    margin-bottom: 20px;
}

.new-chat-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.chat-history {
    flex: 1;
    overflow-y: auto;
}

.history-item {
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: background 0.2s, color 0.2s;
}

.history-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

/* Main Content */
.main-container {
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: relative;
    background-color: var(--bg-main);
}

.header {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.chat-window {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
}

/* Messages */
.message-wrapper {
    width: 100%;
    padding: 25px 20px;
    display: flex;
    justify-content: center;
    opacity: 0;
}

.message-wrapper.user {
    background-color: transparent;
}

.message-wrapper.bot {
    background-color: rgba(255, 255, 255, 0.02);
}

.message-content {
    max-width: 800px;
    width: 100%;
    display: flex;
    gap: 20px;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.2rem;
}

.user .avatar {
    background-color: #5436da;
}

.bot .avatar {
    background-color: var(--accent);
}

.text {
    line-height: 1.6;
    font-size: 1rem;
    white-space: pre-wrap;
}

/* Input Area */
.input-container {
    padding: 20px;
    background-color: var(--bg-main);
    display: flex;
    justify-content: center;
}

.input-wrapper {
    max-width: 800px;
    width: 100%;
    position: relative;
    background-color: var(--bg-input);
    border-radius: 12px;
    padding: 12px 15px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
}

#user-input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    resize: none;
    max-height: 200px;
    padding-right: 40px;
}

#send-btn {
    position: absolute;
    right: 15px;
    bottom: 12px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
}

#send-btn.active {
    color: var(--accent);
}

/* Typing Indicator */
.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
    background: transparent;
    padding: 5px 0;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typing 1s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    100% {
        transform: translateY(0);
        opacity: 0.3;
    }

    50% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* Auth Pages */
.auth-wrapper {
    height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-main);
    padding: 20px;
}

.auth-card {
    background: var(--bg-input);
    padding: clamp(20px, 5vw, 50px);
    border-radius: 24px;
    width: 100%;
    max-width: 450px;
    border: 1px solid var(--border);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}

.auth-card h2 {
    margin-bottom: 35px;
    text-align: center;
    font-size: 2rem;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.form-group input {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    background: var(--bg-main);
    border: 1px solid var(--border);
    color: var(--text-primary);
    outline: none;
}

.auth-btn {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        left: -260px;
        z-index: 1000;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }

    .sidebar.open {
        transform: translateX(260px);
    }

    .main-container {
        margin-left: 0;
    }

    #sidebar-toggle {
        display: block !important;
    }

    .message-content {
        padding: 0 10px;
        gap: 15px;
    }

    .avatar {
        width: 30px;
        height: 30px;
        font-size: 1rem;
    }

    .input-container {
        padding: 10px;
    }

    .input-wrapper {
        border-radius: 8px;
    }

    #user-input {
        font-size: 0.95rem;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}