:root {
    /* Colors */
    --bg-dark: #09090b;
    --bg-panel: rgba(24, 24, 27, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.5);
    --message-user: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    --message-bot: rgba(39, 39, 42, 0.8);
    --glass-blur: blur(16px);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
}

/* Background Effects */
.app-container {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.ambient-light {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.6;
    animation: pulseBg 10s infinite alternate;
}

.main-light {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99,102,241,0.3) 0%, rgba(0,0,0,0) 70%);
    top: -200px;
    left: -100px;
}

.secondary-light {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(168,85,247,0.3) 0%, rgba(0,0,0,0) 70%);
    bottom: -150px;
    right: -100px;
    animation-delay: -5s;
}

@keyframes pulseBg {
    0% { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.2) translate(50px, -50px); }
}

.grid-overlay {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 30px 30px;
    z-index: -1;
    mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
}

/* Main Chat UI */
.chat-interface {
    width: 100%;
    max-width: 800px;
    height: calc(100vh - 40px);
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.05) inset;
    overflow: hidden;
    position: relative;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* Header */
.chat-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background: rgba(24, 24, 27, 0.4);
    backdrop-filter: blur(20px);
}

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

.avatar-container {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.avatar-ring {
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--accent-color), #a855f7, var(--accent-color));
    animation: rotate 4s linear infinite;
    z-index: 0;
}

.avatar {
    width: 72px;
    height: 72px;
    background: #000;
    border-radius: 50%;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 10px rgba(99, 102, 241, 0.5);
    overflow: hidden;
}

/* AI Orb Animation */
.ai-orb {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.orb-core {
    width: 40%;
    height: 40%;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 20px #fff, 0 0 40px var(--accent-color);
    animation: pulseCore 2s infinite ease-in-out alternate;
}

.orb-layer {
    position: absolute;
    border-radius: 50%;
    border: 3px solid rgba(99, 102, 241, 0.4);
    box-sizing: border-box;
}

.layer1 { 
    width: 60%; height: 60%; 
    animation: spin1 4s linear infinite; 
    border-top-color: transparent; 
    border-bottom-color: transparent; 
}
.layer2 { 
    width: 80%; height: 80%; 
    animation: spin2 5s linear infinite reverse; 
    border-left-color: transparent; 
    border-right-color: transparent; 
}
.layer3 { 
    width: 100%; height: 100%; 
    animation: spin3 6s ease-in-out infinite; 
    box-shadow: inset 0 0 15px rgba(168, 85, 247, 0.5); 
    border-color: transparent; 
    background: radial-gradient(circle, transparent 40%, rgba(99,102,241,0.2) 100%); 
}

@keyframes spin1 { 100% { transform: rotate(360deg); } }
@keyframes spin2 { 100% { transform: rotate(360deg) scale(1.1); } }
@keyframes spin3 { 
    0%, 100% { transform: scale(1); opacity: 0.8; } 
    50% { transform: scale(1.05); opacity: 1; filter: hue-rotate(45deg); } 
}
@keyframes pulseCore { 100% { transform: scale(1.2); box-shadow: 0 0 30px #fff, 0 0 60px #a855f7; } }

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

.header-text h1 {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

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

.status-dot {
    width: 8px;
    height: 8px;
    background-color: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.6);
}

.header-actions {
    display: flex;
    gap: 12px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    border: 1px solid transparent;
    text-decoration: none;
}

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

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

.chat-body::-webkit-scrollbar {
    width: 6px;
}

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

/* Messages */
.message {
    display: flex;
    gap: 16px;
    max-width: 85%;
    animation: fadeIn 0.4s ease forwards;
}

@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: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    overflow: hidden;
}

.message-avatar svg {
    width: 18px;
    height: 18px;
    color: var(--accent-color);
}

.message-avatar img, .message-avatar video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

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

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

.message-content {
    background: var(--message-bot);
    padding: 16px;
    border-radius: 16px 16px 16px 4px;
    border: 1px solid rgba(255,255,255,0.05);
    font-size: 0.95rem;
}

.message-content p {
    margin-bottom: 12px;
}

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

.message-content strong {
    color: var(--accent-color);
    font-weight: 600;
}

.message-content ul {
    margin: 8px 0 8px 20px;
    list-style-type: circle;
}

.message-content li {
    margin-bottom: 4px;
}

.message.user .message-content {
    background: var(--message-user);
    border-radius: 16px 16px 4px 16px;
    border: none;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.2);
}

/* Chips */
.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chip:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 24px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: -10px;
    transition: opacity 0.3s;
}

.typing-indicator.hidden {
    opacity: 0;
    pointer-events: none;
}

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

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

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

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

/* Footer / Input Area */
.chat-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    background: rgba(24, 24, 27, 0.8);
    backdrop-filter: blur(20px);
}

.message-form {
    margin-bottom: 8px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 4px;
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

#userInput {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 14px 16px;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
}

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

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--accent-color);
    color: white;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 4px;
}

.send-btn:hover {
    background: #4f46e5;
    transform: scale(1.05);
    box-shadow: 0 0 15px var(--accent-glow);
}

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

.send-btn svg {
    width: 20px;
    height: 20px;
}

.footer-note {
    text-align: center;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        padding: 0;
    }
    
    .chat-interface {
        height: 100vh;
        border-radius: 0;
        border: none;
    }
    
    .message {
        max-width: 90%;
    }
}
