:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --bg-panel: rgba(30, 41, 59, 0.7);
    --bg-panel-inner: rgba(15, 23, 42, 0.6);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --bot-msg-bg: rgba(51, 65, 85, 0.7);
    --user-msg-bg: #6366f1;
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --danger: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Animated Background Elements */
.app-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    animation: float 10s infinite ease-in-out alternate;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: rgba(99, 102, 241, 0.3);
    top: -100px;
    left: -100px;
}

.shape-2 {
    width: 500px;
    height: 500px;
    background: rgba(168, 85, 247, 0.25);
    bottom: -150px;
    right: -100px;
    animation-delay: -5s;
}

.shape-3 {
    width: 300px;
    height: 300px;
    background: rgba(14, 165, 233, 0.2);
    top: 30%;
    left: 40%;
    animation-delay: -2s;
}

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

/* Glassmorphism Classes */
.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.glass-panel-inner {
    background: var(--bg-panel-inner);
    border: 1px solid var(--glass-border);
}

/* Main Chat UI */
.chat-wrapper {
    width: 100%;
    max-width: 900px;
    height: 90vh;
    border-radius: 24px;
    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: 1px solid var(--glass-border);
    background: rgba(30, 41, 59, 0.8);
}

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

.bot-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    position: relative;
}

.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid #6366f1;
    animation: pulse 2s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

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

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

.status-dot {
    width: 8px;
    height: 8px;
    background-color: #22c55e;
    border-radius: 50%;
    display: inline-block;
}

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

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

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

.icon-btn.active {
    color: var(--primary-color);
}

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

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

.message {
    display: flex;
    gap: 15px;
    max-width: 80%;
    animation: fadeIn 0.3s ease-out forwards;
}

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

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

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

.bot-message .message-avatar {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    font-size: 14px;
}

.bot-message .message-content {
    background: var(--bot-msg-bg);
    border: 1px solid var(--glass-border);
    border-radius: 0 18px 18px 18px;
}

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

.user-message .message-avatar {
    background: #38bdf8;
    font-size: 14px;
}

.user-message .message-content {
    background: var(--user-msg-bg);
    border-radius: 18px 0 18px 18px;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

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

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

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

/* Typing Indicator */
.typing-indicator {
    padding: 0 24px 10px;
    display: flex;
    gap: 5px;
}

.typing-indicator.hidden {
    display: none;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: 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-area {
    padding: 20px 24px;
    background: rgba(30, 41, 59, 0.8);
    border-top: 1px solid var(--glass-border);
    position: relative;
}

.input-container {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 30px;
    gap: 10px;
}

.input-container input {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    padding: 10px 5px;
    outline: none;
}

.input-container input::placeholder {
    color: var(--text-secondary);
}

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

.mic-btn:hover {
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

.mic-btn.recording {
    color: white;
    background: var(--danger);
    animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.send-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.4);
}

.send-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.send-btn:active {
    transform: translateY(0);
}

.voice-status {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--danger);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.voice-status.visible {
    opacity: 1;
}

/* Tooltip */
.tooltip {
    position: relative;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.tooltip:hover::before {
    opacity: 1;
}

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