        :root {
            --primary-color: #7c3aed;
            --secondary-color: #a855f7;
            --accent-color: #06d6a0;
            --neon-color: #00f5ff;
            --background: #f8fafc;
            --surface: #ffffff;
            --text-primary: #1e293b;
            --text-secondary: #64748b;
            --border-color: #e2e8f0;
            --code-bg: #f1f5f9;
            --code-border: #cbd5e1;
            --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
            --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
            --sidebar-width: 280px;
        }

        [data-theme="dark"] {
            --background: #0f0f23;
            --surface: #1e1e3f;
            --text-primary: #e2e8f0;
            --text-secondary: #94a3b8;
            --border-color: #374151;
            --code-bg: #1a1a2e;
            --code-border: #4a5568;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    overflow-x: hidden;  /* biar gak scroll horizontal */
    overflow-y: auto;    /* biar bisa scroll */
    transition: all 0.3s ease;
    min-height: 100vh;   /* biar gak kepotong di mobile */
}

        .app-container {
            display: flex;
            height: 100vh;
            position: relative;
            width: 100%;
        }

        .sidebar {
            width: var(--sidebar-width);
            background: var(--surface);
            border-right: 2px solid var(--primary-color);
            box-shadow: var(--shadow-lg);
            display: flex;
            flex-direction: column;
            transform: translateX(0);
            transition: transform 0.3s ease;
            z-index: 1000;
            height: 100vh;
            position: fixed;
            left: 0;
            top: 0;
        }

        .sidebar.hidden {
            transform: translateX(-100%);
        }

        .sidebar-header {
            padding: 1.5rem;
            border-bottom: 1px solid var(--border-color);
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            color: white;
        }

        .sidebar-header h2 {
            font-size: 1.5rem;
            font-weight: 700;
        }

        .close-sidebar {
            background: none;
            border: none;
            color: white;
            font-size: 1.2rem;
            cursor: pointer;
            padding: 0.5rem;
            border-radius: 50%;
            transition: background-color 0.3s ease;
            display: none;
        }

        .close-sidebar:hover {
            background-color: rgba(255, 255, 255, 0.2);
        }

        .new-chat-btn {
            margin: 1rem;
            padding: 0.75rem 1rem;
            background: linear-gradient(135deg, var(--accent-color), var(--neon-color));
            color: white;
            border: none;
            border-radius: 0.5rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: var(--shadow);
        }

        .new-chat-btn:hover {
            transform: translateY(-2px);
            box-shadow: var(--shadow-lg);
            filter: brightness(1.1);
        }

        .chat-history {
            flex: 1;
            padding: 1rem;
            overflow-y: auto;
        }

        .chat-history-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1rem;
        }

        .chat-history h3 {
            color: var(--text-secondary);
            font-size: 0.9rem;
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }

        .clear-history-btn {
            background: none;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            padding: 0.5rem;
            border-radius: 0.25rem;
            transition: all 0.3s ease;
            font-size: 0.8rem;
        }

        .clear-history-btn:hover {
            color: #ef4444;
            background: rgba(239, 68, 68, 0.1);
        }

        .history-item {
            padding: 0.75rem;
            margin-bottom: 0.5rem;
            background: var(--background);
            border-radius: 0.5rem;
            cursor: pointer;
            transition: all 0.3s ease;
            border-left: 3px solid transparent;
            position: relative;
        }

        .history-item:hover {
            background: var(--primary-color);
            color: white;
            border-left-color: var(--neon-color);
            transform: translateX(5px);
        }

        .history-item.active {
            background: var(--primary-color);
            color: white;
            border-left-color: var(--neon-color);
        }

        .history-item-content {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
        }

        .history-item-text {
            flex: 1;
            margin-right: 0.5rem;
        }

        .history-item-title {
            font-weight: 600;
            margin-bottom: 0.25rem;
            word-break: break-word;
        }

        .history-item-date {
            font-size: 0.8rem;
            color: var(--text-secondary);
        }

        .history-item:hover .history-item-date {
            color: rgba(255, 255, 255, 0.8);
        }

        .delete-history-btn {
            background: none;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            padding: 0.25rem;
            border-radius: 0.25rem;
            transition: all 0.3s ease;
            opacity: 0;
        }

        .history-item:hover .delete-history-btn {
            opacity: 1;
        }

        .delete-history-btn:hover {
            color: #ef4444;
            background: rgba(239, 68, 68, 0.1);
        }

        .main-content {
            flex: 1;
            display: flex;
            flex-direction: column;
            background: var(--background);
            margin-left: var(--sidebar-width);
            width: calc(100% - var(--sidebar-width));
            height: 100vh;
        }

        .top-nav {
            padding: 1rem 2rem;
            background: var(--surface);
            border-bottom: 1px solid var(--border-color);
            display: flex;
            align-items: center;
            justify-content: space-between;
            box-shadow: var(--shadow);
            flex-shrink: 0;
        }

        .menu-toggle {
            background: none;
            border: none;
            color: var(--text-primary);
            font-size: 1.2rem;
            cursor: pointer;
            padding: 0.5rem;
            border-radius: 0.25rem;
            transition: all 0.3s ease;
            display: none;
        }

        .menu-toggle:hover {
            background: var(--border-color);
            color: var(--primary-color);
        }

        .top-nav h1 {
            font-size: 1.5rem;
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .nav-actions {
            display: flex;
            gap: 0.5rem;
        }

        .theme-toggle {
            background: none;
            border: 2px solid var(--primary-color);
            color: var(--primary-color);
            padding: 0.5rem 1rem;
            border-radius: 0.5rem;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .theme-toggle:hover {
            background: var(--primary-color);
            color: white;
        }

        .chat-container {
            flex: 1;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            height: calc(100vh - 140px);
        }

        .chat-messages {
            flex: 1;
            padding: 2rem;
            overflow-y: auto;
            scroll-behavior: smooth;
            min-height: 0;
        }

        .welcome-message {
            display: flex;
            gap: 1rem;
            margin-bottom: 2rem;
            padding: 2rem;
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            border-radius: 1rem;
            color: white;
            box-shadow: var(--shadow-lg);
        }

        .bot-avatar {
            width: 50px;
            height: 50px;
            background: rgba(255, 255, 255, 0.2);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.5rem;
            flex-shrink: 0;
        }

        .message {
            display: flex;
            gap: 1rem;
            margin-bottom: 1.5rem;
            animation: fadeInUp 0.5s ease;
        }

        .message.user {
            flex-direction: row-reverse;
        }

        .message-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.2rem;
            flex-shrink: 0;
        }

        .message.user .message-avatar {
            background: linear-gradient(135deg, var(--accent-color), var(--neon-color));
            color: white;
        }

        .message.bot .message-avatar {
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            color: white;
        }

        .message-content {
            background: var(--surface);
            padding: 1rem 1.5rem;
            border-radius: 1rem;
            max-width: 70%;
            box-shadow: var(--shadow);
            border: 1px solid var(--border-color);
            color: var(--text-primary);
            line-height: 1.6;
            word-wrap: break-word;
            overflow-wrap: break-word;
        }

        .message.user .message-content {
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            color: white;
            border: none;
        }

        .message.bot .message-content {
            border-left: 3px solid var(--primary-color);
            background: var(--surface);
            color: var(--text-primary);
        }

        .file-attachment {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.5rem;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 0.5rem;
            margin-bottom: 0.5rem;
        }

        .file-attachment img {
            max-width: 200px;
            max-height: 200px;
            border-radius: 0.5rem;
        }

        .message-input-container {
            padding: 1.5rem 2rem;
            background: var(--surface);
            border-top: 1px solid var(--border-color);
            flex-shrink: 0;
        }

        .input-wrapper {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            background: var(--background);
            border: 2px solid var(--border-color);
            border-radius: 1rem;
            padding: 0.5rem;
            transition: all 0.3s ease;
            min-height: 60px;
        }

        .input-wrapper:focus-within {
            border-color: var(--primary-color);
            box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
        }

        .file-upload-btn {
            background: none;
            border: none;
            color: var(--text-secondary);
            font-size: 1.2rem;
            cursor: pointer;
            padding: 0.5rem;
            border-radius: 50%;
            transition: all 0.3s ease;
            flex-shrink: 0;
        }

        .file-upload-btn:hover {
            background: var(--primary-color);
            color: white;
        }

        #messageInput {
            flex: 1;
            border: none;
            outline: none;
            padding: 0.75rem;
            font-size: 1rem;
            background: transparent;
            color: var(--text-primary);
            font-weight: 500;
            min-width: 0;
            resize: none;
            font-family: inherit;
        }

        #messageInput::placeholder {
            color: var(--text-secondary);
            opacity: 0.8;
        }

        .send-btn {
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            border: none;
            color: white;
            padding: 0.75rem;
            border-radius: 50%;
            cursor: pointer;
            transition: all 0.3s ease;
            font-size: 1.1rem;
            flex-shrink: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 45px;
            height: 45px;
        }

        .send-btn:hover {
            transform: scale(1.1);
            box-shadow: var(--shadow-lg);
        }

        .send-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            transform: none;
        }

        .file-preview {
            margin-top: 1rem;
            padding: 1rem;
            background: var(--background);
            border-radius: 0.5rem;
            border: 2px dashed var(--border-color);
        }

        .file-info {
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .remove-file {
            background: none;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            padding: 0.25rem;
            border-radius: 50%;
            transition: all 0.3s ease;
        }

        .remove-file:hover {
            background: #ef4444;
            color: white;
        }

        .loading-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 9999;
        }

        .loading-spinner {
            text-align: center;
            color: white;
        }

        .loading-spinner i {
            font-size: 3rem;
            color: var(--neon-color);
            margin-bottom: 1rem;
        }

        .confirmation-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10000;
        }

        .modal-content {
            background: var(--surface);
            padding: 2rem;
            border-radius: 1rem;
            max-width: 400px;
            width: 90%;
            box-shadow: var(--shadow-lg);
            text-align: center;
        }

        .modal-title {
            font-size: 1.25rem;
            font-weight: 600;
            margin-bottom: 1rem;
            color: var(--text-primary);
        }

        .modal-message {
            color: var(--text-secondary);
            margin-bottom: 2rem;
            line-height: 1.5;
        }

        .modal-actions {
            display: flex;
            gap: 1rem;
            justify-content: center;
        }

        .modal-btn {
            padding: 0.75rem 1.5rem;
            border: none;
            border-radius: 0.5rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .modal-btn.cancel {
            background: var(--background);
            color: var(--text-primary);
            border: 1px solid var(--border-color);
        }

        .modal-btn.cancel:hover {
            background: var(--border-color);
        }

        .modal-btn.delete {
            background: #ef4444;
            color: white;
        }

        .modal-btn.delete:hover {
            background: #dc2626;
            transform: translateY(-2px);
        }

        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        @media (max-width: 768px) {
            .sidebar {
                transform: translateX(-100%);
                width: 100%;
                max-width: 300px;
            }

            .sidebar.show {
                transform: translateX(0);
            }

            .main-content {
                margin-left: 0;
                width: 100%;
            }

            .menu-toggle {
                display: block;
            }

            .close-sidebar {
                display: block;
            }

            .top-nav {
                padding: 1rem;
            }

            .chat-messages {
                padding: 1rem;
            }

            .message-input-container {
                padding: 1rem;
            }

            .message-content {
                max-width: 85%;
            }

            .history-item-content {
                flex-direction: column;
                gap: 0.5rem;
            }

            .delete-history-btn {
                opacity: 1;
                align-self: flex-end;
            }

            .input-wrapper {
                min-height: 50px;
            }

            .send-btn {
                width: 40px;
                height: 40px;
            }
        }

        ::-webkit-scrollbar {
            width: 8px;
        }

        ::-webkit-scrollbar-track {
            background: var(--background);
        }

        ::-webkit-scrollbar-thumb {
            background: var(--primary-color);
            border-radius: 4px;
        }

        ::-webkit-scrollbar-thumb:hover {
            background: var(--secondary-color);
        }

        .code-block-container {
            margin: 1rem 0;
            border-radius: 0.75rem;
            overflow: hidden;
            border: 1px solid var(--code-border);
            box-shadow: var(--shadow);
            background: var(--code-bg);
        }

        .code-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: var(--primary-color);
            padding: 0.5rem 1rem;
            border-bottom: 1px solid var(--code-border);
        }

        .code-language {
            color: white;
            font-size: 0.75rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }

        .copy-code-btn {
            background: rgba(255, 255, 255, 0.1);
            color: white;
            border: none;
            padding: 0.25rem 0.5rem;
            border-radius: 0.25rem;
            font-size: 0.75rem;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 0.25rem;
        }

        .copy-code-btn:hover {
            background: rgba(255, 255, 255, 0.2);
            transform: scale(1.05);
        }

        pre {
            background: var(--code-bg);
            padding: 1.5rem;
            margin: 0;
            overflow-x: auto;
            border: none;
            border-radius: 0;
            tab-size: 4;
        }

        pre code {
            background: transparent;
            padding: 0;
            border: none;
            border-radius: 0;
            font-family: 'Fira Code', 'Courier New', monospace;
            font-size: 0.9rem;
            line-height: 1.5;
            color: var(--text-primary);
            display: block;
            white-space: pre;
            tab-size: 4;
            -moz-tab-size: 4;
            -o-tab-size: 4;
            word-wrap: normal;
            word-break: normal;
            overflow-wrap: normal;
            text-indent: 0;
            letter-spacing: 0;
        }

        code {
            background: var(--code-bg);
            padding: 0.3rem 0.6rem;
            border-radius: 0.375rem;
            font-family: 'Fira Code', 'Courier New', monospace;
            font-size: 0.85rem;
            color: var(--primary-color);
            border: 1px solid var(--code-border);
            font-weight: 600;
        }

        .inline-code {
            background: var(--code-bg);
            padding: 0.2rem 0.4rem;
            border-radius: 0.25rem;
            font-family: 'Fira Code', 'Courier New', monospace;
            font-size: 0.9rem;
            color: var(--primary-color);
            border: 1px solid var(--code-border);
            font-weight: 600;
            white-space: nowrap;
        }

        [data-theme="dark"] .inline-code {
            background: var(--code-bg);
            color: var(--neon-color);
            border-color: var(--code-border);
        }

        [data-theme="dark"] code {
            background: var(--code-bg);
            color: var(--neon-color);
            border-color: var(--code-border);
        }

        [data-theme="dark"] pre code {
            color: var(--text-primary);
        }

        [data-theme="dark"] .code-header {
            background: var(--primary-color);
        }
        
        .api-selector {
            margin: 1rem;
            padding: 0.5rem;
            border-radius: 0.5rem;
            background: var(--background);
            border: 1px solid var(--border-color);
            color: var(--text-primary);
            font-size: 0.9rem;
            width: calc(100% - 2rem);
        }
        
        .error-message {
            background: #fef2f2;
            border: 1px solid #fecaca;
            color: #dc2626;
            padding: 1rem;
            border-radius: 0.5rem;
            margin: 1rem 0;
        }
        
        [data-theme="dark"] .error-message {
            background: #1f1f2e;
            border: 1px solid #7f1d1d;
            color: #fca5a5;
        }

        .empty-state {
            text-align: center;
            color: var(--text-secondary);
            padding: 2rem;
            font-style: italic;

        }
