* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: #d1deff;
    height: 100vh;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.main-container {
    width: 100vw; 
    height: 100vh; 
    max-width: none; 
    background: #d0e3ff;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    border: none;
    box-shadow: none;
}
.header h1 {
    color: #00ff00;
    font-size: 1.5rem;
    text-shadow: 0 0 10px #00ff00;
}
#chat-box {
flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    padding: 20px;
    scroll-behavior: smooth;
    height: calc(100vh - 180px);
}
#welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;   
    justify-content: center; 
    height: 100%;           
    text-align: center;
    gap: 20px;              
}
.logo-wrapper {
    width: auto;            
    height: auto;           
    margin: 0 auto;        
}
.center-logo {
    max-width: 320px;       
    width: 320px;
    height: auto;
    margin: 0 auto !important;   
}
#welcome-screen p {
    margin: 0 !important;   
    color: #00ff00;        
    font-size: 1.2rem;
    font-weight: 500;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
    letter-spacing: 1px;
}
.header p {
    color: #8b949e;
    font-size: 0.8rem;
}
#chat-box {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px 10%;
    overflow-y: auto;
}
.message {
    max-width: 75%;
    padding: 12px 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
    width: fit-content;
}
.user-msg {
    align-self: flex-end;
    background: #95c3ee;
    color: #000;
    padding: 10px 18px;
    border-radius: 1000px;
    font-weight: 500;
    max-width: 70%;
    width: fit-content;
    box-shadow: 0 4px 15px rgba(0, 255, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
/* Bubble yang isinya ada gambar/video/dokumen: radius wajar (bukan pill 1000px)
   supaya nggak jadi oval raksasa yang nyatu sama background halaman. */
.user-msg.has-media {
    border-radius: 22px;
    padding: 10px;
}
.ai-msg {
    align-self: flex-start;
    background: transparent;
    color: #000000;
    padding: 10px 0;
    max-width: 90%;
    line-height: 1.6;
    font-size: 1rem;
    border: none;
    box-shadow: none;
    word-wrap: break-word;
}
.ai-msg::before {
    content: "Whale Shark🦈";
    display: block;
    font-size: 0.75rem;
    color: #74b0ff;
    margin-bottom: 5px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.input-area {
    padding: 10px 20px 20px;
    display: flex;
    justify-content: center;
}

/* Kotak komposer tunggal ala Gemini: satu kartu putih yang membungkus
   preview lampiran, input teks, dan toolbar (upload, model picker, kirim). */
.composer {
    width: 100%;
    max-width: 820px;
    background: #ffffff;
    border-radius: 28px;
    border: 1px solid rgba(13, 25, 50, 0.06);
    box-shadow: 0 10px 30px rgba(13, 25, 50, 0.12);
    display: flex;
    flex-direction: column;
    padding: 8px 8px 6px;
    transition: box-shadow 0.2s ease;
}

.composer:focus-within {
    box-shadow: 0 12px 36px rgba(13, 25, 50, 0.16);
}

.composer-input {
    border: none;
    background: transparent;
    width: 100%;
    padding: 12px 16px 8px;
    font-size: 1rem;
    color: #1c2733;
}

.composer-input:focus {
    outline: none;
}

.composer-input::placeholder {
    color: #8a93a3;
}

.composer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 4px 4px;
}

.composer-toolbar-left,
.composer-toolbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.model-picker {
    position: relative;
    display: flex;
    align-items: center;
}
#model-button {
    border: none;
    background: transparent;
    color: #444b57;
    border-radius: 999px;
    padding: 8px 12px;
    min-width: auto;
    height: auto;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    box-shadow: none;
    transition: background 0.2s ease;
}
#model-button i {
    font-size: 0.7rem;
    color: #8a93a3;
}
#model-button:hover {
    background: rgba(13, 25, 50, 0.06);
    transform: none;
}
.model-menu {
    position: absolute;
    bottom: 52px;
    left: 0;
    width: 220px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.14);
    padding: 8px 0;
    display: none;
    z-index: 100;
}
.model-menu.visible {
    display: block;
}
.model-option {
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s ease;
    color: #111;
}
.model-option:hover,
.model-option.selected {
    background: rgba(0, 110, 255, 0.08);
    color: #0056d6;
}

