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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #000000;
    background-image:
        radial-gradient(ellipse at 20% 20%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(6, 182, 212, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(192, 38, 211, 0.1) 0%, transparent 70%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        linear-gradient(45deg, transparent 30%, rgba(139, 92, 246, 0.03) 50%, transparent 70%),
        linear-gradient(-45deg, transparent 30%, rgba(6, 182, 212, 0.03) 50%, transparent 70%);
    animation: cosmicRotate 20s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes cosmicRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(2px 2px at 20% 30%, white, transparent),
        radial-gradient(2px 2px at 60% 70%, white, transparent),
        radial-gradient(1px 1px at 50% 50%, white, transparent),
        radial-gradient(1px 1px at 80% 10%, white, transparent),
        radial-gradient(2px 2px at 90% 60%, white, transparent),
        radial-gradient(1px 1px at 33% 80%, white, transparent),
        radial-gradient(1px 1px at 15% 90%, white, transparent);
    background-size: 200% 200%;
    background-position: 0% 0%;
    opacity: 0.2;
    animation: stars 200s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes stars {
    0% { background-position: 0% 0%; }
    100% { background-position: 100% 100%; }
}

.container {
    width: 100%;
    max-width: 900px;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow:
        0 0 60px rgba(139, 92, 246, 0.3),
        0 0 120px rgba(6, 182, 212, 0.2),
        inset 0 0 80px rgba(139, 92, 246, 0.05);
    display: flex;
    flex-direction: column;
    height: 90vh;
    max-height: 850px;
    overflow: hidden;
    border: 1px solid rgba(139, 92, 246, 0.4);
    position: relative;
    z-index: 1;
}

.header {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(6, 182, 212, 0.1) 100%);
    color: white;
    padding: 16px 24px;
    border-radius: 24px 24px 0 0;
    border-bottom: 1px solid rgba(139, 92, 246, 0.3);
    backdrop-filter: blur(10px);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo-img {
    height: 120px;
    width: auto;
}

.clear-btn {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.5);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.clear-btn:hover {
    background: rgba(139, 92, 246, 0.4);
    border-color: rgba(139, 92, 246, 0.8);
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.3);
}

.welcome-message {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(6, 182, 212, 0.05) 100%);
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.2);
    margin-bottom: 16px;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.welcome-message h2 {
    color: #ffffff;
    margin-bottom: 8px;
    font-size: 18px;
    font-weight: 600;
}

.welcome-message p {
    color: #e0e0e0;
    margin-bottom: 14px;
    font-size: 14px;
}

.quick-prompts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.prompt-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.prompt-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.3), transparent);
    transition: left 0.5s ease;
}

.prompt-btn:hover::before {
    left: 100%;
}

.prompt-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(6, 182, 212, 0.5);
}

.prompt-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.prompt-text {
    flex: 1;
}

.message {
    margin-bottom: 18px;
    animation: fadeIn 0.3s ease;
}

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

.message-content {
    padding: 14px 18px;
    border-radius: 14px;
    max-width: 85%;
    word-wrap: break-word;
    font-size: 15px;
    line-height: 1.5;
}

.user-message .message-content {
    background: linear-gradient(135deg, #8a5cbc 0%, #d97757 100%);
    color: white;
    margin-left: auto;
    box-shadow: 0 4px 12px rgba(138, 92, 188, 0.3);
}

.assistant-message .message-content {
    background: #1a2332;
    color: #e8e9f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(138, 92, 188, 0.15);
}

.message-label {
    font-size: 12px;
    color: #6b7196;
    margin-bottom: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-message .message-label {
    text-align: right;
}

.thinking {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
    font-size: 14px;
    padding: 14px 18px;
    background: rgba(139, 92, 246, 0.15);
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
    max-width: 80%;
    border: 1px solid rgba(139, 92, 246, 0.4);
    backdrop-filter: blur(10px);
}

.thinking-dots {
    display: flex;
    gap: 5px;
}

.thinking-dots span {
    width: 8px;
    height: 8px;
    background: #8b5cf6;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

.thinking-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.thinking-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

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

.input-container {
    padding: 14px 20px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(6, 182, 212, 0.05) 100%);
    border-top: 1px solid rgba(139, 92, 246, 0.3);
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#userInput {
    flex: 1;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    font-size: 14px;
    resize: none;
    font-family: inherit;
    transition: all 0.2s ease;
    max-height: 100px;
    overflow-y: auto;
    color: #ffffff;
}

#userInput::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

#userInput:focus {
    outline: none;
    border-color: #8b5cf6;
    background: rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.3);
}

.send-btn {
    background: linear-gradient(135deg, #8b5cf6 0%, #06b6d4 100%);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.send-btn:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Markdown styling in messages */
.message-content code {
    background: rgba(138, 92, 188, 0.15);
    padding: 3px 8px;
    border-radius: 6px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 13px;
}

.message-content pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 14px;
    border-radius: 10px;
    overflow-x: auto;
    margin: 10px 0;
    border: 1px solid rgba(138, 92, 188, 0.2);
}

.message-content pre code {
    background: none;
    padding: 0;
}

.message-content h1,
.message-content h2,
.message-content h3 {
    margin: 14px 0 10px 0;
    color: #d97757;
}

.message-content ul,
.message-content ol {
    margin: 10px 0;
    padding-left: 24px;
}

.message-content li {
    margin: 6px 0;
}

.message-content p {
    margin: 10px 0;
}

.message-content strong {
    color: #b283d6;
    font-weight: 600;
}

.message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 14px 0;
}

.message-content th,
.message-content td {
    border: 1px solid rgba(138, 92, 188, 0.2);
    padding: 10px;
    text-align: left;
}

.message-content th {
    background-color: rgba(138, 92, 188, 0.15);
    font-weight: 600;
    color: #b283d6;
}

.error-message {
    background: rgba(255, 80, 80, 0.15);
    color: #ff6b6b;
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 18px;
    border-left: 4px solid #ff6b6b;
    border: 1px solid rgba(255, 80, 80, 0.3);
}

/* Scrollbar styling */
.chat-container::-webkit-scrollbar,
#userInput::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-track,
#userInput::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

.chat-container::-webkit-scrollbar-thumb,
#userInput::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.4);
    border-radius: 4px;
}

.chat-container::-webkit-scrollbar-thumb:hover,
#userInput::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.6);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}
