:root {
    /* Color Palette - Light Blue Theme */
    --primary-color: #38bdf8;
    --primary-hover: #0284c7;
    --bg-color: #f0f9ff;
    --container-bg: #ffffff;
    --chat-bg: #f8fafc;
    --user-bubble: #bae6fd;
    --user-text: #0c4a6e;
    --ai-bubble: #ffffff;
    --ai-text: #334155;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --sidebar-bg: var(--chat-bg); /* Sesuai dengan chatroom background */
    
    /* Variables */
    --border-radius: 20px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Nunito', sans-serif;
    background-color: transparent;
    color: var(--ai-text);
    display: flex;
    justify-content: center;
    align-items: stretch;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* Layout Wrapper */
.layout-wrapper {
    display: flex;
    width: 100%;
    height: 100%;
    position: relative;
}

@media (min-width: 768px) {
    .layout-wrapper {
        height: 100%;
        gap: 0;
    }
}

/* Mascot Cluster - Floating Top Right Corner */
.mascot-container {
    position: absolute;
    top: 80px;
    right: 28px;
    width: 70px;
    height: 70px;
    z-index: 100;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mascot {
    position: absolute;
    animation: floatMascot 3s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.12));
}

.mascot.star {
    font-size: 42px;
    color: #fbbf24;
    z-index: 3;
}

.mascot.book {
    font-size: 24px;
    color: #38bdf8;
    top: -16px;
    right: -12px;
    animation-delay: 0.5s;
    z-index: 2;
}

.mascot.flower {
    font-size: 22px;
    color: #f472b6;
    bottom: -10px;
    left: -12px;
    animation-delay: 1s;
    z-index: 1;
}

@keyframes floatMascot {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-14px) rotate(9deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}

/* App Container */
.app-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--container-bg);
    position: relative;
    overflow: hidden;
    z-index: 10;
}

/* Header */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background-color: var(--container-bg);
    border-bottom: 1px solid var(--border-color);
    z-index: 20;
}

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


.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background-color: var(--user-bubble);
    color: var(--primary-color);
    border-radius: 50%;
}

.header-text h1 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--user-text);
}

.header-text p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

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

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.icon-btn:hover {
    background-color: var(--chat-bg);
    color: var(--primary-color);
}

.icon-btn.stop-btn {
    color: #f59e0b;
}

.icon-btn.stop-btn:hover {
    background-color: #fef3c7;
}

/* Chat Area - Full Light Blue Gradient */
.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 36px 28px;
    background: linear-gradient(180deg, #e0f7ff 0%, #bae6fd 40%, #e0f2fe 100%);
    display: flex;
    flex-direction: column;
    gap: 28px;
    z-index: 10;
}

/* Messages */
.message {
    display: flex;
    max-width: 85%;
    animation: fadeIn 0.3s ease forwards;
    position: relative;
    z-index: 20;
}

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

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

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

.bubble {
    padding: 16px 20px;
    border-radius: 20px;
    font-size: 1rem;
    line-height: 1.65;
    letter-spacing: 0.2px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    word-break: break-word;
}

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

.message.ai .bubble {
    background-color: var(--ai-bubble);
    color: var(--ai-text);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

/* Markdown Styles inside AI bubble */
.message.ai .bubble h1, .message.ai .bubble h2, .message.ai .bubble h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--user-text);
    line-height: 1.3;
}
.message.ai .bubble h1:first-child, .message.ai .bubble h2:first-child, .message.ai .bubble h3:first-child {
    margin-top: 0;
}
.message.ai .bubble p { margin-bottom: 1.25rem; }
.message.ai .bubble p:last-child { margin-bottom: 0; }
.message.ai .bubble ul, .message.ai .bubble ol { margin: 0.75rem 0 1.25rem 1.5rem; }
.message.ai .bubble li { margin-bottom: 0.5rem; }
.message.ai .bubble strong { color: var(--user-text); font-weight: 700; }
.message.ai .bubble code { 
    background-color: #f1f5f9; 
    padding: 2px 6px; 
    border-radius: 4px; 
    font-family: 'Courier New', Courier, monospace; 
    font-size: 0.9em;
}
.message.ai .bubble pre {
    background-color: #1e293b;
    color: #f8fafc;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.25rem 0;
    line-height: 1.5;
}
.message.ai .bubble pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
}

/* Typing Indicator Content */
.typing-content {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 24px;
    padding: 0 4px;
}

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

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

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

/* Input Area */
.input-area {
    padding: 16px 20px;
    background-color: var(--container-bg);
    border-top: 1px solid var(--border-color);
    z-index: 20;
}

#chat-form {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background-color: var(--chat-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 8px;
    transition: var(--transition);
}

#chat-form:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
}

#message-input {
    width: 100%;
    border: none;
    background: transparent;
    resize: none;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--ai-text);
    max-height: 120px;
    outline: none;
}

#message-input::placeholder {
    color: var(--text-muted);
}

.send-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.send-btn:hover {
    background-color: var(--primary-hover);
}

.send-btn:disabled {
    background-color: var(--border-color);
    color: var(--text-muted);
    cursor: not-allowed;
}