.model-option.disabled {
    opacity: 0.45;
    pointer-events: none;
    color: #9aa0a6;
}
.model-subtitle {
    font-size: 0.8rem;
    color: #6b7380;
    margin-top: 2px;
}

#user-input:focus {
    outline: none;
}

#send-button {
    background: #4285f4;
    color: #ffffff;
    border: none;
    border-radius: 50%;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s ease;
    width: 40px;
    height: 40px;
    font-size: 1rem;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

#send-button:hover {
    background: #2f6fe0;
    transform: scale(1.05);
    box-shadow: 0 4px 14px rgba(66, 133, 244, 0.4);
}

#send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.loading-box {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.8);
    border-radius: 6px;
    box-shadow: inset 0 0 0 rgba(0, 255, 255, 0.35);
    animation: loadingBox 0.8s ease-in-out infinite;
}

@keyframes loadingBox {
    0% {
        transform: scale(0.85);
        background-color: transparent;
        box-shadow: inset 0 0 0 rgba(0, 255, 255, 0.35);
    }
    50% {
        transform: scale(1);
        background-color: rgba(255,255,255,0.15);
        box-shadow: inset 0 0 8px rgba(0, 255, 255, 0.45);
    }
    100% {
        transform: scale(0.85);
        background-color: transparent;
        box-shadow: inset 0 0 0 rgba(0, 255, 255, 0.35);
    }
}
#upload-btn {
    background: transparent;
    border: none;
    border-radius: 50%;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    color: #444b57;
    width: 40px;
    height: 40px;
    font-size: 1rem;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

#upload-btn .material-symbols-outlined {
    color: inherit;
    padding: 0;
}

#upload-btn:hover {
    background: rgba(13, 25, 50, 0.06);
    outline: none;
}

/* Baris chip preview lampiran (gambar/dokumen), nempel di atas input teks,
   di dalam kartu komposer. Netral & terang biar nyatu sama tema, bukan
   kotak gelap hijau hacker yang lama. */
.attachment-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 8px 10px 0;
}
.attachment-previews:empty {
    padding: 0;
}

.preview-chip {
    position: relative;
    align-items: center;
    gap: 10px;
    background: #f1f5fb;
    border: 1px solid rgba(13, 25, 50, 0.08);
    border-radius: 14px;
    padding: 6px;
    animation: previewPop 0.18s ease;
}

@keyframes previewPop {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

.preview-thumb {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    overflow: hidden;
    background: #e2e8f5;
    flex-shrink: 0;
}
.preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.preview-chip-doc {
    padding: 8px 14px 8px 8px;
    max-width: 260px;
}
.preview-doc-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #e2e8f5;
    color: #4285f4;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}
.preview-doc-name {
    font-size: 0.82rem;
    color: #1c2733;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 170px;
}

.preview-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #444b57;
    color: #ffffff;
    border: 2px solid #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: background 0.2s ease;
}
.preview-remove:hover {
    background: #d93025;
}
.message img {
    max-width: 100%;
    width: 250px;
    border-radius: 10px;
    margin-bottom: 8px;
    display: block;
}

/* Wrapper gambar chat: bikin tombol download bisa diposisikan di atas gambar.
   Dikasih background+padding sendiri (kartu gelap) biar gambar punya area yang
   jelas kelihatan batasnya, nggak nyatu sama warna bubble/background chat. */
