   /* --- CSS Variables for Theming --- */
        :root {
            --bg-color: #f0f2f5;
            --sidebar-bg: #ffffff;
            --sidebar-text-color: #333;
            --sidebar-hover-bg: #e4e6eb;
            --main-bg: #ffffff;
            --text-color: #050505;
            --border-color: #ddd;
            --input-bg: #f0f2f5;
            --bot-message-bg: #e9e9eb;
            --user-message-bg: #007bff;
            --user-message-text: #ffffff;
            --accent-color: #007bff;
            --shadow-color: rgba(0, 0, 0, 0.1);
            --code-bg: #2d2d2d;
            --code-text: #f8f8f2;
            --code-header-bg: #3a3a3a;
            --code-space-bg: #1e1e1e;
            --code-space-border: #444;
        }

        [data-theme="dark"] {
            --bg-color: #18191a;
            --sidebar-bg: #242526;
            --sidebar-text-color: #e4e6eb;
            --sidebar-hover-bg: #3a3b3c;
            --main-bg: #3a3b3c;
            --text-color: #e4e6eb;
            --border-color: #3a3b3c;
            --input-bg: #3a3b3c;
            --bot-message-bg: #3e4042;
            --user-message-bg: #007bff;
            --user-message-text: #ffffff;
            --accent-color: #007bff;
            --shadow-color: rgba(0, 0, 0, 0.3);
            --code-bg: #1e1e1e;
            --code-text: #f8f8f2;
            --code-header-bg: #2d2d2d;
            --code-space-bg: #0d1117;
            --code-space-border: #30363d;
        }
        
        [data-theme="blue"] {
            --bg-color: #e6f2ff;
            --sidebar-bg: #cce7ff;
            --sidebar-text-color: #003d7a;
            --sidebar-hover-bg: #99d1ff;
            --main-bg: #b3d9ff;
            --text-color: #001f3f;
            --border-color: #99d1ff;
            --input-bg: #e6f2ff;
            --bot-message-bg: #f0f8ff;
            --user-message-bg: #0056b3;
            --user-message-text: #ffffff;
            --accent-color: #0056b3;
            --code-bg: #003366;
            --code-text: #e6f2ff;
            --code-header-bg: #004080;
            --code-space-bg: #002244;
            --code-space-border: #0055aa;
        }

        [data-theme="purple"] {
            --bg-color: #f3e5f5;
            --sidebar-bg: #e1bee7;
            --sidebar-text-color: #4a148c;
            --sidebar-hover-bg: #ce93d8;
            --main-bg: #e1bee7;
            --text-color: #4a148c;
            --border-color: #ce93d8;
            --input-bg: #f3e5f5;
            --bot-message-bg: #f8bbd0;
            --user-message-bg: #7b1fa2;
            --user-message-text: #ffffff;
            --accent-color: #7b1fa2;
            --code-bg: #4a148c;
            --code-text: #f3e5f5;
            --code-header-bg: #6a1b9a;
            --code-space-bg: #3a0b5c;
            --code-space-border: #7b1fa2;
        }
        
        [data-theme="green"] {
            --bg-color: #e8f5e9;
            --sidebar-bg: #c8e6c9;
            --sidebar-text-color: #1b5e20;
            --sidebar-hover-bg: #a5d6a7;
            --main-bg: #c8e6c9;
            --text-color: #1b5e20;
            --border-color: #a5d6a7;
            --input-bg: #e8f5e9;
            --bot-message-bg: #dcedc8;
            --user-message-bg: #388e3c;
            --user-message-text: #ffffff;
            --accent-color: #388e3c;
            --code-bg: #1b5e20;
            --code-text: #e8f5e9;
            --code-header-bg: #2e7d32;
            --code-space-bg: #0d3d10;
            --code-space-border: #388e3c;
        }
        
        [data-theme="red"] {
            --bg-color: #ffebee;
            --sidebar-bg: #ffcdd2;
            --sidebar-text-color: #b71c1c;
            --sidebar-hover-bg: #ef9a9a;
            --main-bg: #ffcdd2;
            --text-color: #b71c1c;
            --border-color: #ef9a9a;
            --input-bg: #ffebee;
            --bot-message-bg: #ffcdd2;
            --user-message-bg: #d32f2f;
            --user-message-text: #ffffff;
            --accent-color: #d32f2f;
            --code-bg: #b71c1c;
            --code-text: #ffebee;
            --code-header-bg: #c62828;
            --code-space-bg: #8b0000;
            --code-space-border: #d32f2f;
        }
        
        [data-theme="teal"] {
            --bg-color: #e0f2f1;
            --sidebar-bg: #b2dfdb;
            --sidebar-text-color: #004d40;
            --sidebar-hover-bg: #80cbc4;
            --main-bg: #b2dfdb;
            --text-color: #004d40;
            --border-color: #80cbc4;
            --input-bg: #e0f2f1;
            --bot-message-bg: #b2dfdb;
            --user-message-bg: #00796b;
            --user-message-text: #ffffff;
            --accent-color: #00796b;
            --code-bg: #004d40;
            --code-text: #e0f2f1;
            --code-header-bg: #00695c;
            --code-space-bg: #00251a;
            --code-space-border: #00796b;
        }
        
        [data-theme="orange"] {
            --bg-color: #fff3e0;
            --sidebar-bg: #ffe0b2;
            --sidebar-text-color: #e65100;
            --sidebar-hover-bg: #ffcc80;
            --main-bg: #ffe0b2;
            --text-color: #e65100;
            --border-color: #ffcc80;
            --input-bg: #fff3e0;
            --bot-message-bg: #ffe0b2;
            --user-message-bg: #ef6c00;
            --user-message-text: #ffffff;
            --accent-color: #ef6c00;
            --code-bg: #e65100;
            --code-text: #fff3e0;
            --code-header-bg: #f57c00;
            --code-space-bg: #bf360c;
            --code-space-border: #ef6c00;
        }
        
        [data-theme="pink"] {
            --bg-color: #fce4ec;
            --sidebar-bg: #f8bbd0;
            --sidebar-text-color: #880e4f;
            --sidebar-hover-bg: #f48fb1;
            --main-bg: #f8bbd0;
            --text-color: #880e4f;
            --border-color: #f48fb1;
            --input-bg: #fce4ec;
            --bot-message-bg: #f8bbd0;
            --user-message-bg: #c2185b;
            --user-message-text: #ffffff;
            --accent-color: #c2185b;
            --code-bg: #880e4f;
            --code-text: #fce4ec;
            --code-header-bg: #ad1457;
            --code-space-bg: #560027;
            --code-space-border: #c2185b;
        }
        
        [data-theme="indigo"] {
            --bg-color: #e8eaf6;
            --sidebar-bg: #c5cae9;
            --sidebar-text-color: #1a237e;
            --sidebar-hover-bg: #9fa8da;
            --main-bg: #c5cae9;
            --text-color: #1a237e;
            --border-color: #9fa8da;
            --input-bg: #e8eaf6;
            --bot-message-bg: #c5cae9;
            --user-message-bg: #303f9f;
            --user-message-text: #ffffff;
            --accent-color: #303f9f;
            --code-bg: #1a237e;
            --code-text: #e8eaf6;
            --code-header-bg: #283593;
            --code-space-bg: #0d1742;
            --code-space-border: #303f9f;
        }

        /* --- General Styling --- */
        body, html {
            margin: 0;
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
            background-color: var(--bg-color);
            color: var(--text-color);
            display: flex;
            height: 100vh;
            overflow: hidden;
            width: 100%;
        }
        
        .svg-icon {
            width: 20px;
            height: 20px;
            fill: currentColor;
            vertical-align: middle;
        }

        /* --- User Profile --- */
        .user-profile {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 10px 15px;
            border-radius: 8px;
            cursor: pointer;
            transition: background-color 0.2s;
            margin-bottom: 15px;
        }
        
        .user-profile:hover {
            background-color: var(--sidebar-hover-bg);
        }
        
        .user-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background-color: var(--accent-color);
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
        }
        
        .user-info {
            flex: 1;
        }
        
        .user-name {
            font-weight: 600;
            color: var(--sidebar-text-color);
        }
        
        .user-email {
            font-size: 0.85em;
            color: var(--sidebar-text-color);
            opacity: 0.7;
        }
        
        .sign-out-btn {
            background: none;
            border: none;
            color: var(--sidebar-text-color);
            cursor: pointer;
            padding: 5px;
            border-radius: 4px;
            transition: background-color 0.2s;
        }
        
        .sign-out-btn:hover {
            background-color: var(--sidebar-hover-bg);
        }

        /* --- Login Button --- */
        .login-btn {
            padding: 12px 18px;
            border: none;
            border-radius: 8px;
            background-color: var(--accent-color);
            color: white;
            cursor: pointer;
            font-size: 16px;
            font-weight: 600;
            margin-bottom: 15px;
            transition: background-color 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            width: 100%;
            box-sizing: border-box;
        }

        .login-btn:hover {
            background-color: #0056b3;
            transform: scale(1.02);
        }

        /* --- Responsive Sidebar --- */
        .sidebar {
            width: 50%;
            max-width: 50%;
            background-color: var(--sidebar-bg);
            padding: 20px;
            display: flex;
            flex-direction: column;
            border-right: 1px solid var(--border-color);
            transition: transform 0.3s ease;
            position: fixed;
            top: 0;
            left: 0;
            height: 100%;
            z-index: 100;
            transform: translateX(-100%);
            box-shadow: 2px 0 5px var(--shadow-color);
            overflow-y: auto;
        }

        .sidebar.visible {
            transform: translateX(0);
        }

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

        .sidebar h2 {
            color: var(--sidebar-text-color);
            margin: 0;
            display: flex;
            align-items: center;
        }

        .sidebar button {
            padding: 12px 18px;
            border: none;
            border-radius: 8px;
            background-color: var(--input-bg);
            color: var(--text-color);
            cursor: pointer;
            font-size: 16px;
            margin-bottom: 15px;
            transition: background-color 0.2s;
            display: flex;
            align-items: center;
            justify-content: flex-start;
            gap: 12px;
            width: 100%;
            box-sizing: border-box;
        }

        .sidebar button:hover {
            background-color: var(--sidebar-hover-bg);
        }
        
        /* --- Install Prompt --- */
        .install-prompt {
            padding: 15px;
            background-color: var(--accent-color);
            color: white;
            border-radius: 8px;
            margin-bottom: 15px;
            display: none;
            box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
            animation: slideIn 0.3s ease-out;
        }
        
        .install-prompt.visible {
            display: block;
        }
        
        @keyframes slideIn {
            from {
                opacity: 0;
                transform: translateY(-10px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        .install-prompt-content {
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        
        .install-prompt button {
            background-color: white;
            color: var(--accent-color);
            padding: 8px 15px;
            border-radius: 5px;
            border: none;
            cursor: pointer;
            font-weight: bold;
            transition: all 0.2s;
        }
        
        .install-prompt button:hover {
            transform: scale(1.05);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        }
        
        .sidebar-tabs {
            display: flex;
            gap: 10px;
            margin-bottom: 15px;
            border-bottom: 1px solid var(--border-color);
        }

        .sidebar-tab {
            padding: 10px 15px;
            cursor: pointer;
            border-bottom: 2px solid transparent;
            color: var(--sidebar-text-color);
        }
        .sidebar-tab.active {
            color: var(--accent-color);
            border-bottom-color: var(--accent-color);
        }
        
        .sidebar-content {
            flex-grow: 1;
            overflow-y: auto;
            display: none;
        }
        .sidebar-content.active {
            display: block;
        }

        .folder {
            margin-bottom: 10px;
        }
        .folder-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 10px 15px;
            border-radius: 8px;
            cursor: pointer;
            transition: background-color 0.2s;
            position: relative;
            user-select: none;
            -webkit-user-select: none;
        }
        .folder-header:hover {
            background-color: var(--sidebar-hover-bg);
        }
        .folder-name {
            font-weight: bold;
        }
        .folder-chats {
            padding-left: 20px;
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.3s ease-out;
        }
        .folder.expanded .folder-chats {
            max-height: 500px;
            transition: max-height 0.5s ease-in;
        }
        
        .chat-history-item {
            padding: 10px 15px;
            border-radius: 8px;
            cursor: pointer;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            color: var(--sidebar-text-color);
            transition: background-color 0.2s;
            margin-bottom: 5px;
            position: relative;
            user-select: none;
            -webkit-user-select: none;
        }
        .chat-history-item:hover {
            background-color: var(--sidebar-hover-bg);
        }
        .chat-history-item.active {
            background-color: var(--accent-color);
            color: white;
        }

        /* --- Long Press Styles --- */
        .chat-history-item.long-press, .folder-header.long-press {
            background-color: rgba(255, 0, 0, 0.1);
            animation: pulse 0.5s ease-in-out;
        }

        @keyframes pulse {
            0% { transform: scale(1); }
            50% { transform: scale(0.98); }
            100% { transform: scale(1); }
        }

        .delete-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 1001;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .delete-dialog {
            background-color: var(--sidebar-bg);
            padding: 25px;
            border-radius: 12px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            max-width: 350px;
            width: 90%;
            text-align: center;
        }

        .delete-dialog h3 {
            margin: 0 0 15px 0;
            color: var(--text-color);
        }

        .delete-dialog p {
            margin: 0 0 20px 0;
            color: var(--text-color);
            opacity: 0.8;
        }

        .delete-dialog-buttons {
            display: flex;
            gap: 10px;
            justify-content: center;
        }

        .delete-dialog button {
            padding: 10px 20px;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 600;
            transition: all 0.2s;
        }

        .delete-dialog .confirm-delete {
            background-color: #dc3545;
            color: white;
        }

        .delete-dialog .confirm-delete:hover {
            background-color: #c82333;
            transform: scale(1.05);
        }

        .delete-dialog .cancel-delete {
            background-color: var(--input-bg);
            color: var(--text-color);
        }

        .delete-dialog .cancel-delete:hover {
            background-color: var(--sidebar-hover-bg);
            transform: scale(1.05);
        }

        /* --- New Chat in Folder Modal --- */
        .new-chat-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 1001;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        
        .new-chat-dialog {
            background-color: var(--sidebar-bg);
            padding: 25px;
            border-radius: 12px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            max-width: 400px;
            width: 90%;
            text-align: center;
        }
        
        .new-chat-dialog h3 {
            margin: 0 0 20px 0;
            color: var(--text-color);
        }
        
        .new-chat-dialog p {
            margin: 0 0 20px 0;
            color: var(--text-color);
            opacity: 0.8;
        }
        
        .folder-select {
            width: 100%;
            padding: 10px;
            border: 1px solid var(--border-color);
            border-radius: 8px;
            background-color: var(--input-bg);
            color: var(--text-color);
            font-size: 16px;
            margin-bottom: 20px;
        }
        
        .new-chat-dialog-buttons {
            display: flex;
            gap: 10px;
            justify-content: center;
        }
        
        .new-chat-dialog button {
            padding: 10px 20px;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 600;
            transition: all 0.2s;
        }
        
        .new-chat-dialog .confirm-new-chat {
            background-color: var(--accent-color);
            color: white;
        }
        
        .new-chat-dialog .confirm-new-chat:hover {
            transform: scale(1.05);
        }
        
        .new-chat-dialog .cancel-new-chat {
            background-color: var(--input-bg);
            color: var(--text-color);
        }
        
        .new-chat-dialog .cancel-new-chat:hover {
            background-color: var(--sidebar-hover-bg);
            transform: scale(1.05);
        }

        #image-gallery {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
            gap: 10px;
            padding: 10px;
        }
        #image-gallery img {
            width: 100%;
            height: 100px;
            object-fit: cover;
            border-radius: 8px;
            cursor: pointer;
            transition: transform 0.2s;
        }
        #image-gallery img:hover {
            transform: scale(1.05);
        }

        .sidebar nav a {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px 18px;
            color: var(--sidebar-text-color);
            text-decoration: none;
            border-radius: 8px;
            transition: background-color 0.2s;
        }

        .sidebar nav a:hover {
            background-color: var(--sidebar-hover-bg);
        }

        .sidebar hr {
            border: 0;
            border-top: 1px solid var(--border-color);
            margin: 20px 0;
        }

        /* --- Main Content Area --- */
        .main-wrapper {
            display: flex;
            flex: 1;
            overflow: hidden;
            width: 100%;
        }

        .main-content {
            flex: 1;
            display: flex;
            flex-direction: column;
            background-color: var(--main-bg);
            position: relative;
            width: 100%;
            height: 100vh;
        }
        
        .main-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 20px;
            border-bottom: 1px solid var(--border-color);
            background-color: var(--main-bg);
            gap: 15px;
            flex-wrap: wrap;
        }
        .main-header-left, .main-header-right {
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .main-header button {
            padding: 8px 12px;
            border: none;
            border-radius: 8px;
            background-color: var(--input-bg);
            color: var(--text-color);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background-color 0.2s;
        }
        .main-header button:hover {
            background-color: var(--sidebar-hover-bg);
        }

        #chat-messages {
            flex: 1;
            padding: 30px;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 20px;
            position: relative;
            width: 100%;
        }
        
        /* Welcome Screen */
        .welcome-screen {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            height: 100%;
            text-align: center;
            opacity: 1;
            transition: opacity 0.5s ease-in-out;
        }
        .welcome-screen.hidden {
            opacity: 0;
            pointer-events: none;
            position: absolute;
            width: 100%;
        }

        .robot-icon {
            width: 150px;
            height: 150px;
            margin-bottom: 20px;
            fill: #ccc;
        }

        .welcome-text {
            font-size: 1.5em;
            color: var(--text-color);
            font-weight: 300;
        }
        
        .message-pair {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .message {
            max-width: 80%;
            padding: 15px 20px;
            border-radius: 20px;
            line-height: 1.6;
            display: flex;
            flex-direction: column;
            position: relative;
        }
        
        .message-content {
            width: 100%;
        }

        .bot-message {
            background-color: var(--bot-message-bg);
            align-self: flex-start;
            border-bottom-left-radius: 5px;
        }

        .user-message {
            background-color: var(--user-message-bg);
            color: var(--user-message-text);
            align-self: flex-end;
            border-bottom-right-radius: 5px;
            cursor: pointer;
        }
        .user-message:hover::after {
            content: '⋮';
            position: absolute;
            top: 5px;
            right: 10px;
            color: var(--user-message-text);
        }

        .input-area {
            display: flex;
            padding: 20px 30px;
            border-top: 1px solid var(--border-color);
            align-items: center;
            gap: 15px;
            flex-wrap: wrap;
            width: 100%;
            box-sizing: border-box;
        }

        #user-input {
            flex: 1;
            padding: 15px 20px;
            border-radius: 25px;
            border: 1px solid var(--border-color);
            background-color: var(--input-bg);
            color: var(--text-color);
            font-size: 16px;
            resize: none;
            height: 22px;
            min-width: 200px;
            max-height: 120px;
            overflow-y: auto;
        }

        .input-area button {
            padding: 12px;
            border: none;
            border-radius: 50%;
            background-color: var(--accent-color);
            color: white;
            cursor: pointer;
            font-size: 20px;
            width: 50px;
            height: 50px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background-color 0.2s, transform 0.1s;
            flex-shrink: 0;
        }
        .input-area button:hover {
            transform: scale(1.05);
        }
        .input-area button:active {
            transform: scale(0.95);
        }
        
        /* --- Message Content Rendering --- */
        .message img, .message video, .message audio {
            max-width: 100%;
            border-radius: 10px;
            margin-top: 10px;
            position: relative;
        }
        
        .message video, .message audio {
            height: auto;
        }
        
        .media-container {
            position: relative;
            display: inline-block;
            max-width: 100%;
        }
        
        .media-download-btn {
            position: absolute;
            bottom: 10px;
            right: 10px;
            background-color: rgba(0, 0, 0, 0.6);
            color: white;
            border: none;
            border-radius: 50%;
            width: 36px;
            height: 36px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            opacity: 0;
            transition: opacity 0.2s;
        }
        
        .media-container:hover .media-download-btn {
            opacity: 1;
        }
        
        /* --- Enhanced Code Block --- */
        .code-block {
            margin: 15px 0;
            border-radius: 8px;
            overflow: hidden;
            border: 1px solid var(--code-space-border);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            background-color: var(--code-space-bg);
        }
        
        .code-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 15px;
            background-color: var(--code-header-bg);
            border-bottom: 1px solid var(--code-space-border);
        }
        
        .code-language {
            font-size: 14px;
            font-weight: 600;
            color: var(--code-text);
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .code-language-icon {
            width: 16px;
            height: 16px;
            border-radius: 3px;
        }
        
        .code-actions {
            display: flex;
            gap: 8px;
        }
        
        .code-action-btn {
            background: rgba(255, 255, 255, 0.1);
            border: none;
            color: var(--code-text);
            cursor: pointer;
            padding: 6px;
            border-radius: 4px;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .code-action-btn:hover {
            background: rgba(255, 255, 255, 0.2);
            transform: translateY(-1px);
        }
        
        .code-content {
            padding: 0;
            margin: 0;
            overflow: auto;
            max-height: 400px;
        }
        
        .code-content pre {
            margin: 0;
            padding: 15px;
            background-color: transparent;
            border-radius: 0;
            overflow: visible;
        }
        
        .code-content code {
            font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
            font-size: 14px;
            line-height: 1.5;
        }

        /* --- Search Results & Code Output Styles --- */
        .search-result-container {
            background-color: rgba(0,0,0,0.05);
            border-radius: 8px;
            padding: 10px;
            margin-top: 10px;
        }
        .search-item {
            padding: 8px;
            border-bottom: 1px solid rgba(0,0,0,0.1);
        }
        .search-item:last-child {
            border-bottom: none;
        }
        .search-title {
            font-weight: bold;
            display: block;
            margin-bottom: 4px;
        }
        .search-link {
            font-size: 0.85em;
            color: var(--accent-color);
            text-decoration: none;
        }
        .search-link:hover {
            text-decoration: underline;
        }
        .search-snippet {
            font-size: 0.9em;
            margin-top: 4px;
            display: block;
        }

        .code-execution-output {
            background-color: #000;
            color: #0f0;
            font-family: 'Consolas', monospace;
            padding: 10px;
            border-radius: 5px;
            margin-top: 10px;
            white-space: pre-wrap;
            font-size: 0.9em;
        }

        .code-execution-error {
            color: #ff5555;
        }
        
        /* --- File Upload --- */
        .file-upload-btn {
            position: relative;
            overflow: hidden;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }
        
        .file-upload-input {
            position: absolute;
            left: -9999px;
        }
        
        .uploaded-files {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            margin-top: 10px;
        }
        
        .uploaded-file {
            background-color: var(--input-bg);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            padding: 8px 12px;
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 14px;
        }
        
        .uploaded-file-name {
            max-width: 150px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        
        .remove-file-btn {
            background: none;
            border: none;
            color: var(--text-color);
            cursor: pointer;
            padding: 2px;
            border-radius: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .remove-file-btn:hover {
            background-color: rgba(255, 0, 0, 0.1);
        }
        
        /* --- Custom Voice Visualizer --- */
        .voice-visualizer-container {
            position: fixed;
            bottom: 100px;
            left: 50%;
            transform: translateX(-50%);
            background-color: var(--sidebar-bg);
            border: 1px solid var(--border-color);
            border-radius: 12px;
            padding: 15px;
            box-shadow: 0 4px 20px var(--shadow-color);
            z-index: 1000;
            display: none;
            flex-direction: column;
            align-items: center;
            gap: 10px;
        }
        
        .voice-visualizer-container.active {
            display: flex;
        }
        
        .visualizer-title {
            font-size: 14px;
            font-weight: 600;
            color: var(--text-color);
        }
        
        .voice-visualizer {
            display: flex;
            align-items: flex-end;
            height: 60px;
            gap: 3px;
        }
        
        .voice-bar {
            width: 4px;
            background: linear-gradient(to top, var(--accent-color), #4CAF50);
            border-radius: 2px;
            transition: height 0.1s ease;
        }
        
        .recording-timer {
            font-size: 16px;
            font-weight: 600;
            color: var(--accent-color);
        }
        
        .stop-recording-btn {
            background-color: #dc3545;
            color: white;
            border: none;
            border-radius: 50%;
            width: 50px;
            height: 50px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s;
        }
        
        .stop-recording-btn:hover {
            background-color: #c82333;
            transform: scale(1.05);
        }
        
        /* --- Code Preview Modal --- */
        .code-preview-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.8);
            z-index: 1000;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }
        
        .code-preview-header {
            width: 90%;
            max-width: 900px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 10px;
            color: white;
            padding: 0 10px;
        }
        
        .code-preview-title {
            font-size: 18px;
            font-weight: 600;
        }
        
        .code-preview-content {
            width: 90%;
            max-width: 900px;
            height: 70%;
            background-color: var(--code-space-bg);
            border-radius: 8px;
            overflow: hidden;
            border: 1px solid var(--code-space-border);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
        }
        
        .code-preview-iframe {
            width: 100%;
            height: 100%;
            border: none;
        }
        
        .code-preview-code {
            width: 100%;
            height: 100%;
            overflow: auto;
            padding: 15px;
            margin: 0;
            background-color: var(--code-space-bg);
            color: var(--code-text);
        }
        
        .close-preview-btn {
            background: rgba(255, 255, 255, 0.1);
            border: none;
            color: white;
            cursor: pointer;
            padding: 8px;
            border-radius: 4px;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .close-preview-btn:hover {
            background: rgba(255, 255, 255, 0.2);
        }

        /* --- Hamburger Menu Button --- */
        #hamburger-menu {
            z-index: 101;
            background: var(--sidebar-bg);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            padding: 10px;
            cursor: pointer;
            box-shadow: var(--shadow-color);
        }
        
        /* --- Action Sheet --- */
        #action-sheet {
            position: fixed;
            bottom: 0;
            left: 0;
            width: 100%;
            background-color: var(--sidebar-bg);
            border-top: 1px solid var(--border-color);
            transform: translateY(100%);
            transition: transform 0.3s ease-out;
            z-index: 1000;
            border-top-left-radius: 15px;
            border-top-right-radius: 15px;
        }

        #action-sheet.visible {
            transform: translateY(0);
        }

        .sheet-content {
            padding: 20px;
        }

        .sheet-content h3 {
            margin-top: 0;
            border-bottom: 1px solid var(--border-color);
            padding-bottom: 10px;
        }

        .sheet-content ul {
            list-style: none;
            padding: 0;
            margin: 0;
        }

        .sheet-content li {
            padding: 15px 0;
            border-bottom: 1px solid var(--border-color);
            cursor: pointer;
            transition: background-color 0.2s;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .sheet-content li:hover {
            background-color: var(--sidebar-hover-bg);
        }

        .overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 99;
            display: none;
        }

        .overlay.visible {
            display: block;
        }
        
        /* --- Context Menus --- */
        #context-menu, #chat-context-menu {
            position: absolute;
            background-color: var(--sidebar-bg);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            box-shadow: var(--shadow-color);
            padding: 5px 0;
            z-index: 1000;
            display: none;
        }
        #context-menu.visible, #chat-context-menu.visible {
            display: block;
        }
        #context-menu button, #chat-context-menu button {
            width: 100%;
            padding: 10px 20px;
            text-align: left;
            background: none;
            border: none;
            cursor: pointer;
            color: var(--text-color);
            display: flex;
            align-items: center;
            gap: 10px;
            transition: background-color 0.2s;
        }
        #context-menu button:hover, #chat-context-menu button:hover {
            background-color: var(--sidebar-hover-bg);
        }
        
        /* --- Edit Message Textarea --- */
        .edit-textarea {
            width: 100%;
            min-height: 50px;
            padding: 10px;
            border-radius: 8px;
            border: 1px solid var(--border-color);
            background-color: var(--input-bg);
            color: var(--text-color);
            font-family: inherit;
            font-size: inherit;
            margin-bottom: 10px;
            box-sizing: border-box;
        }
        .edit-actions {
            display: flex;
            gap: 10px;
            justify-content: flex-end;
        }
        
        /* --- Theme Selector --- */
        .theme-selector {
            display: flex;
            flex-direction: column;
            gap: 10px;
            margin-bottom: 15px;
        }
        
        .theme-selector-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 10px 15px;
            border-radius: 8px;
            cursor: pointer;
            transition: background-color 0.2s;
        }
        .theme-selector-header:hover {
            background-color: var(--sidebar-hover-bg);
        }
        
        .theme-options {
            max-height: 0;
            overflow-y: auto;
            overflow-x: hidden;
            transition: max-height 0.3s ease-out;
        }
        
        .theme-selector.expanded .theme-options {
            max-height: 300px;
            transition: max-height 0.5s ease-in;
        }
        
        .theme-option {
            display: flex;
            align-items: center;
            padding: 8px 15px;
            cursor: pointer;
            border-radius: 8px;
            transition: background-color 0.2s;
        }
        .theme-option:hover {
            background-color: var(--sidebar-hover-bg);
        }
        .theme-option.active {
            background-color: var(--accent-color);
            color: white;
        }
        
        .theme-preview {
            width: 20px;
            height: 20px;
            border-radius: 50%;
            margin-right: 10px;
            border: 1px solid var(--border-color);
        }
        
        /* --- Toast Notification --- */
        .toast {
            position: fixed;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            background-color: rgba(0, 0, 0, 0.8);
            color: white;
            padding: 10px 20px;
            border-radius: 4px;
            z-index: 1000;
            opacity: 0;
            transition: opacity 0.3s;
        }
        
        .toast.visible {
            opacity: 1;
        }
        
        /* --- Consent Banner --- */
        #consent-banner {
            position: fixed;
            bottom: 20px;
            left: 20px;
            right: 20px;
            background: #1e293b;
            color: #f1f5f9;
            padding: 14px;
            border-radius: 10px;
            z-index: 9999;
            font-size: 0.9rem;
            text-align: center;
            box-shadow: 0 6px 30px rgba(0,0,0,0.4);
            display: none;
            max-width: 500px;
            margin: 0 auto;
        }
        
        #consent-banner p {
            margin: 0 0 10px;
            line-height: 1.4;
        }
        
        #accept-consent {
            background: #38bdf8;
            color: #0f172a;
            border: none;
            padding: 8px 16px;
            border-radius: 6px;
            cursor: pointer;
            font-weight: 600;
            font-size: 0.95rem;
            transition: background-color 0.2s;
        }
        
        #accept-consent:hover {
            background: #0ea5e9;
        }
        
        /* --- Thinking Dots Animation --- */
        .thinking-dots {
            display: flex;
            gap: 4px;
            padding: 5px 0;
        }
        
        .thinking-dots span {
            width: 8px;
            height: 8px;
            background-color: var(--text-color);
            border-radius: 50%;
            display: inline-block;
            opacity: 0.4;
            animation: bounce 1.4s infinite ease-in-out both;
        }
        
        .thinking-dots span:nth-child(1) {
            animation-delay: -0.32s;
        }
        
        .thinking-dots span:nth-child(2) {
            animation-delay: -0.16s;
        }
        
        @keyframes bounce {
            0%, 80%, 100% {
                transform: scale(0);
                opacity: 0.5;
            }
            40% {
                transform: scale(1);
                opacity: 1;
            }
        }
        
        /* --- Pause Button --- */
        #pause-btn {
            background-color: #dc3545;
            display: none;
        }
        
        #pause-btn.visible {
            display: flex;
        }
        
        #send-btn.hidden {
            display: none;
        }
        
        /* --- Media Queries for Responsiveness --- */
        @media (max-width: 768px) {
            .sidebar {
                width: 80%;
                max-width: 80%;
            }
            .main-header {
                padding: 10px;
            }
            .input-area {
                padding: 15px;
            }
            #user-input {
                min-width: 0;
            }
            .message {
                max-width: 90%;
            }
            #consent-banner {
                left: 10px;
                right: 10px;
                bottom: 10px;
            }
        }

        @media (max-width: 480px) {
            .sidebar {
                padding: 15px;
            }
            #chat-messages {
                padding: 15px;
            }
            .input-area {
                padding: 10px 15px;
            }
            .main-header {
                padding: 8px 10px;
            }
            .message {
                max-width: 95%;
            }
            #consent-banner {
                font-size: 0.8rem;
                padding: 10px;
            }
        }