:root {
    --bg-page: #0f172a;
    --bg-chat: rgba(15, 23, 42, 0.7);
    --bg-glass: rgba(30, 41, 59, 0.6);
    --border-color: rgba(255, 255, 255, 0.1);
    
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.5);
    --accent: #8b5cf6;
    --accent-glow: rgba(139, 92, 246, 0.5);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --bot-bubble: rgba(30, 41, 59, 0.8);
    --user-bubble: #3b82f6;
    
    --bot-avatar: #10b981;
    --user-avatar: #6366f1;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-page);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.15), transparent 25%);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

.chat-container {
    width: 100%;
    max-width: 1000px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-chat);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

@media (min-width: 768px) {
    .chat-container {
        height: 92vh;
        border-radius: 20px;
        border: 1px solid var(--border-color);
    }
}

/* Header */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: var(--bg-glass);
    border-bottom: 1px solid var(--border-color);
}

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

.header-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.header-info h1 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.status {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 10px #10b981;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.gradient-btn {
    background: linear-gradient(135deg, var(--accent), var(--primary));
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 500;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.gradient-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

.gradient-btn i {
    font-size: 1.1rem;
}

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

/* Scrollbar styling */
.chat-box::-webkit-scrollbar {
    width: 6px;
}

.chat-box::-webkit-scrollbar-track {
    background: transparent;
}

.chat-box::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.chat-box::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Messages */
.message {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    max-width: 85%;
    opacity: 0;
    animation: slideUp 0.4s ease-out forwards;
}

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

.message.bot {
    align-self: flex-start;
}

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

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

.bot .avatar {
    background-color: var(--bot-avatar);
    color: white;
}

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

.bubble {
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 1rem;
    line-height: 1.5;
    word-wrap: break-word;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.bot .bubble {
    background: var(--bot-bubble);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

.user .bubble {
    background: var(--user-bubble);
    border-bottom-right-radius: 4px;
}

.image-wrapper {
    margin-top: 12px;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
}

.bubble img {
    max-width: 100%;
    display: block;
    border-radius: 12px;
    transition: transform 0.3s ease;
}

.bubble img:hover {
    transform: scale(1.02);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 4px 0;
}

.dot {
    width: 6px;
    height: 6px;
    background-color: var(--text-main);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
    opacity: 0.7;
}

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

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

/* Input Area */
.input-container {
    padding: 24px;
    background: var(--bg-glass);
    border-top: 1px solid var(--border-color);
}

.input-wrapper {
    display: flex;
    gap: 12px;
    background: rgba(15, 23, 42, 0.6);
    padding: 8px 8px 8px 20px;
    border-radius: 30px;
    border: 1px solid var(--border-color);
    transition: border-color 0.3s, box-shadow 0.3s;
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

#user-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    outline: none;
}

#user-input::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
}

.send-btn:hover {
    background-color: #2563eb;
    transform: scale(1.05);
}

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

/* Responsive adjustments */
@media (max-width: 640px) {
    .header-content h1 {
        font-size: 1.1rem;
    }
    
    .gradient-btn span {
        display: none;
    }
    
    .gradient-btn {
        padding: 10px;
        border-radius: 50%;
        width: 44px;
        height: 44px;
        justify-content: center;
    }
    
    .header-avatar {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .message {
        max-width: 95%;
    }
}