.chat-image-wrapper {
    position: relative;
    display: inline-block;
    background: #0d1117;
    padding: 6px;
    border-radius: 16px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.chat-image-wrapper img {
    cursor: zoom-in;
    border-radius: 12px;
    margin-bottom: 0;
}

.chat-video-wrapper {
    background: #0d1117;
    padding: 6px;
    border-radius: 16px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    display: inline-block;
}

.chat-video-wrapper video {
    width: 280px;
    max-width: 100%;
    border-radius: 12px;
    display: block;
    background: #000;
}

/* Chip nama file dokumen (PDF/Word/Excel/dll) yang diupload user di chat bubble */
.chat-document-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #0d1117;
    color: #00ff00;
    padding: 8px 14px;
    border-radius: 14px;
    font-size: 0.82rem;
    max-width: 240px;
}
.chat-document-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-image-download {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.chat-image-download:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.05);
}

.chat-image-download .material-symbols-outlined {
    padding: 0;
    margin: 0;
    font-size: 18px;
    color: #fff;
    line-height: 1;
}

/* Lightbox: preview gambar diperbesar */
#image-lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 5000;
    align-items: center;
    justify-content: center;
    padding: 30px;
}

#image-lightbox-overlay.visible {
    display: flex;
}

.lightbox-content {
    position: relative;
    max-width: min(90vw, 800px);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: block;
}

.lightbox-actions {
    display: flex;
    gap: 12px;
    margin-top: 18px;
}

.lightbox-btn {
    background: #ffffff;
    color: #0d1117;
    border: none;
    border-radius: 999px;
    padding: 10px 22px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Poppins', sans-serif;
}

.lightbox-btn:hover {
    transform: translateY(-1px);
}

.lightbox-btn.secondary {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.lightbox-close {
    position: absolute;
    top: -42px;
    right: 0;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
}

@media (max-width: 600px) {
    .lightbox-content {
        max-width: 92vw;
    }
    .lightbox-close {
        top: -38px;
        font-size: 26px;
    }
}

.material-symbols-outlined{
    padding-top: 10px;
    color: white;
}
.material-symbols-outlined{
    padding-bottom: 10px;
}
.login-btn {
    font-size: 40px;
}
@media (max-width: 600px) {
    body {
        align-items: stretch;
    }

    .main-container {
        width: 100vw;
        min-height: 100vh;
        padding-bottom: 100px;
    }

    #chat-box {
        padding: 100px 16px 120px;
        min-height: calc(100vh - 120px);
        height: auto;
    }

    .logo-wrapper {
        width: auto;
        height: auto;
        margin: 0 auto;
    }

    .center-logo {
        width: 220px;
        max-width: 100%;
        height: auto;
    }

    .input-area {
        padding: 10px 12px 16px;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 60;
        background: transparent;
    }

    .composer {
        max-width: 100%;
        box-shadow: 0 -4px 24px rgba(13, 25, 50, 0.14);
    }

    .composer-input {
        font-size: 15px;
        padding: 10px 14px 6px;
    }

    #send-button {
        width: 38px;
        height: 38px;
        font-size: 0.95rem;
    }

    #upload-btn {
        width: 38px;
        height: 38px;
    }

    .message {
        max-width: 90%;
        font-size: 0.95rem;
    }
}
/* Sidebar Style */
#sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100%;
    background: #b1d0ff;
    border-right: 1px solid #00ff00;
    z-index: 1000;
    transition: transform 0.3s ease;
    padding: 15px;
    display: flex;
    flex-direction: column;
}

.sidebar-hidden {
    transform: translateX(-100%);
}

.sidebar-visible {
    transform: translateX(0);
}

#overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.btn-new-chat {
    margin-top:50px;
    background: #1a1a1a;
    color: #002fff;
    border: 1px solid #002fff;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    width: 100%;
    text-align: left;
    border-right: 3px solid #002fff;
    animation: rgb-border 5s linear infinite;
}

