
        
        :root {
            --app-bg: #f8f9fe;
            --sidebar-bg: #ffffff;
            --sidebar-text: #5f6c7b;
            --sidebar-text-strong: #1e293b;
            --sidebar-item-hover-bg: #f1f5f9;
            --sidebar-section-title: #94a3b8;

            --header-bg: #ffffff;
            --header-border: #e2e8f0;
            --text-primary: #1e293b;
            --text-secondary: #475569;
            --text-tertiary: #64748b;
            
            --accent-primary: #6d28d9;
            --accent-primary-hover: #5b21b6;
            --accent-primary-light: #ede9fe;
            
            --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.07);

            --message-user-bg: var(--accent-primary);
            --message-user-text: #ffffff;
            --message-bot-bg: #e2e8f0;
            --message-bot-text: #1e293b;

            --code-block-bg: #1e293b;
            --code-block-text: #e2e8f0;
            --copy-code-btn-bg: #334155;
            --copy-code-btn-text: #cbd5e1;
            --copy-code-btn-hover-bg: #475569;

            --input-area-bg: #ffffff;
            --input-field-bg: #f8fafc;
            --input-field-border: #cbd5e1;
            --input-field-focus-border: var(--accent-primary);
            --icon-btn-color: #64748b;
            --icon-btn-hover-bg: #e2e8f0;
            
            --error-bg-light: #fef2f2;
            --error-border-strong: #dc2626;
            --error-text-strong: #b91c1c;

            --sidebar-backdrop-bg: rgba(0, 0, 0, 0.4);
            --font-family-main: 'Poppins', 'Segoe UI', sans-serif;
        }

        /* --- DARK MODE THEME --- */
        body.dark-theme {
            --app-bg: #111827;
            --sidebar-bg: #1f2937;
            --sidebar-text: #9ca3af;
            --sidebar-text-strong: #f9fafb;
            --sidebar-item-hover-bg: #374151;
            --sidebar-section-title: #6b7280;

            --header-bg: #1f2937;
            --header-border: #374151;
            --text-primary: #f3f4f6;
            --text-secondary: #d1d5db;
            --text-tertiary: #9ca3af;
            
            --accent-primary: #8b5cf6;
            --accent-primary-hover: #7c3aed;
            --accent-primary-light: #3730a3;

            --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);

            --message-user-bg: var(--accent-primary);
            --message-user-text: #ffffff;
            --message-bot-bg: #374151;
            --message-bot-text: #e5e7eb;

            --code-block-bg: #0f172a;
            --code-block-text: #e2e8f0;
            --copy-code-btn-bg: #1e293b;
            --copy-code-btn-text: #94a3b8;
            --copy-code-btn-hover-bg: #334155;
            
            --input-area-bg: #1f2937;
            --input-field-bg: #111827;
            --input-field-border: #4b5563;
            --icon-btn-color: #9ca3af;
            --icon-btn-hover-bg: #374151;
            
            --error-bg-light: #3f2222;
            --error-border-strong: #ef4444;
            --error-text-strong: #fca5a5;
        }

        *, *::before, *::after {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }
        
        ::-webkit-scrollbar { width: 6px; }
        ::-webkit-scrollbar-track { background: transparent; }
        ::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
        body.dark-theme ::-webkit-scrollbar-thumb { background: #4b5563; }
        ::-webkit-scrollbar-thumb:hover { background: #9ca3af; }
        body.dark-theme ::-webkit-scrollbar-thumb:hover { background: #6b7280; }

        body {
            font-family: var(--font-family-main);
            display: flex;
            height: 100vh;
            overflow: hidden;
            background-color: var(--app-bg);
            color: var(--text-primary);
            transition: background-color 0.3s, color 0.3s;
        }
        
        .app-container {
            display: flex;
            width: 100%;
            height: 100%;
            background-color: var(--app-bg);
            position: relative;
            overflow: hidden;
            transition: background-color 0.3s;
        }

        .sidebar {
            width: 280px;
            background-color: var(--sidebar-bg);
            color: var(--sidebar-text);
            padding: 24px;
            display: flex;
            flex-direction: column;
            height: 100%;
            border-right: 1px solid var(--header-border);
            transition: transform 0.3s ease-in-out, background-color 0.3s, color 0.3s, border-color 0.3s;
            z-index: 1000;
            flex-shrink: 0;
        }
        
        .sidebar-content {
            display: flex;
            flex-direction: column;
            height: 100%;
            overflow-y: hidden;
        }

        .sidebar-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 30px;
            flex-shrink: 0;
        }

        .sidebar-logo {
            font-size: 1.8em;
            font-weight: 600;
            color: var(--accent-primary);
        }

        .sidebar-close-btn {
            display: none;
            background: none;
            border: none;
            color: var(--sidebar-text);
            font-size: 1.5em;
            cursor: pointer;
            padding: 5px;
        }

        .begin-new-chat {
            background-color: var(--accent-primary);
            color: var(--message-user-text);
            border: none;
            border-radius: 12px;
            padding: 12px 18px;
            text-align: left;
            font-size: 1em;
            font-weight: 500;
            cursor: pointer;
            margin-bottom: 30px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            transition: background-color 0.2s, transform 0.2s;
            flex-shrink: 0;
        }
        .begin-new-chat:hover {
            background-color: var(--accent-primary-hover);
            transform: translateY(-2px);
        }
        
        .sidebar-section-title {
            font-size: 0.75em;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--sidebar-section-title);
            margin-bottom: 12px;
            padding-left: 12px;
            flex-shrink: 0;
        }

        .sidebar-list {
            list-style: none;
            margin-bottom: 25px;
            flex-grow: 1;
            overflow-y: auto;
            padding-right: 8px;
        }
        .sidebar-list li {
            display: flex;
            align-items: center;
            padding: 12px;
            border-radius: 10px;
            cursor: pointer;
            margin-bottom: 8px;
            transition: background-color 0.2s, color 0.2s;
            overflow: hidden;
            position: relative;
        }
        .sidebar-list li:hover {
            background-color: var(--sidebar-item-hover-bg);
            color: var(--sidebar-text-strong);
        }
        .sidebar-list li:hover .delete-chat-btn {
            opacity: 1;
        }
        .sidebar-list li i.fa-comment-dots {
            margin-right: 14px;
            width: 20px;
            text-align: center;
            color: var(--sidebar-text);
            transition: color 0.2s;
        }
        .sidebar-list li:hover i.fa-comment-dots, .sidebar-list li.active-chat-history i.fa-comment-dots {
            color: var(--accent-primary);
        }
        .sidebar-list li .item-text {
            flex-grow: 1;
            font-size: 0.9em;
            font-weight: 500;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            padding-right: 30px;
        }
        .sidebar-list li .delete-chat-btn {
            position: absolute;
            right: 8px;
            top: 50%;
            transform: translateY(-50%);
            padding: 6px;
            border-radius: 50%;
            color: var(--sidebar-text);
            background: none;
            border: none;
            cursor: pointer;
            opacity: 0;
            transition: opacity 0.2s, color 0.2s, background-color 0.2s;
        }
        .sidebar-list li .delete-chat-btn:hover {
            color: #ef4444;
            background-color: #fee2e2;
        }
        body.dark-theme .sidebar-list li .delete-chat-btn:hover {
            background-color: #3f2222;
        }
        .sidebar-list li.active-chat-history {
            background-color: var(--accent-primary-light);
            color: var(--sidebar-text-strong);
            font-weight: 600;
        }
        body.dark-theme .sidebar-list li.active-chat-history {
            background-color: var(--sidebar-item-hover-bg);
        }
        
        .sidebar-footer {
            margin-top: auto;
            padding: 15px;
            border-radius: 12px;
            font-size: 0.9em;
            transition: background-color 0.3s;
            flex-shrink: 0;
        }
         .sidebar-footer a {
            text-decoration: none;
            color: var(--sidebar-text-strong) !important;
            display: flex;
            align-items: center;
            font-weight: 500;
            transition: color 0.2s;
        }
         .sidebar-footer a:hover {
            color: var(--accent-primary) !important;
         }
        .sidebar-footer .user-info i {
            margin-right: 10px;
            font-size: 1.2em;
        }
        
        .chat-area {
            flex-grow: 1;
            display: flex;
            flex-direction: column;
            height: 100%;
            background-color: var(--app-bg);
            min-width: 0;
            transition: background-color 0.3s;
        }

        .main-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 18px 30px;
            border-bottom: 1px solid var(--header-border);
            background-color: var(--header-bg);
            flex-shrink: 0;
            transition: background-color 0.3s, border-color 0.3s;
            box-shadow: var(--card-shadow);
            z-index: 10;
        }
        .main-logo-text {
            font-size: 1.6em;
            font-weight: 700;
            color: var(--text-primary);
        }
        .main-logo-text span {
            color: var(--accent-primary);
        }
        .main-menu-icon {
            font-size: 1.4em;
            cursor: pointer;
            color: var(--text-secondary);
            padding: 8px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: color 0.2s, background-color 0.2s;
            background: none;
            border: none;
        }
        .main-menu-icon:hover {
            color: var(--text-primary);
            background-color: var(--sidebar-item-hover-bg);
        }
        
        .header-actions {
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        #hamburger-menu {
            display: none; /* Will be shown via media query */
        }
        
        .usage-info {
            font-size: 0.9em;
            color: var(--text-secondary);
            background-color: var(--chat-input-bg);
            padding: 5px 12px;
            border-radius: 20px;
            font-weight: 500;
            transition: color 0.3s ease, background-color 0.3s ease;
        }

        .dark-theme .usage-info {
            background-color: var(--sidebar-bg);
        }

        .usage-info.unlocked {
            color: #28a745;
            font-weight: 600;
        }

        .welcome-or-chat-content {
            flex-grow: 1;
            overflow-y: auto;
            padding: 20px 0;
            display: flex;
            flex-direction: column;
            /* --- PERBAIKAN KUNCI DI SINI --- */
            min-height: 0; /* Mencegah elemen ini mendorong input area keluar dari layar */
        }

        .welcome-screen {
            text-align: center;
            margin: auto;
            max-width: 650px;
            padding: 0 20px;
        }
        .welcome-logo {
            font-size: 4.5em;
            font-weight: 700;
            color: var(--accent-primary);
            margin-bottom: 10px;
            line-height: 1;
        }
        .welcome-screen h1 {
            font-size: 2.5em;
            font-weight: 600;
            color: var(--text-primary);
            margin-bottom: 15px;
        }
        .welcome-screen .welcome-subtitle {
            font-size: 1.05em;
            color: var(--text-secondary);
            margin-bottom: 30px;
            line-height: 1.7;
            max-width: 550px;
            margin-left: auto;
            margin-right: auto;
        }
        
        .chat-window-container {
            flex-grow: 1;
            overflow-y: auto;
            display: none;
        }
        .chat-window-container.active {
            display: flex;
            flex-direction: column;
        }
        .chat-window {
            flex-grow: 1;
            padding: 0 30px;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 12px;
        }
        @keyframes message-in {
            from { opacity: 0; transform: translateY(15px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .message {
            padding: 12px 20px;
            border-radius: 24px;
            max-width: 75%;
            word-wrap: break-word;
            line-height: 1.6;
            font-size: 0.95em;
            position: relative;
            animation: message-in 0.3s ease-out;
            transition: background-color 0.3s, color 0.3s;
        }
        .user-message {
            background-color: var(--message-user-bg);
            color: var(--message-user-text);
            align-self: flex-end;
            border-bottom-right-radius: 6px;
        }
        .user-message img, .bot-message img {
            max-width: 100%;
            max-height: 300px;
            border-radius: 12px;
            margin-top: 10px;
            display: block;
        }
        .bot-message {
            background-color: var(--message-bot-bg);
            color: var(--message-bot-text);
            align-self: flex-start;
            border-bottom-left-radius: 6px;
        }
        .bot-message.typing p { font-style: italic; color: var(--text-secondary); }
        .bot-message.error p { color: var(--error-text-strong); font-weight: 500; }
        .bot-message.data-message.error {
            background-color: var(--error-bg-light);
            border-left: 4px solid var(--error-border-strong);
            color: var(--error-text-strong);
        }
        .copy-message-btn {
            position: absolute;
            bottom: -10px;
            font-size: 0.8em;
            background-color: #fff;
            border: 1px solid #e2e8f0;
            box-shadow: var(--card-shadow);
            border-radius: 50%;
            width: 28px;
            height: 28px;
            cursor: pointer;
            opacity: 0;
            visibility: hidden;
            transition: opacity 0.2s, visibility 0.2s, transform 0.2s, background-color 0.2s, color 0.2s;
            color: var(--text-tertiary);
            z-index: 1;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        body.dark-theme .copy-message-btn {
            background-color: #374151;
            border-color: #4b5563;
        }
        .message:hover .copy-message-btn { opacity: 1; visibility: visible; transform: translateY(-10px); }
        .user-message .copy-message-btn { right: 15px; }
        .bot-message .copy-message-btn { left: 15px; }
        .copy-message-btn:hover { background-color: var(--accent-primary-light); color: var(--accent-primary); }
        
        .code-block-wrapper {
            position: relative;
            background-color: var(--code-block-bg);
            color: var(--code-block-text);
            border-radius: 12px;
            margin: 12px 0;
            overflow: hidden;
            transition: background-color 0.3s, color 0.3s;
        }
        .code-block-wrapper pre {
            padding: 20px;
            padding-top: 50px;
            margin: 0;
            overflow-x: auto;
            font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
            font-size: 0.9em;
            line-height: 1.6;
            white-space: pre-wrap;
            word-wrap: break-word;
        }
        .copy-code-btn {
            position: absolute;
            top: 10px;
            right: 10px;
            background-color: var(--copy-code-btn-bg);
            color: var(--copy-code-btn-text);
            border: none;
            border-radius: 8px;
            padding: 6px 12px;
            font-size: 0.85em;
            font-weight: 500;
            cursor: pointer;
            transition: background-color 0.2s;
            display: flex;
            align-items: center;
            z-index: 1;
        }
        .copy-code-btn i { margin-right: 6px; }
        .copy-code-btn:hover { background-color: var(--copy-code-btn-hover-bg); }
        .copy-code-btn .fas.fa-check { color: #4ade80; }

        .chat-input-container {
            padding: 15px 30px;
            background-color: var(--app-bg);
            flex-shrink: 0;
            position: relative;
            transition: background-color 0.3s;
        }
        .main-chat-input-area {
            display: flex;
            align-items: flex-end;
            padding: 8px;
            border: 1px solid var(--header-border);
            background-color: var(--input-area-bg);
            border-radius: 16px;
            transition: background-color 0.3s, border-color 0.3s, box-shadow 0.2s;
        }
        .main-chat-input-area:focus-within {
            border-color: var(--input-field-focus-border);
            box-shadow: 0 0 0 3px var(--accent-primary-light);
        }
        body.dark-theme .main-chat-input-area:focus-within {
            box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.3);
        }
        .main-chat-input-area .icon-btn {
            background: none; border: none; font-size: 1.3em;
            color: var(--icon-btn-color); cursor: pointer; padding: 10px; border-radius: 50%;
            transition: background-color 0.2s, color 0.2s;
            flex-shrink: 0;
            margin: 4px;
        }
        .main-chat-input-area .icon-btn:hover { background-color: var(--icon-btn-hover-bg); color: var(--text-primary); }
        #message-input {
            flex-grow: 1;
            padding: 12px 10px;
            border: none;
            background: none;
            outline: none;
            font-size: 1em;
            color: var(--text-primary);
            max-height: 150px;
            resize: none;
            overflow-y: auto;
            font-family: inherit;
            line-height: 1.5;
        }
        #message-input::placeholder { color: var(--text-tertiary); }
        #send-button {
            background-color: var(--accent-primary); color: var(--message-user-text); border: none;
            border-radius: 12px; width: 48px; height: 48px;
            display: flex; justify-content: center; align-items: center;
            font-size: 1.3em; cursor: pointer; transition: background-color 0.2s, transform 0.2s;
            flex-shrink: 0;
        }
        #send-button:hover { background-color: var(--accent-primary-hover); transform: scale(1.05); }
        
        #file-preview-area {
            padding: 0 30px; 
            margin-bottom: 10px; 
            display: none; 
            width: 100%; 
            box-sizing: border-box;
        }
        .file-preview-container {
            background-color: var(--accent-primary-light);
            color: var(--text-primary);
            padding: 8px 12px;
            border-radius: 10px;
            display: flex;
            align-items: center;
            font-size: 0.9em;
            transition: background-color 0.3s, color 0.3s;
        }
        .file-preview-container img {
            height: 32px; width: 32px; margin-right: 10px; border-radius: 6px; object-fit: cover;
        }
        .file-preview-container span {
            flex-grow: 1;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            font-weight: 500;
        }
        .file-preview-container button {
            background: none; border: none; color: #ef4444;
            cursor: pointer; font-size: 1.4em; padding: 0 5px;
        }
        
        .welcome-screen.hidden { display: none !important; }
        .sidebar-backdrop {
            display: none;
            position: fixed;
            top: 0; left: 0; width: 100%; height: 100%;
            background-color: var(--sidebar-backdrop-bg);
            z-index: 999;
            cursor: pointer;
            transition: background-color 0.3s;
        }
        
        @media (max-width: 992px) {
            .sidebar {
                position: fixed;
                top: 0; left: 0;
                transform: translateX(-100%);
                height: 100vh;
                border-right: none;
                box-shadow: 10px 0 25px -10px rgba(0,0,0,0.1);
            }
            .app-container.sidebar-open .sidebar {
                transform: translateX(0);
            }
            .app-container.sidebar-open .sidebar-backdrop {
                display: block;
            }
            #hamburger-menu { display: flex; }
            .sidebar-close-btn { display: block; }
        }

        @media (max-width: 767px) {
            .main-header { padding: 15px 20px; }
            .welcome-or-chat-content { padding: 15px 0; }
            .chat-window { padding: 0 20px; }
            .chat-input-container { padding: 10px 15px; }

            .message { max-width: 85%; font-size: 0.9em; }
            #message-input { font-size: 0.95em; max-height: 120px; }
            .main-chat-input-area .icon-btn { font-size: 1.2em; padding: 8px; }
            #send-button { width: 44px; height: 44px; font-size: 1.2em; border-radius: 10px; }
            
            .welcome-screen h1 { font-size: 2em; }
            .welcome-screen .welcome-subtitle { font-size: 1em; }
            .welcome-logo { font-size: 4em; }
        }