/* Modern CSS Reset & Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #020617 100%);
    --card-bg: rgba(30, 41, 59, 0.5);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.16);
    
    /* Elegant Accents */
    --accent-primary: #8b5cf6; /* Violet */
    --accent-secondary: #06b6d4; /* Cyan */
    --accent-gradient: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
    --accent-glow: rgba(139, 92, 246, 0.3);
    
    /* Text Colors */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dark: #0f172a;
    
    /* Chat Bubble Colors */
    --bubble-user: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    --bubble-ai: rgba(30, 41, 59, 0.8);
    --code-bg: #090d16;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    line-height: 1.6;
}

/* Glassmorphic App Wrapper */
.app-container {
    width: 90vw;
    max-width: 1000px;
    height: 90vh;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 
                0 0 40px rgba(139, 92, 246, 0.1);
    position: relative;
    overflow: hidden;
}

/* Background Glowing Orbs for Aesthetics */
.glowing-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.15;
    pointer-events: none;
}

.orb-1 {
    top: -10%;
    left: -10%;
    width: 400px;
    height: 400px;
    background: var(--accent-primary);
}

.orb-2 {
    bottom: -10%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: var(--accent-secondary);
}

/* Header Design */
header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.3);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--accent-gradient);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 15px var(--accent-glow);
}

.logo-icon i {
    font-size: 20px;
    color: white;
}

.logo-text h1 {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.logo-text span {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px #10b981;
}

.control-area {
    display: flex;
    gap: 12px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

/* Chat History Display Area */
.chat-messages {
    flex: 1;
    padding: 30px;
    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.1);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Welcome Message State */
.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-muted);
    max-width: 500px;
    margin: auto;
    padding: 20px;
    animation: fadeIn 0.8s ease;
}

.welcome-screen i {
    font-size: 48px;
    margin-bottom: 20px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 10px rgba(139, 92, 246, 0.2));
}

.welcome-screen h2 {
    color: var(--text-main);
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 24px;
}

.welcome-screen p {
    font-size: 15px;
    margin-bottom: 25px;
}

.quick-starts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
}

.quick-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 14px;
    border-radius: 16px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

/* Chat Message Bubbles */
.message {
    display: flex;
    gap: 16px;
    max-width: 85%;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

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

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.message.user .avatar {
    background: var(--accent-gradient);
    color: white;
}

.message.assistant .avatar {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: var(--accent-secondary);
}

.bubble {
    padding: 16px 20px;
    border-radius: 20px;
    font-size: 15.5px;
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.message.user .bubble {
    background: var(--bubble-user);
    color: white;
    border-top-right-radius: 4px;
}

.message.assistant .bubble {
    background: var(--bubble-ai);
    border: 1px solid var(--border-color);
    color: #e2e8f0;
    border-top-left-radius: 4px;
}

/* Typographic Styles in AI responses */
.bubble p {
    margin-bottom: 12px;
}

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

.bubble strong {
    color: #ffffff;
    font-weight: 600;
}

.bubble ul, .bubble ol {
    margin-left: 20px;
    margin-bottom: 12px;
}

.bubble li {
    margin-bottom: 6px;
}

/* Code Blocks Styling */
.bubble pre {
    background: var(--code-bg);
    border-radius: 12px;
    padding: 16px;
    overflow-x: auto;
    margin: 14px 0;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.bubble code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13.5px;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
    padding: 2px 6px;
    border-radius: 6px;
}

.bubble pre code {
    color: #f8fafc;
    background: transparent;
    padding: 0;
    border-radius: 0;
}

/* Input Form Area */
.input-area {
    padding: 24px 30px;
    border-top: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.4);
}

.input-wrapper {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 8px 12px;
    align-items: flex-end;
    gap: 10px;
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
    background: rgba(255, 255, 255, 0.05);
}

textarea {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-family: inherit;
    font-size: 15px;
    resize: none;
    max-height: 150px;
    min-height: 38px;
    padding: 8px 6px;
    line-height: 1.5;
}

textarea::placeholder {
    color: var(--text-muted);
}

.btn-send {
    background: var(--accent-gradient);
    color: white;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(139, 92, 246, 0.3);
    margin-bottom: 2px;
}

.btn-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.5);
}

.btn-send:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

/* Loading/Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    align-items: center;
    height: 20px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: var(--text-muted);
    border-radius: 50%;
    animation: pulse 1.2s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.4; }
    50% { transform: scale(1.3); opacity: 1; }
}

/* Alert Notification Overlay */
.alert-banner {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 10px 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideUp 0.3s ease;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .app-container {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        border: none;
    }
    
    header {
        padding: 15px;
    }
    
    .chat-messages {
        padding: 15px;
    }
    
    .input-area {
        padding: 15px;
    }
    
    .message {
        max-width: 90%;
    }
    
    .quick-starts {
        grid-template-columns: 1fr;
    }
}
