:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --primary-color: #8b5cf6;
    --primary-hover: #7c3aed;
    --secondary-color: #3b82f6;
    --bot-msg-bg: rgba(51, 65, 85, 0.6);
    --user-msg-bg: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-border: 1px solid rgba(255, 255, 255, 0.05);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.app-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* Background Blobs for Glassmorphism effect */
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    animation: float 10s infinite ease-in-out alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: rgba(139, 92, 246, 0.4);
    top: -10%;
    right: -5%;
}

.blob-2 {
    width: 350px;
    height: 350px;
    background: rgba(59, 130, 246, 0.3);
    bottom: -10%;
    left: -5%;
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-30px, 30px) scale(1.1); }
}

.chat-container {
    width: 100%;
    max-width: 900px;
    height: 90vh;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 24px;
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: 10;
}

/* Header */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: var(--glass-border);
    background: rgba(15, 23, 42, 0.4);
}

.header-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.bot-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    position: relative;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.status-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background-color: #10b981;
    border-radius: 50%;
    border: 2px solid var(--card-bg);
}

.header-info h1 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.status-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 300;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

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

/* Chat Area */
.chat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.system-message {
    align-self: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 16px;
    border-radius: 20px;
    margin-bottom: 10px;
}

.message {
    display: flex;
    gap: 16px;
    max-width: 80%;
    animation: fadeIn 0.4s ease-out forwards;
    opacity: 0;
    transform: translateY(10px);
}

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

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

.message .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    font-size: 16px;
}

.message.bot .avatar {
    background: rgba(139, 92, 246, 0.2);
    color: var(--primary-color);
    border: 1px solid rgba(139, 92, 246, 0.5);
}

.message.user .avatar {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message.user .message-content {
    align-items: flex-end;
}

.message p {
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.bot p {
    background: var(--bot-msg-bg);
    border: var(--glass-border);
    border-top-left-radius: 4px;
    color: var(--text-primary);
}

.message.user p {
    background: var(--user-msg-bg);
    border-top-right-radius: 4px;
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.timestamp {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin: 0 4px;
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    padding: 10px 24px;
    gap: 5px;
    align-items: center;
}

.typing-indicator.active {
    display: flex;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Input Area */
.chat-input-container {
    padding: 20px 24px;
    background: rgba(15, 23, 42, 0.6);
    border-top: var(--glass-border);
}

#chatForm {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    padding: 6px 6px 6px 16px;
    transition: all 0.3s ease;
}

#chatForm:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
    background: rgba(255, 255, 255, 0.08);
}

#messageInput {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    padding: 10px 0;
    outline: none;
}

#messageInput::placeholder {
    color: var(--text-secondary);
}

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.5);
}

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

/* Responsive */
@media (max-width: 950px) {
    .chat-container {
        width: 95%;
        height: 95vh;
    }
}

@media (max-width: 600px) {
    .chat-container {
        width: 100%;
        height: 100vh;
        border-radius: 0;
        border: none;
    }
    
    .blob {
        display: none;
    }
    
    .message {
        max-width: 90%;
    }
}

.mode-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
}
.mode-select option {
    background: var(--bg-color);
    color: var(--text-primary);
}
