/* Root Variables */
:root {
    --primary-color: #7263FF;
    --secondary-color: #CAC4FF;
    --bg-gradient: linear-gradient(135deg, #E8E5FF 0%, #D0D0E8 40%, #4A4A5A 100%);
    --user-bubble-gradient: linear-gradient(135deg, #7263FF 0%, #9584FF 100%);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: #E5E5EC;
    --glass-shadow: 0 8px 32px rgba(114, 99, 255, 0.12);
    --text-primary: #1A1A1A;
    --text-secondary: #6B6B7B;
    --ai-bubble-bg: #FFFFFF;
    --ai-bubble-border: #E5E5EC;
    --input-bg: #FFFFFF;
    --header-bg: rgba(255, 255, 255, 0.95);
    --status-color: #22C55E;
}

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

body {
    background: var(--bg-gradient);
    background-attachment: fixed;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.background-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse 80% 80% at 50% 50%, rgba(114, 99, 255, 0.1) 0%, transparent 80%);
    pointer-events: none;
    z-index: 0;
}

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

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

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

.header-info h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    background: rgba(34, 197, 94, 0.1);
    border-radius: 20px;
    font-size: 12px;
    color: var(--status-color);
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--status-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    display: flex;
    margin-bottom: 0;
    animation: slideIn 0.3s ease-out;
    width: 100%;
}

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

.message.user {
    justify-content: flex-end;
}

.bubble {
    background: var(--ai-bubble-bg);
    border: 1px solid var(--ai-bubble-border);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 16px;
    width: fit-content;
    max-width: 70%;
    font-size: 14px;
    line-height: 1.5;
}

.message.user .bubble {
    background: var(--user-bubble-gradient);
    color: white;
    border: none;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message.bot {
    justify-content: flex-start;
}

.message.bot .bubble {
    background: var(--ai-bubble-bg);
    border: 1px solid var(--ai-bubble-border);
    color: var(--text-primary);
}
    margin-top: 12px;
    margin-bottom: 8px;
    font-size: 16px;
}

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

.message.bot strong {
    font-weight: 600;
}

.message.bot em {
    font-style: italic;
}

.message.bot ul, .message.bot ol {
    margin-left: 20px;
    margin-bottom: 8px;
}

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

.message.bot a {
    color: var(--primary-color);
    text-decoration: none;
}

.message.bot a:hover {
    text-decoration: underline;
}

.download-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary-color);
    background: rgba(114, 99, 255, 0.1);
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    margin-top: 8px;
    transition: all 0.2s;
}

.download-link:hover {
    background: rgba(114, 99, 255, 0.2);
    transform: translateX(2px);
}

.typing-dots {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
    animation: bounce 1.4s infinite;
}

.dot:nth-child(1) { animation-delay: 0s; }
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

.input-area {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: var(--header-bg);
    border-top: 1px solid var(--glass-border);
    align-items: center;
}

#file-input {
    display: none;
}

#attach-btn, #send-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: #f0f0f5;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

#attach-btn:hover, #send-btn:hover {
    background: var(--primary-color);
    color: white;
}

#send-btn {
    background: var(--primary-color);
    color: white;
}

#send-btn:hover {
    background: #6052e6;
}

#user-input {
    flex: 1;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--input-bg);
    outline: none;
    transition: all 0.2s;
}

#user-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(114, 99, 255, 0.1);
}

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

svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

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

    .message.user > *, .message.bot > * {
        max-width: 90%;
    }
}

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

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

.chat-box::-webkit-scrollbar-thumb {
    background: rgba(114, 99, 255, 0.3);
    border-radius: 3px;
}

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