.btn-new-chat:hover {
    background: #002fff;
    color: #000;
}
#menu-toggle {
    position: absolute;
    top: 15px;
    left: 15px;
    font-size: 24px;
    color: #000000;
    cursor: pointer;
    z-index: 1100;
    transition: 0.3s;
}
.history-item {
    padding: 10px;
    margin: 5px 0;
    cursor: pointer;
    border-radius: 8px;
    transition: 0.3s;
    color: #8b949e;
}
.history-item:hover {
    background: rgba(0, 255, 0, 0.1);
    color: #00ff00;
}
.history-section {
    margin-top: 20px;
    padding: 0 10px;
}

.history-label {
    font-size: 12px;
    color: #8b949e;
    margin-bottom: 10px;
    font-weight: bold;
}

.history-item {
    display: flex;
    align-items: center;
    padding: 10px;
    margin-bottom: 5px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item:hover {
    background: rgba(0, 255, 0, 0.1);
    color: #00ff00;
}

.history-item i {
    margin-right: 10px;
    font-size: 16px;
}
.msg-content {
    white-space: pre-wrap !important;
    word-wrap: break-word;
    line-height: 1.8;
    padding: 5px 0;
}

/* Inline code: `seperti ini` di tengah kalimat */
.inline-code {
    background: rgba(0, 0, 0, 0.08);
    padding: 2px 6px;
    border-radius: 6px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85em;
}

/* Kotak blok kode bergaya seperti code editor (header + body) */
.code-block-wrapper {
    background: #0d1117;
    border-radius: 12px;
    overflow: hidden;
    margin: 10px 0;
    max-width: 100%;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #161b22;
    color: #c9d1d9;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
}

.code-block-lang {
    text-transform: capitalize;
    opacity: 0.85;
}

.code-block-actions {
    display: flex;
    gap: 4px;
}

.code-block-btn {
    background: transparent;
    border: none;
    color: #c9d1d9;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.code-block-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.code-block-btn .material-symbols-outlined {
    font-size: 18px;
    padding: 0;
    margin: 0;
    color: #c9d1d9;
}

.code-block-wrapper pre {
    margin: 0;
    padding: 16px;
    overflow-x: auto;
}

.code-block-wrapper pre code.hljs {
    background: transparent !important;
    padding: 0 !important;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    white-space: pre;
}

#welcome-screen img {
    max-width: 100px;
    height: auto;
    margin-left: 50px;
}
@keyframes rgb-border {
    0% { border-color: #ff0000; box-shadow: 0 0 10px #ff0000; }
    33% { border-color: #00ff00; box-shadow: 0 0 10px #00ff00; }
    66% { border-color: #0000ff; box-shadow: 0 0 10px #0000ff; }
    100% { border-color: #ff0000; box-shadow: 0 0 10px #ff0000; }
}

/* Typing / loading three dots bounce */
.ai-msg.typing { 
    padding: 8px 12px;
    max-width: 60%;
    background: transparent;
    color: #000;
}
.typing-indicator{
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.typing-indicator .dot{
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #000000;
    opacity: 0.45;
    transform: translateY(0);
    animation: bounceDots 1s infinite ease-in-out;
}
.typing-indicator .dot:nth-child(2){
    animation-delay: 0.12s;
}
.typing-indicator .dot:nth-child(3){
    animation-delay: 0.24s;
}
@keyframes bounceDots{
    0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
    40% { transform: translateY(-8px); opacity: 1; }
}
/* Label teks di indikator loading (riset & nyusun jawaban) */
.typing-label {
    margin-left: 10px;
    font-size: 0.8rem;
    color: #555;
    font-style: italic;
}

/* Daftar sumber hasil riset web (Tavily), ditaruh di bawah jawaban AI */
.ai-sources {
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px dashed rgba(0, 0, 0, 0.35);
}
.ai-sources-label {
    font-size: 0.72rem;
    color: #000000;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.ai-sources-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.ai-source-chip {
    display: inline-block;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.72rem;
    color: #000000;
    background: #e6f0ff;
    border: 1px solid #000000;
    border-radius: 1000px;
    padding: 4px 10px;
    text-decoration: none;
    transition: all 0.2s ease;
}
.ai-source-chip:hover {
    background: #89deff;
    color: #000;
}