/* ChatGPT-like Dark Theme */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #212121;
    color: #ffffff;
    height: 100vh;
    overflow: hidden;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.8s ease-out;
}

.loading-content {
    text-align: center;
    max-width: 600px;
    padding: 40px;
}

.ascii-art {
    color: #00ff88;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.2;
    margin-bottom: 30px;
    animation: glow 1.5s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 0 0 10px #00ff88; }
    to { text-shadow: 0 0 20px #00ff88, 0 0 30px #00ff88; }
}

.loading-text {
    font-size: 18px;
    color: #cccccc;
    margin-bottom: 20px;
    animation: pulse 1.5s ease-in-out infinite;
}

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

.loading-bar {
    width: 300px;
    height: 4px;
    background: #333333;
    border-radius: 2px;
    margin: 0 auto 30px;
    overflow: hidden;
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, #00ff88, #00cc6a);
    border-radius: 2px;
    animation: loading 3s ease-in-out;
}

@keyframes loading {
    0% { width: 0%; }
    100% { width: 100%; }
}

/* Chat Interface */
.chat-interface {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #212121;
    opacity: 0;
    transition: opacity 0.8s ease-out;
}

/* Chat Header */
.chat-header {
    background: #2d2d2d;
    border-bottom: 1px solid #404040;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.ai-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #00ff88 0%, #00cc6a 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000000;
    font-size: 18px;
}

.header-info h1 {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 2px;
}

.status {
    font-size: 12px;
    color: #00ff88;
    display: flex;
    align-items: center;
    gap: 5px;
}

.status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #00ff88;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

.action-btn {
    width: 35px;
    height: 35px;
    background: #404040;
    border: none;
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: #555555;
    transform: scale(1.05);
}

/* Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #212121;
    height: calc(100vh - 160px); /* adjust based on header + input height */
    scroll-behavior: smooth;
}

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

.chat-messages::-webkit-scrollbar-track {
    background: #2d2d2d;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #555555;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #666666;
}

/* Welcome Message */
.welcome-message {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    text-align: center;
}

.welcome-content {
    max-width: 500px;
}

.ai-avatar-large {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #00ff88 0%, #00cc6a 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000000;
    font-size: 36px;
    margin: 0 auto 20px;
}

.welcome-content h2 {
    font-size: 28px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 15px;
}

.welcome-content p {
    font-size: 16px;
    color: #cccccc;
    line-height: 1.6;
}

/* Messages */
.message {
    display: flex;
    margin-bottom: 20px;
    animation: fadeInUp 0.3s ease-out;
}

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

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    margin: 0 10px;
    flex-shrink: 0;
}

.bot-message .message-avatar { background: linear-gradient(135deg, #00ff88 0%, #00cc6a 100%); color: #000000; }
.user-message .message-avatar { background: #404040; color: #ffffff; }

.message-content {
    max-width: 70%;
    padding: 15px 20px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    line-height: 1.5;
}

.bot-message .message-content { background: #2d2d2d; color: #ffffff; border: 1px solid #404040; }
.user-message .message-content { background: #00ff88; color: #000000; }

.message-time { font-size: 11px; opacity: 0.7; margin-top: 8px; display: block; }

/* Chat Input */
.chat-input-container {
    position: sticky;
    bottom: 0;
    background: #2d2d2d;
    border-top: 1px solid #404040;
    padding: 20px;
    z-index: 10;
}

.input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
    background: #404040;
    border-radius: 25px;
    padding: 8px;
    border: 1px solid #555555;
    transition: all 0.3s ease;
}

.input-wrapper:focus-within { border-color: #00ff88; box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.2); }

#messageInput {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #ffffff;
    font-size: 16px;
    padding: 12px 15px;
}

#messageInput::placeholder { color: #888888; }

.image-button, .send-button {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
}

.image-button { background: #555555; color: #ffffff; margin-right: 5px; }
.image-button:hover { background: #666666; transform: scale(1.05); }

.send-button { background: linear-gradient(135deg, #00ff88 0%, #00cc6a 100%); color: #000000; }
.send-button:hover { transform: scale(1.05); box-shadow: 0 5px 15px rgba(0, 255, 136, 0.3); }
.send-button:active { transform: scale(0.95); }

/* Typing Indicator */
.typing-indicator {
    position: absolute;
    bottom: 100px;
    left: 20px;
    display: none;
    align-items: center;
    gap: 10px;
    background: #2d2d2d;
    padding: 10px 15px;
    border-radius: 20px;
    border: 1px solid #404040;
}

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

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #00ff88;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

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

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

/* Responsive Design */
@media (max-width: 768px) {
    .chat-header { padding: 10px 15px; }
    .header-info h1 { font-size: 16px; }
    .message-content { max-width: 85%; }
    .chat-input-container { padding: 15px; }
    .input-wrapper { padding: 6px; }
    #messageInput { font-size: 14px; padding: 10px 12px; }
}

/* Dark mode is default */
@media (prefers-color-scheme: light) {
    body { background: #212121; color: #ffffff; }
}
