:root {
    /* Palette Premium Dark */
    --bg-base: #020617;
    --bg-surface: #0f172a;
    --surface-float: rgba(30, 41, 59, 0.65);
    
    /* Accents */
    --primary: #38bdf8;
    --primary-gradient: linear-gradient(135deg, #38bdf8, #0ea5e9);
    --primary-glow: rgba(56, 189, 248, 0.25);
    
    /* Text */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    /* Borders & Radius */
    --border-subtle: rgba(255, 255, 255, 0.08);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 10px;
}

/* RESET & BASE */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-base);
    background-image: 
        radial-gradient(circle at 50% 0%, rgba(30, 58, 138, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 50% 100%, rgba(56, 189, 248, 0.05) 0%, transparent 50%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* HEADER - Glassmorphic */
.ai-header {  
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;  
    justify-content: space-between;  
    align-items: center;  
    padding: 16px 28px;  
    background: rgba(2, 6, 23, 0.7);  
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);  
}

.ai-title { 
    font-weight: 800; 
    font-size: 18px; 
    letter-spacing: -0.3px; 
}

.ai-title span { 
    color: var(--primary); 
    text-shadow: 0 0 15px var(--primary-glow);
}

.back-btn {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--border-subtle);
    font-size: 13px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.back-btn:hover { 
    background: var(--text-main); 
    color: var(--bg-base); 
    transform: translateY(-1px);
}

/* WELCOME SCREEN */
.welcome-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 1;
    pointer-events: none;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.welcome-hidden {
    opacity: 0;
    transform: translate(-50%, -55%) scale(0.95);
}

.neuron-text {
    font-size: 48px;
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--text-main);
    margin-bottom: 4px;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.indra-text {
    font-size: 15px;
    font-weight: 500;
    color: var(--primary);
    letter-spacing: 3px;
    text-transform: uppercase;
    opacity: 0.8;
}

/* MODAL - Premium Card Look */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: 0.4s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-surface);
    border: 1px solid rgba(56, 189, 248, 0.15);
    padding: 32px;
    border-radius: var(--radius-lg);
    max-width: 420px;
    width: 90%;
    transform: translateY(20px) scale(0.95);
    transition: 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-overlay.active .modal-content {
    transform: translateY(0) scale(1);
}

.modal-header h2 {
    color: var(--text-main);
    font-size: 22px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header span {
    color: var(--bg-base);
    background: var(--primary);
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
}

.modal-body {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 28px;
    font-size: 14px;
}

.modal-body ul {
    margin-top: 12px;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-btn {
    background: var(--primary-gradient);
    color: var(--bg-base);
    border: none;
    padding: 14px 30px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
}

.modal-btn:hover {
    box-shadow: 0 8px 25px var(--primary-glow);
    transform: translateY(-2px);
}

/* CHAT AREA */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px 100px; /* Extra bottom padding for floating input */
    max-width: 850px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    opacity: 0;
    transition: opacity 0.8s ease;
    scroll-behavior: smooth;
}

.chat-visible { opacity: 1 !important; }

/* CUSTOM SCROLLBAR */
.chat-container::-webkit-scrollbar { width: 6px; }
.chat-container::-webkit-scrollbar-track { background: transparent; }
.chat-container::-webkit-scrollbar-thumb { 
    background: rgba(255, 255, 255, 0.1); 
    border-radius: 10px; 
}
.chat-container::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* MESSAGE BUBBLES - Natural Flow */
.message { 
    display: flex; 
    animation: slideUpFade 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; 
    opacity: 0; 
}

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

.bubble {
    max-width: 85%;
    padding: 16px 20px;
    font-size: 15px;
    line-height: 1.6;
    position: relative;
    word-wrap: break-word;
}

/* USER STYLE */
.user { justify-content: flex-end; }
.user .bubble {
    background: var(--primary-gradient);
    color: #000;
    font-weight: 500;
    /* Asymmetrical border for organic chat feel */
    border-radius: 20px 20px 4px 20px;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.15);
}

/* AI STYLE */
.ai { justify-content: flex-start; }
.ai .bubble {
    background: var(--surface-float);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    border-radius: 20px 20px 20px 4px;
}

/* BUBBLE FOOTER & COPY BTN */
.bubble-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.copy-btn {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted) !important;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.copy-btn:hover {
    background: rgba(56, 189, 248, 0.1) !important;
    color: var(--primary) !important;
    border-color: rgba(56, 189, 248, 0.3);
}

/* MARKDOWN STYLING */
pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 12px 0;
    border: 1px solid var(--border-subtle);
}

code {
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.85em;
    background: rgba(0, 0, 0, 0.2);
    color: #e2e8f0;
    padding: 3px 6px;
    border-radius: 4px;
}

pre code { background: transparent; padding: 0; }
.message-content b { color: var(--primary); font-weight: 600; }

/* FLOATING INPUT AREA (Modern Pill Design) */
.chat-input {
    position: sticky;
    bottom: 0;
    z-index: 1000;
    padding: 20px;
    /* Gradasi transparan agar input terlihat melayang dengan natural */
    background: linear-gradient(to top, var(--bg-base) 60%, transparent);
    display: flex;
    justify-content: center;
}

.input-group {
    max-width: 800px;
    width: 100%;
    background: var(--surface-float);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 8px 10px;
    display: flex;
    gap: 12px;
    align-items: flex-end;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
    transition: border-color 0.3s;
}

.input-group:focus-within {
    border-color: rgba(56, 189, 248, 0.4);
}

/* Model Select Dropdown */
#modelSelect {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 12px 4px 12px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    height: 44px;
    transition: color 0.3s;
}

#modelSelect:hover { color: var(--text-main); }
#modelSelect option { background: var(--bg-surface); color: var(--text-main); }

/* Textarea Prompt */
#prompt {
    flex: 1;
    padding: 12px 0;
    border: none;
    background: transparent;
    color: var(--text-main);
    font-size: 15px;
    line-height: 1.5;
    resize: none;
    max-height: 150px;
    min-height: 44px; /* Cocok dengan tinggi tombol */
}

#prompt:focus { outline: none; }
#prompt::placeholder { color: var(--text-muted); }

/* Send Button */
#sendBtn {
    width: 40px;
    height: 40px;
    margin-bottom: 2px;
    border: none;
    border-radius: 50%;
    background: var(--text-main);
    color: var(--bg-base);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
}

#sendBtn:hover { 
    transform: scale(1.08); 
    background: var(--primary);
}

/* LOADING STATE */
.loading-text {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-left: 5px;
}

.loading-text::after {
    content: "•••";
    letter-spacing: 2px;
    animation: typingPulse 1.5s infinite;
}

@keyframes typingPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}
