"""Dark theme, custom CSS, and logo SVGs for the NotebookLM Gradio app.""" import base64 import gradio as gr # ── Logo SVGs ──────────────────────────────────────────────────────────────── LOGO_SVG = """""" LOGO_ICON_SVG = """""" def get_logo_b64(svg_str: str) -> str: return base64.b64encode(svg_str.encode()).decode() LOGO_B64 = get_logo_b64(LOGO_SVG) ICON_B64 = get_logo_b64(LOGO_ICON_SVG) # ── Gradio Dark Theme ──────────────────────────────────────────────────────── dark_theme = gr.themes.Base( primary_hue=gr.themes.colors.indigo, secondary_hue=gr.themes.colors.purple, neutral_hue=gr.themes.colors.slate, font=gr.themes.GoogleFont("Inter"), ).set( body_background_fill="#0e1117", body_background_fill_dark="#0e1117", block_background_fill="rgba(255,255,255,0.02)", block_background_fill_dark="rgba(255,255,255,0.02)", block_border_color="rgba(255,255,255,0.08)", block_border_color_dark="rgba(255,255,255,0.08)", block_label_text_color="#a0a0b8", block_label_text_color_dark="#a0a0b8", block_title_text_color="#e0e0f0", block_title_text_color_dark="#e0e0f0", body_text_color="#c8c8d8", body_text_color_dark="#c8c8d8", button_primary_background_fill="linear-gradient(135deg, #667eea 0%, #764ba2 100%)", button_primary_background_fill_dark="linear-gradient(135deg, #667eea 0%, #764ba2 100%)", button_primary_text_color="white", button_primary_text_color_dark="white", button_secondary_background_fill="rgba(255,255,255,0.04)", button_secondary_background_fill_dark="rgba(255,255,255,0.04)", button_secondary_border_color="rgba(255,255,255,0.12)", button_secondary_border_color_dark="rgba(255,255,255,0.12)", button_secondary_text_color="#d0d0e0", button_secondary_text_color_dark="#d0d0e0", border_color_primary="rgba(255,255,255,0.08)", border_color_primary_dark="rgba(255,255,255,0.08)", input_background_fill="rgba(255,255,255,0.03)", input_background_fill_dark="rgba(255,255,255,0.03)", input_border_color="rgba(255,255,255,0.1)", input_border_color_dark="rgba(255,255,255,0.1)", shadow_drop="none", shadow_drop_lg="none", shadow_spread="none", ) # ── Custom CSS ─────────────────────────────────────────────────────────────── CUSTOM_CSS = """ /* ── Import Google Font ── */ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap'); /* ── Sidebar ── */ #sidebar { background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%) !important; border-right: 1px solid rgba(255,255,255,0.06); padding: 16px !important; min-height: 100vh; position: sticky; top: 0; align-self: flex-start; max-height: 100vh; overflow-y: auto; border-radius: 0 !important; } #sidebar .gr-button-primary { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important; border: none !important; border-radius: 10px !important; } #sidebar .gr-button-secondary { background: rgba(255,255,255,0.05) !important; border: 1px solid rgba(255,255,255,0.1) !important; border-radius: 10px !important; color: #d0d0e0 !important; } /* ── Notebook selector radio ── */ #notebook-selector label { border-radius: 10px !important; padding: 8px 14px !important; transition: all 0.2s ease !important; font-size: 0.85rem !important; } #notebook-selector label.selected { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important; color: white !important; } /* ── Tab styling ── */ .tabs > .tab-nav > button { border-radius: 10px !important; padding: 10px 24px !important; font-weight: 500 !important; font-size: 0.9rem !important; } .tabs > .tab-nav > button.selected { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important; color: white !important; } /* ── Chat ── */ #chatbot { border-radius: 14px !important; border: 1px solid rgba(255,255,255,0.08) !important; } #chatbot .message { border-radius: 14px !important; padding: 14px 18px !important; } /* User bubble — shrink to fit content */ #chatbot .bot-row { justify-content: flex-start !important; } #chatbot .user-row { justify-content: flex-end !important; } #chatbot .user-row .message-bubble-border { max-width: fit-content !important; } #chatbot .message.user { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important; color: white !important; border: none !important; box-shadow: 0 4px 14px rgba(102,126,234,0.25); max-width: fit-content !important; } /* Assistant bubble */ #chatbot .message.bot { background: rgba(40, 44, 66, 0.85) !important; border: 1px solid rgba(102, 126, 234, 0.3) !important; color: #c8c8d8 !important; box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25); border-radius: 14px !important; padding: 14px 18px !important; backdrop-filter: blur(6px); } /* ── Cards ── */ .source-card { display: flex; align-items: center; gap: 16px; padding: 16px 20px; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.08); border-radius: 14px; margin-bottom: 10px; transition: all 0.2s ease; } .source-card:hover { border-color: rgba(102,126,234,0.3); background: rgba(255,255,255,0.04); } .source-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0; } .source-icon.pdf { background: rgba(239,68,68,0.15); } .source-icon.pptx { background: rgba(249,115,22,0.15); } .source-icon.txt { background: rgba(59,130,246,0.15); } .source-icon.url { background: rgba(34,197,94,0.15); } .source-icon.youtube { background: rgba(239,68,68,0.15); } .source-info { flex: 1; min-width: 0; } .source-info .name { font-weight: 600; font-size: 0.95rem; color: #e0e0f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .source-info .meta { font-size: 0.8rem; color: #707088; margin-top: 2px; } .source-badge { padding: 4px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.3px; } .source-badge.ready { background: rgba(34,197,94,0.15); color: #22c55e; } .source-badge.processing { background: rgba(234,179,8,0.15); color: #eab308; animation: pulse-badge 1.5s ease-in-out infinite; } .source-badge.failed { background: rgba(239,68,68,0.15); color: #ef4444; cursor: help; } @keyframes pulse-badge { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } } /* ── Welcome hero ── */ .welcome-hero { text-align: center; padding: 80px 40px; background: linear-gradient(135deg, rgba(102,126,234,0.08) 0%, rgba(118,75,162,0.08) 100%); border-radius: 20px; border: 1px solid rgba(102,126,234,0.15); margin: 20px 0; } .welcome-hero h1 { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-size: 2.5rem; font-weight: 700; margin-bottom: 12px; } .welcome-hero p { color: #9090a8; font-size: 1.1rem; line-height: 1.6; } /* ── Empty state ── */ .empty-state { text-align: center; padding: 60px 30px; color: #707088; } .empty-state h3 { color: #a0a0b8; margin-bottom: 8px; font-weight: 600; } .empty-state p { font-size: 0.95rem; line-height: 1.5; } /* ── Notebook header ── */ .notebook-header { padding: 0 0 16px 0; margin-bottom: 16px; border-bottom: 1px solid rgba(255,255,255,0.06); } .notebook-header h2 { font-weight: 700; font-size: 1.5rem; margin: 0; color: #e8e8f8; } .notebook-header .meta { font-size: 0.85rem; color: #707088; margin-top: 4px; } /* ── Citation chip ── */ .citation-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; background: rgba(102,126,234,0.1); border: 1px solid rgba(102,126,234,0.2); border-radius: 20px; font-size: 0.8rem; color: #a0b0f0; margin: 3px 4px; } /* ── Artifact section header ── */ .artifact-section-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; } .artifact-section-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; } /* ── Locked state ── */ .locked-state { text-align: center; padding: 50px 30px; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.06); border-radius: 16px; } /* ── File uploader ── */ .gr-file-upload { border-radius: 14px !important; border: 2px dashed rgba(102,126,234,0.3) !important; background: rgba(102,126,234,0.03) !important; } /* ── Primary button ── */ .gr-button-primary { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important; border: none !important; border-radius: 10px !important; font-weight: 600 !important; } .gr-button-primary:hover { opacity: 0.9 !important; transform: translateY(-1px) !important; box-shadow: 0 4px 15px rgba(102,126,234,0.3) !important; } /* ── Source delete dropdown ── */ #source-delete-dropdown { border: 1px solid rgba(102,126,234,0.3); border-radius: 12px; background: rgba(102,126,234,0.06); } #source-delete-dropdown label { color: #a0a0f0 !important; font-weight: 600; } #source-delete-dropdown input, #source-delete-dropdown .wrap { background: rgba(14,17,23,0.8) !important; border-color: rgba(102,126,234,0.25) !important; color: #e0e0f0 !important; border-radius: 10px !important; } #source-delete-dropdown ul { background: #1a1d2e !important; border: 1px solid rgba(102,126,234,0.3) !important; border-radius: 10px !important; } #source-delete-dropdown li { color: #c0c0e0 !important; } #source-delete-dropdown li:hover, #source-delete-dropdown li.selected { background: rgba(102,126,234,0.15) !important; color: #e0e0f0 !important; } /* ── Scrollbar ── */ ::-webkit-scrollbar { width: 6px; } ::-webkit-scrollbar-track { background: transparent; } ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; } ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); } /* ── Hide Gradio footer ── */ footer { display: none !important; } /* ── Auth gate ── */ #auth-gate { max-width: 500px; margin: 100px auto; } """ # ── Reusable HTML Templates ────────────────────────────────────────────────── WELCOME_HTML = f"""
Your AI-powered study companion.
Sign in with your Hugging Face account to get started.
Create a notebook from the sidebar to get started.