Files
Nexus.Reader/src/NexusReader.UI.Shared/Components/Organisms/GlobalIntelligence.razor.css
T
Antigravity f6819d50b7 feat(mobile-ux): implement theme toggle, client-side persistence, and light mode style overrides (#71)
Resolves #72

## Description

This PR implements the theme toggle mechanism, client-side persistence, and comprehensive light mode style overrides for the mobile reader layout in **NexusReader**.

### Key Changes
1. **ThemeService & State Management**:
   - Enhanced `ThemeService` with `InitializeAsync` and `ToggleTheme` using JS Interop.
   - Synchronized theme state changes via `OnThemeChanged` event.
2. **Local Storage Persistence & FOUC Prevention**:
   - Added client-side script in `App.razor` and MAUI `index.html` to instantly apply `.theme-light` from `localStorage` before prerendering/rendering to prevent a Flash of Unthemed Content (FOUC).
   - Created `theme.js` containing JS helper methods (`themeInterop.isLightMode`, `themeInterop.setLightMode`) to interface with `localStorage` and `document.documentElement` class list.
3. **UI Theme Toggle**:
   - Added a minimalist glassmorphic theme toggle button in the header of the `ReaderCanvas.razor` with dynamic transitions and icon morphing between sun and moon SVG icons.
4. **Light Mode Stylesheets Overrides**:
   - Added detailed light mode scoped styles (`.theme-light`) for the `ReaderCanvas` and the bottom-sheet `GlobalIntelligence` AI chat panel, utilizing earthy gray text (`#2d2a26`) on warm paper-like backgrounds (`rgba(244, 241, 234, 0.95)` / `#faf8f5`) to maintain high-quality aesthetic consistency.

### Verification
- Solution built successfully without errors (`dotnet build NexusReader.slnx --no-restore`).
- Scoped CSS isolation checked and validated for both Web and MAUI contexts.

---------

Co-authored-by: Marek Jasiński <jasins.marek@gmail.com>
Reviewed-on: #71
Co-authored-by: Antigravity <antigravity@google.com>
Co-committed-by: Antigravity <antigravity@google.com>
2026-06-05 18:02:33 +00:00

751 lines
16 KiB
CSS

.global-intelligence-sheet {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
z-index: 1500;
display: flex;
flex-direction: column;
justify-content: flex-end;
pointer-events: none;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}
.global-intelligence-sheet.is-open {
pointer-events: all;
}
.sheet-backdrop {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.4);
backdrop-filter: blur(4px);
opacity: 0;
transition: opacity 0.35s ease;
z-index: 1;
}
.global-intelligence-sheet.is-open .sheet-backdrop {
opacity: 1;
}
.sheet-content {
position: relative;
width: 100%;
height: 80vh;
background: rgba(18, 18, 18, 0.85);
backdrop-filter: blur(24px);
border-top: 1px solid rgba(0, 255, 153, 0.3);
border-top-left-radius: 20px;
border-top-right-radius: 20px;
box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
z-index: 2;
transform: translateY(100%);
transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
display: flex;
flex-direction: column;
}
.global-intelligence-sheet.is-open .sheet-content {
transform: translateY(0);
}
.sheet-drag-handle {
width: 40px;
height: 4px;
background-color: rgba(255, 255, 255, 0.2);
border-radius: 2px;
margin: 10px auto 4px auto;
}
.sheet-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.75rem 1.25rem;
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.header-main {
display: flex;
align-items: center;
gap: 0.75rem;
}
.ai-avatar-badge {
width: 36px;
height: 36px;
border-radius: 10px;
background: linear-gradient(135deg, rgba(0, 255, 153, 0.15) 0%, rgba(0, 240, 255, 0.15) 100%);
border: 1px solid rgba(0, 255, 153, 0.3);
display: flex;
align-items: center;
justify-content: center;
}
.ai-avatar-badge ::deep i {
color: var(--nexus-neon, #00FF99);
}
.header-info h3 {
font-size: 1rem;
font-weight: 600;
color: #FFFFFF;
margin: 0;
}
.header-info .subtitle {
font-size: 0.75rem;
color: rgba(255, 255, 255, 0.5);
margin: 0;
}
.close-btn {
background: none;
border: none;
color: rgba(255, 255, 255, 0.6);
padding: 6px;
border-radius: 50%;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease;
}
.close-btn:hover {
background-color: rgba(255, 255, 255, 0.05);
color: #FFFFFF;
}
.sheet-body {
flex: 1;
overflow-y: auto;
padding: 1.25rem;
}
.chat-thread {
display: flex;
flex-direction: column;
gap: 1.25rem;
padding-bottom: 2rem;
}
.welcome-container {
text-align: center;
padding: 4rem 1.5rem;
display: flex;
flex-direction: column;
align-items: center;
}
.welcome-glow-icon {
width: 64px;
height: 64px;
border-radius: 50%;
background: rgba(0, 255, 153, 0.05);
border: 1px solid rgba(0, 255, 153, 0.15);
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 1.25rem;
box-shadow: 0 0 20px rgba(0, 255, 153, 0.1);
}
.welcome-glow-icon ::deep i {
color: var(--nexus-neon, #00FF99);
}
.welcome-container h4 {
font-size: 1.1rem;
font-weight: 550;
color: #FFFFFF;
margin-bottom: 0.5rem;
}
.welcome-container p {
font-size: 0.85rem;
color: rgba(255, 255, 255, 0.55);
line-height: 1.5;
max-width: 280px;
}
.message-row {
display: flex;
gap: 0.75rem;
max-width: 88%;
}
.message-row.user-row {
align-self: flex-end;
flex-direction: row-reverse;
}
.message-row.ai-row {
align-self: flex-start;
}
.message-avatar {
width: 28px;
height: 28px;
border-radius: 50%;
background-color: rgba(255, 255, 255, 0.05);
border: 1px solid rgba(255, 255, 255, 0.1);
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.user-row .message-avatar {
background-color: rgba(0, 255, 153, 0.1);
border: 1px solid rgba(0, 255, 153, 0.2);
}
.message-avatar ::deep i {
font-size: 0.85rem;
color: rgba(255, 255, 255, 0.7);
}
.user-row .message-avatar ::deep i {
color: var(--nexus-neon, #00FF99);
}
.message-bubble {
padding: 0.75rem 1rem;
border-radius: 14px;
position: relative;
}
.user-bubble {
background-color: rgba(0, 255, 153, 0.08);
border: 1px solid rgba(0, 255, 153, 0.2);
border-top-right-radius: 2px;
}
.ai-bubble {
background-color: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(255, 255, 255, 0.06);
border-top-left-radius: 2px;
}
.message-meta {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 0.25rem;
gap: 1rem;
}
.sender-name {
font-size: 0.7rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.05em;
}
.user-bubble .sender-name {
color: var(--nexus-neon, #00FF99);
}
.ai-bubble .sender-name {
color: rgba(255, 255, 255, 0.7);
}
.message-time {
font-size: 0.65rem;
color: rgba(255, 255, 255, 0.4);
}
.message-text {
font-size: 0.85rem;
line-height: 1.5;
color: rgba(255, 255, 255, 0.9);
}
.message-text strong {
color: #FFFFFF;
}
.nexus-mobile-citation {
background-color: rgba(0, 240, 255, 0.15);
border: 1px solid rgba(0, 240, 255, 0.3);
color: #00F0FF;
border-radius: 4px;
padding: 1px 4px;
font-size: 0.75rem;
font-weight: bold;
cursor: pointer;
margin-left: 2px;
display: inline-block;
}
.nexus-mobile-code-block {
background-color: rgba(0, 0, 0, 0.4);
border-left: 3px solid var(--nexus-neon, #00FF99);
padding: 0.75rem;
border-radius: 6px;
margin: 0.5rem 0;
overflow-x: auto;
font-family: monospace;
font-size: 0.75rem;
}
.nexus-mobile-inline-code {
background-color: rgba(255, 255, 255, 0.08);
color: #FF7B72;
padding: 2px 4px;
border-radius: 4px;
font-family: monospace;
font-size: 0.75rem;
}
/* Typing indicator */
.typing-indicator {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 4px 0;
}
.typing-indicator span {
width: 6px;
height: 6px;
background-color: rgba(255, 255, 255, 0.5);
border-radius: 50%;
animation: bounce 1.4s infinite ease-in-out both;
}
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce {
0%, 80%, 100% { transform: scale(0); }
40% { transform: scale(1); }
}
.loading-label {
font-size: 0.75rem;
color: rgba(255, 255, 255, 0.5);
margin-left: 8px;
vertical-align: middle;
}
.sheet-footer {
padding: 0.75rem 1rem 1.5rem 1rem;
border-top: 1px solid rgba(255, 255, 255, 0.08);
background-color: rgba(10, 10, 10, 0.5);
}
.scope-indicator {
display: flex;
align-items: center;
gap: 4px;
font-size: 0.7rem;
color: rgba(255, 255, 255, 0.45);
margin-bottom: 0.5rem;
}
.scope-indicator ::deep i {
color: rgba(255, 255, 255, 0.4);
}
.input-container {
display: flex;
gap: 0.5rem;
align-items: center;
}
.nexus-mobile-input {
flex: 1;
background-color: rgba(255, 255, 255, 0.04);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 12px;
padding: 0.65rem 0.9rem;
font-size: 0.85rem;
color: #FFFFFF;
outline: none;
transition: all 0.25s ease;
}
.nexus-mobile-input:focus {
border-color: rgba(0, 255, 153, 0.4);
background-color: rgba(255, 255, 255, 0.07);
box-shadow: 0 0 8px rgba(0, 255, 153, 0.15);
}
.send-btn {
width: 38px;
height: 38px;
border-radius: 12px;
background: linear-gradient(135deg, #00FF99 0%, #00F0FF 100%);
border: none;
display: flex;
align-items: center;
justify-content: center;
color: #0b0c10;
cursor: pointer;
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: 0 0 10px rgba(0, 255, 153, 0.2);
flex-shrink: 0;
}
.send-btn.disabled {
background: rgba(255, 255, 255, 0.05);
color: rgba(255, 255, 255, 0.3);
box-shadow: none;
cursor: not-allowed;
}
.btn-spinner {
width: 16px;
height: 16px;
border: 2px solid rgba(0,0,0,0.1);
border-top: 2px solid #000000;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* Citation Modal Overlay & Glassmorphic Card */
.citation-modal-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.6);
backdrop-filter: blur(8px);
z-index: 10;
display: flex;
align-items: center;
justify-content: center;
padding: 1.5rem;
animation: fadeIn 0.25s ease-out;
}
.citation-modal {
width: 100%;
max-width: 320px;
background: rgba(20, 20, 20, 0.85);
border: 1px solid rgba(0, 240, 255, 0.25);
box-shadow: 0 0 30px rgba(0, 240, 255, 0.15);
border-radius: 16px;
display: flex;
flex-direction: column;
overflow: hidden;
animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.citation-modal .modal-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.75rem 1rem;
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.citation-modal .book-title {
font-size: 0.85rem;
font-weight: 600;
color: #FFFFFF;
display: flex;
align-items: center;
gap: 0.5rem;
}
.citation-modal .book-title ::deep i {
color: #00F0FF;
}
.citation-modal .close-btn {
background: none;
border: none;
color: rgba(255, 255, 255, 0.5);
cursor: pointer;
padding: 4px;
display: flex;
align-items: center;
justify-content: center;
}
.citation-modal .modal-body {
padding: 1rem;
font-size: 0.8rem;
line-height: 1.5;
color: rgba(255, 255, 255, 0.85);
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.citation-modal .citation-author,
.citation-modal .citation-page {
font-size: 0.75rem;
color: rgba(255, 255, 255, 0.5);
margin: 0;
}
.citation-modal .citation-author strong,
.citation-modal .citation-page strong {
color: rgba(255, 255, 255, 0.75);
}
.citation-modal .citation-snippet {
font-style: italic;
background: rgba(0, 240, 255, 0.04);
border-left: 2px solid #00F0FF;
padding: 0.5rem 0.75rem;
border-radius: 4px;
color: rgba(255, 255, 255, 0.9);
margin: 0.25rem 0 0 0;
}
.citation-modal .modal-footer {
display: flex;
justify-content: flex-end;
padding: 0.75rem 1rem;
border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.citation-modal .btn-nexus {
font-size: 0.8rem;
padding: 0.4rem 1rem;
border-radius: 8px;
background: linear-gradient(135deg, rgba(0, 240, 255, 0.2) 0%, rgba(0, 255, 153, 0.2) 100%);
border: 1px solid rgba(0, 240, 255, 0.4);
color: #FFFFFF;
font-weight: 550;
cursor: pointer;
transition: all 0.2s ease;
}
.citation-modal .btn-nexus:hover {
background: linear-gradient(135deg, rgba(0, 240, 255, 0.35) 0%, rgba(0, 255, 153, 0.35) 100%);
border-color: rgba(0, 240, 255, 0.6);
box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes slideUp {
from { transform: translateY(20px); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
/* ==========================================================================
Light Mode Theme Overrides
========================================================================== */
.theme-light .sheet-content {
background: rgba(244, 241, 234, 0.95); /* Matches Premium Paper theme */
border-top-color: rgba(16, 185, 129, 0.3);
box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.08);
}
.theme-light .sheet-drag-handle {
background-color: rgba(0, 0, 0, 0.15);
}
.theme-light .sheet-header {
border-bottom-color: rgba(0, 0, 0, 0.06);
}
.theme-light .header-info h3 {
color: #2d2a26;
}
.theme-light .header-info .subtitle {
color: #7c766b;
}
.theme-light .close-btn {
color: #7c766b;
}
.theme-light .close-btn:hover {
background-color: rgba(0, 0, 0, 0.05);
color: #2d2a26;
}
.theme-light .welcome-container h4 {
color: #2d2a26;
}
.theme-light .welcome-container p {
color: #7c766b;
}
.theme-light .ai-avatar-badge {
background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(6, 182, 212, 0.08) 100%);
border-color: rgba(16, 185, 129, 0.25);
}
.theme-light .ai-avatar-badge ::deep i {
color: #10b981;
}
.theme-light .welcome-glow-icon {
background: rgba(16, 185, 129, 0.05);
border-color: rgba(16, 185, 129, 0.25);
box-shadow: 0 0 20px rgba(16, 185, 129, 0.08);
}
.theme-light .welcome-glow-icon ::deep i {
color: #10b981;
}
/* Chat bubble styling overrides */
.theme-light .ai-bubble {
background-color: rgba(255, 255, 255, 0.6);
border-color: rgba(0, 0, 0, 0.05);
}
.theme-light .ai-bubble .sender-name {
color: #7c766b;
}
.theme-light .user-bubble {
background-color: rgba(16, 185, 129, 0.06);
border-color: rgba(16, 185, 129, 0.18);
}
.theme-light .user-bubble .sender-name {
color: #10b981;
}
.theme-light .message-time {
color: #8c867b;
}
.theme-light .message-text {
color: #2d2a26;
}
.theme-light .message-text strong {
color: #1a1917;
}
/* Code block / Citation styling overrides */
.theme-light .nexus-mobile-code-block {
background-color: #faf8f5;
border-left-color: #10b981;
color: #2d2a26;
}
.theme-light .nexus-mobile-inline-code {
background-color: rgba(0, 0, 0, 0.04);
color: #b91c1c;
}
.theme-light .nexus-mobile-citation {
background-color: rgba(16, 185, 129, 0.08);
border-color: rgba(16, 185, 129, 0.25);
color: #10b981;
}
.theme-light .typing-indicator span {
background-color: rgba(0, 0, 0, 0.3);
}
.theme-light .loading-label {
color: #7c766b;
}
/* Footer / Input overrides */
.theme-light .sheet-footer {
background-color: rgba(234, 230, 221, 0.6);
border-top-color: rgba(0, 0, 0, 0.06);
}
.theme-light .scope-indicator {
color: #7c766b;
}
.theme-light .scope-indicator ::deep i {
color: #8c867b;
}
.theme-light .nexus-mobile-input {
background-color: rgba(255, 255, 255, 0.85);
border-color: rgba(0, 0, 0, 0.08);
color: #2d2a26;
}
.theme-light .nexus-mobile-input:focus {
border-color: rgba(16, 185, 129, 0.4);
background-color: #ffffff;
box-shadow: 0 0 8px rgba(16, 185, 129, 0.15);
}
.theme-light .send-btn.disabled {
background: rgba(0, 0, 0, 0.04);
color: rgba(0, 0, 0, 0.25);
}
/* Citation modal overrides */
.theme-light .citation-modal {
background: #ffffff;
border-color: rgba(0, 0, 0, 0.06);
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}
.theme-light .citation-modal .modal-header {
border-bottom-color: rgba(0, 0, 0, 0.06);
}
.theme-light .citation-modal .book-title {
color: #2d2a26;
}
.theme-light .citation-modal .book-title ::deep i {
color: #10b981;
}
.theme-light .citation-modal .modal-body {
color: #2d2a26;
}
.theme-light .citation-modal .citation-author,
.theme-light .citation-modal .citation-page {
color: #7c766b;
}
.theme-light .citation-modal .citation-author strong,
.theme-light .citation-modal .citation-page strong {
color: #2d2a26;
}
.theme-light .citation-modal .citation-snippet {
background: rgba(16, 185, 129, 0.04);
border-left-color: #10b981;
color: #2d2a26;
}
.theme-light .citation-modal .modal-footer {
border-top-color: rgba(0, 0, 0, 0.06);
}
.theme-light .citation-modal .btn-nexus {
background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(6, 182, 212, 0.08) 100%);
border-color: rgba(16, 185, 129, 0.3);
color: #10b981;
}
.theme-light .citation-modal .btn-nexus:hover {
background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(6, 182, 212, 0.15) 100%);
border-color: rgba(16, 185, 129, 0.5);
box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}