/* LED Matrix v3 Custom Styles */ /* Modern, clean design with utility classes */ /* CSS Custom Properties for Theme Colors */ :root { --color-primary: #2563eb; --color-primary-hover: #1d4ed8; --color-secondary: #059669; --color-secondary-hover: #047857; --color-accent: #7c3aed; --color-accent-hover: #6d28d9; --color-background: #f9fafb; --color-surface: #ffffff; --color-text-primary: #111827; --color-text-secondary: #374151; --color-text-tertiary: #4b5563; --color-border: #e5e7eb; --color-border-light: #f3f4f6; --color-success: #059669; --color-success-bg: #d1fae5; --color-error: #dc2626; --color-error-bg: #fee2e2; --color-warning: #d97706; --color-warning-bg: #fef3c7; --color-info: #2563eb; --color-info-bg: #dbeafe; --color-purple-bg: #f3e8ff; --color-purple-text: #6b21a8; --color-field-bg: #ffffff; --color-field-border: #d1d5db; --color-focus-ring: #2563eb; --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 5%); --shadow: 0 1px 3px 0 rgb(0 0 0 / 10%), 0 1px 2px 0 rgb(0 0 0 / 6%); --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 10%), 0 2px 4px -1px rgb(0 0 0 / 6%); --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 10%), 0 4px 6px -2px rgb(0 0 0 / 5%); } /* Dark Theme Overrides */ [data-theme="dark"] { --color-primary: #3b82f6; --color-primary-hover: #60a5fa; --color-secondary: #10b981; --color-secondary-hover: #34d399; --color-accent: #8b5cf6; --color-accent-hover: #a78bfa; --color-background: #111827; --color-surface: #1f2937; --color-text-primary: #f9fafb; --color-text-secondary: #d1d5db; --color-text-tertiary: #9ca3af; --color-border: #374151; --color-border-light: #1f2937; --color-success: #34d399; --color-success-bg: #064e3b; --color-error: #f87171; --color-error-bg: #7f1d1d; --color-warning: #fbbf24; --color-warning-bg: #78350f; --color-info: #60a5fa; --color-info-bg: #1e3a5f; --color-purple-bg: #2e1065; --color-purple-text: #c4b5fd; --color-field-bg: #374151; --color-field-border: #4b5563; --color-focus-ring: #60a5fa; --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 30%); --shadow: 0 1px 3px 0 rgb(0 0 0 / 40%), 0 1px 2px 0 rgb(0 0 0 / 30%); --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 40%), 0 2px 4px -1px rgb(0 0 0 / 30%); --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 40%), 0 4px 6px -2px rgb(0 0 0 / 30%); } /* Dark Mode - Utility Class Overrides */ [data-theme="dark"] .bg-white { background-color: var(--color-surface); } [data-theme="dark"] .bg-gray-50 { background-color: var(--color-background); } [data-theme="dark"] .bg-gray-100 { background-color: var(--color-surface); } [data-theme="dark"] .bg-gray-200 { background-color: var(--color-border); } [data-theme="dark"] .text-gray-900 { color: var(--color-text-primary); } [data-theme="dark"] .text-gray-600 { color: var(--color-text-tertiary); } [data-theme="dark"] .text-gray-500 { color: var(--color-text-tertiary); } [data-theme="dark"] .text-gray-400 { color: var(--color-text-tertiary); } [data-theme="dark"] .text-green-600 { color: var(--color-success); } [data-theme="dark"] .text-red-600 { color: var(--color-error); } [data-theme="dark"] .border-gray-200 { border-color: var(--color-border); } [data-theme="dark"] .border-gray-300 { border-color: #4b5563; } [data-theme="dark"] .hover\:bg-gray-50:hover { background-color: var(--color-border); } [data-theme="dark"] .hover\:bg-gray-200:hover { background-color: #4b5563; } [data-theme="dark"] .hover\:text-gray-700:hover { color: #e5e7eb; } [data-theme="dark"] .hover\:border-gray-300:hover { border-color: #6b7280; } [data-theme="dark"] .bg-red-100 { background-color: #450a0a; } [data-theme="dark"] .bg-yellow-100 { background-color: #422006; } [data-theme="dark"] .bg-green-100 { background-color: #022c22; } [data-theme="dark"] .text-red-700 { color: #fca5a5; } [data-theme="dark"] .hover\:bg-red-200:hover { background-color: #7f1d1d; } /* Base styles */ * { box-sizing: border-box; } html { scroll-behavior: smooth; } body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; line-height: 1.6; color: var(--color-text-primary); background-color: var(--color-background); } /* Border utilities (.border, .border-t, ...) set only a width (tailwind.css resets every element to zero width, solid style); this gives them the theme's border color unless a border-* color class says otherwise. */ *, ::before, ::after { border-color: var(--color-border); } /* Button reset. Markup styles buttons with utility classes (bg-*, px-*, border); without it, any button the classes don't fully style falls back to the browser's gray outset look. Element selector, so every class wins. */ :where(button) { font: inherit; color: inherit; line-height: inherit; background-color: transparent; background-image: none; border-width: 0; border-style: solid; padding: 0; cursor: pointer; } :where(button:disabled) { cursor: not-allowed; } /* Inline code (paths, commands) must not push a row wider than a phone. */ code { overflow-wrap: anywhere; } /* One keyboard focus indicator for everything. Pointer clicks don't show it (:focus-visible); components with their own ring keep theirs. */ :focus-visible { outline: 2px solid var(--color-focus-ring); outline-offset: 2px; } ::selection { background-color: rgb(37 99 235 / 25%); } [data-theme="dark"] ::selection { background-color: rgb(96 165 250 / 35%); } html { scrollbar-color: #94a3b8 transparent; } html[data-theme="dark"] { scrollbar-color: #4b5563 transparent; } .skip-link { position: absolute; left: 0.75rem; top: -4rem; z-index: 100; padding: 0.625rem 1rem; border-radius: 0.375rem; background-color: var(--color-surface); color: var(--color-primary); font-weight: 600; box-shadow: var(--shadow-lg); } .skip-link:focus { top: 0.75rem; } /* Log level row backgrounds (subtle tints on dark log container) */ .log-level-error { background-color: rgb(127 29 29 / 10%); } .log-level-warning { background-color: rgb(120 53 15 / 10%); } .log-level-debug { background-color: rgb(31 41 55 / 30%); } /* Headings with improved hierarchy */ h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: 1.4; color: var(--color-text-primary); /* Improved line-height from 1.3 to 1.4 for better readability */ } h1 { font-size: 1.875rem; } h2 { font-size: 1.5rem; } h3 { font-size: 1.25rem; } h4 { font-size: 1.125rem; } /* Smooth transitions for all interactive elements */ /* Optimized: Only transition properties that don't trigger expensive repaints */ a, button, input, select, textarea { transition: color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease; /* Removed background-color transition - can trigger repaints, use opacity or border-color instead */ } /* Custom scrollbar for webkit browsers */ ::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-track { background: #f1f5f9; } ::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; } ::-webkit-scrollbar-thumb:hover { background: #94a3b8; } /* Logs container specific scrollbar */ #logs-container::-webkit-scrollbar { width: 10px; } #logs-container::-webkit-scrollbar-track { background: #374151; } #logs-container::-webkit-scrollbar-thumb { background: #6b7280; border-radius: 5px; } #logs-container::-webkit-scrollbar-thumb:hover { background: #9ca3af; } /* Smooth scrolling for logs container */ #logs-container { scroll-behavior: smooth; position: relative; overflow-y: auto !important; } /* Ensure logs content doesn't cause overflow issues. content-visibility lets the Pi skip layout and paint for the rows scrolled out of view; the intrinsic size keeps the scrollbar stable. */ .log-entry { word-wrap: break-word; overflow-wrap: break-word; max-width: 100%; box-sizing: border-box; content-visibility: auto; contain-intrinsic-size: auto 1.5rem; } /* Ensure proper containment of logs */ #logs-loading { position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 1; } #logs-empty { position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 2; } #logs-display { position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 3; } .logs-content { height: 100%; overflow-y: auto; padding: 0; } /* Logs container responsive height - simplified for better scrolling */ @media (max-width: 768px) { #logs-container { height: clamp(260px, 60vh, 480px) !important; height: clamp(260px, 60svh, 480px) !important; min-height: 0 !important; } } /* ===== Utilities ===== Utility classes (flex, px-4, text-gray-700, md:hidden, ...) come from tailwind.css, which scripts/build_css.py generates from the templates and static JS and base.html links before this file. Don't add utilities here: use the class and rebuild. Only the few this UI wants to behave differently from stock Tailwind live here; tailwind.config.js blocklists the focus ones so Tailwind doesn't emit its own. */ /* Keyboard focus keeps its outline and ring; a pointer click shows neither. */ .focus\:outline-none:focus:not(:focus-visible) { outline: 2px solid transparent; outline-offset: 2px; } .peer:focus-visible ~ .peer-focus\:outline-none { outline: 2px solid transparent; outline-offset: 2px; } .peer:focus-visible ~ .peer-focus\:ring-4 { box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), 0 0 0 calc(4px + var(--tw-ring-offset-width, 0px)) var(--tw-ring-color, rgb(59 130 246 / 50%)), var(--tw-shadow, 0 0 #0000); } .peer:focus-visible ~ .peer-focus\:ring-blue-300 { --tw-ring-color: #93c5fd; } .underline, .hover\:underline:hover { text-underline-offset: 0.15em; } /* ===== Mobile navigation drawer ===== Below md the #site-nav wrapper becomes an off-canvas drawer; at md and up none of these rules apply and the nav renders exactly as before. */ @media (max-width: 767.98px) { .site-nav { position: fixed; top: 0; left: 0; bottom: 0; z-index: 60; width: min(85vw, 320px); background-color: var(--color-surface); border-right: 1px solid var(--color-border); transform: translateX(-100%); transition: transform 0.25s ease; overflow-y: auto; padding: 1rem; -webkit-overflow-scrolling: touch; } .site-nav.open { transform: translateX(0); box-shadow: 0 0 24px rgba(0, 0, 0, 0.25); } /* Tabs become full-width rows with >=44px touch targets */ .site-nav .nav-tab { display: flex; width: 100%; align-items: center; gap: 0.5rem; text-align: left; padding: 0.75rem 1rem; min-height: 44px; } .site-nav nav.-mb-px { display: block; } .nav-backdrop { position: fixed; inset: 0; z-index: 55; background-color: rgba(0, 0, 0, 0.4); } /* Header widgets relocated into the drawer (see placeHeaderWidgets in app.js). The originals carry `hidden`/breakpoint classes tuned for the header, so re-enable them explicitly in the drawer context. */ #drawer-widgets #settings-search-wrap { display: block !important; margin-bottom: 1rem; } #drawer-widgets #settings-search-wrap input { width: 100%; } #drawer-widgets #settings-search-results { position: static; width: 100%; max-height: 50vh; margin-top: 0.25rem; } #drawer-widgets #system-stats { display: flex !important; justify-content: space-between; margin-bottom: 1rem; } /* Larger touch targets inside horizontally scrolling tables */ .overflow-x-auto table button { min-width: 44px; min-height: 44px; } .overflow-x-auto table input:not([type="checkbox"]), .overflow-x-auto table select { min-height: 40px; } .overflow-x-auto table input[type="checkbox"] { width: 1.25rem; height: 1.25rem; } } @media (min-width: 768px) { /* Hard guards: even if mobileNavOpen was left true when the viewport crossed the breakpoint, the drawer/backdrop must render as plain in-flow nav on desktop. */ .site-nav { position: static; transform: none; width: auto; padding: 0; border-right: none; box-shadow: none; background-color: transparent; overflow-y: visible; } .nav-backdrop { display: none !important; } #drawer-widgets { display: none; } } /* Mobile modal sizing: every .modal-content dialog fits the viewport with internal scrolling instead of overflowing it. */ @media (max-width: 640px) { .modal-content { width: 95vw !important; max-width: 95vw !important; max-height: 90vh; overflow-y: auto; } } /* Edge-fade hint that a container scrolls horizontally (pure CSS, Lea Verou scrolling-shadows technique — backgrounds sit behind content). Not on elements with their own background (the dark command-output
): the shorthand would wipe it,
   and surface-coloured covers don't belong on it anyway. */
.overflow-x-auto:not([class*="bg-"]) {
    background:
        linear-gradient(90deg, var(--color-surface) 30%, rgba(255, 255, 255, 0)) left / 24px 100%,
        linear-gradient(270deg, var(--color-surface) 30%, rgba(255, 255, 255, 0)) right / 24px 100%,
        radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0)) left / 12px 100%,
        radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0)) right / 12px 100%;
    background-repeat: no-repeat;
    background-attachment: local, local, scroll, scroll;
}

/* HTMX loading states */
.htmx-request .loading {
    display: inline-block;
}

.htmx-request .btn-text {
    opacity: 0.5;
}

/* Enhanced Button styles. :where() keeps the base at zero specificity so
   utility classes on the same element (px-3 py-1, rounded) take effect. */
:where(.btn) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.5;
    text-decoration: none;
    transition: transform 0.15s ease, opacity 0.15s ease;
    cursor: pointer;
    border: none;
    /* Removed ::before pseudo-element animation for better performance */
}

.btn:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn:disabled:hover {
    transform: none;
}

.btn:focus-visible {
    outline: 2px solid var(--color-focus-ring);
    outline-offset: 2px;
}

/* Global button text contrast fix: Ensure buttons with white backgrounds have dark text */
button.bg-white {
    color: #111827 !important; /* text-gray-900 equivalent - ensures good contrast on white background */
}

/* Form styles */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-bottom: 0.25rem;
}

/* :where() so utilities on the field (pl-8 for a search icon, w-48,
   h-4 w-4 on checkboxes) override the component defaults. */
:where(.form-control) {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-field-border);
    border-radius: 0.375rem;
    background-color: var(--color-field-bg);
    color: var(--color-text-primary);
    font-size: 0.875rem;
    line-height: 1.25rem;
    transition: border-color 0.15s ease-in-out;
    /* Removed box-shadow transition - using border-color only for better performance */
}

.form-control:focus {
    border-color: var(--color-primary);
    /* Using outline instead of box-shadow for focus state (better performance) */
    outline: 2px solid var(--color-focus-ring);
    outline-offset: 1px;
}

.form-control:disabled {
    background-color: var(--color-background);
    opacity: 0.6;
    cursor: not-allowed;
}

/* Enhanced Card styles */
.card {
    background-color: var(--color-surface);
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.15s ease;
    contain: layout style paint;
    /* Removed box-shadow transition for better performance - using transform only (GPU accelerated) */
    /* Added CSS containment for better performance isolation */
}

.card:hover {
    transform: translateY(-2px);
}

/* Plugin Card Styles */
.plugin-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 0.75rem;
    padding: 1.25rem;
    transition: transform 0.15s ease, border-color 0.15s ease;
    cursor: pointer;
    position: relative;
    contain: layout style paint;
    /* Simplified transitions - using only transform and border-color (cheaper than box-shadow) */
    /* Added CSS containment for better performance isolation */
}

.plugin-card:hover {
    transform: translateY(-2px);
    border-color: var(--color-primary);
    /* Removed box-shadow transition for better performance */
}

.plugin-card:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.plugin-card:active {
    transform: translateY(0);
}

/* Status indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-indicator.success {
    background-color: #dcfce7;
    color: #166534;
}

.status-indicator.error {
    background-color: #fef2f2;
    color: #991b1b;
}

.status-indicator.warning {
    background-color: #fffbeb;
    color: #92400e;
}

.status-indicator.info {
    background-color: var(--color-info-bg);
    color: var(--color-info);
}

/* Badge Styles */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
}

.badge-success {
    background-color: var(--color-success-bg);
    color: var(--color-success);
}

.badge-error {
    background-color: var(--color-error-bg);
    color: var(--color-error);
}

.badge-warning {
    background-color: var(--color-warning-bg);
    color: var(--color-warning);
}

.badge-info {
    background-color: var(--color-info-bg);
    color: var(--color-info);
}

.badge-accent {
    background-color: var(--color-purple-bg);
    color: var(--color-purple-text);
}

/* Filter Pill Toggle States */
.filter-pill {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.filter-pill[data-active="true"] {
    background-color: var(--color-info-bg);
    border-color: var(--color-info);
    color: var(--color-info);
    font-weight: 600;
}

.filter-pill[data-active="true"]:hover {
    opacity: 0.85;
}

/* Section Headers with Subtle Gradients */
.section-header {
    background: linear-gradient(135deg, rgb(255 255 255 / 90%) 0%, rgb(249 250 251 / 90%) 100%);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 0;
    margin-bottom: 1.5rem;
}

/* Enhanced Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-text-tertiary);
}

.empty-state-icon {
    font-size: 3rem;
    color: var(--color-text-tertiary);
    opacity: 0.5;
    margin-bottom: 1rem;
}

/* Enhanced Loading Skeleton */
.skeleton {
    background-color: #f0f0f0;
    border-radius: 0.375rem;
    animation: skeletonPulse 1.5s ease-in-out infinite;
    /* Simplified from gradient animation to opacity pulse for better performance */
}

@keyframes skeletonPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Enhanced Modal Styling */
.modal-backdrop {
    background-color: rgb(0 0 0 / 50%);
    /* Removed backdrop-filter: blur() for better performance on Raspberry Pi */
    transition: opacity 0.2s ease;
}

.modal-content {
    background: var(--color-surface);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.2s ease;
    contain: layout style paint;
    /* Added CSS containment for better performance isolation */
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================================ */
/* Settings tooltips (help_tip macro + tooltips.js)                             */
/* ============================================================================ */

/* The (i) info trigger placed next to a setting label. */
.help-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    margin-left: 0.375rem;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--color-text-tertiary);
    font-size: 0.8125rem;
    line-height: 1;
    cursor: help;
    vertical-align: middle;
    border-radius: 9999px;
    transition: color 0.12s ease;
}

.help-tip:hover,
.help-tip:focus-visible {
    color: var(--color-primary);
}

.help-tip:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Singleton tooltip panel appended to  by tooltips.js. */
#ledm-tooltip {
    position: fixed;
    z-index: 1000;
    max-width: 20rem;
    padding: 0.5rem 0.75rem;
    background: var(--color-surface);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    font-size: 0.8125rem;
    line-height: 1.45;
    white-space: pre-line; /* renders authored "\n" line breaks */
    pointer-events: none;  /* never steals hover/click from the page */
    animation: tooltipFade 0.12s ease;
}

#ledm-tooltip[hidden] {
    display: none;
}

@keyframes tooltipFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================================================ */
/* Settings search — global header dropdown + per-tab filter                    */
/* ============================================================================ */

#settings-search-results {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    z-index: 50;
    padding: 0.25rem;
    max-height: min(60vh, 24rem);
    overflow-y: auto;
}

.ssr-group {
    padding: 0.375rem 0.625rem 0.25rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-tertiary);
    position: sticky;
    top: 0;
    background: var(--color-surface);
}

.ssr-option {
    display: flex;
    flex-direction: column;
    width: 100%;
    text-align: left;
    padding: 0.4rem 0.625rem;
    border: none;
    background: transparent;
    border-radius: 0.375rem;
    cursor: pointer;
    color: var(--color-text-primary);
}

.ssr-option:hover,
.ssr-option.active {
    background: var(--color-info-bg);
}

.ssr-label {
    font-size: 0.875rem;
    font-weight: 500;
}

.ssr-help {
    font-size: 0.75rem;
    color: var(--color-text-tertiary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.ssr-empty {
    padding: 0.75rem 0.625rem;
    font-size: 0.8125rem;
    color: var(--color-text-tertiary);
}

/* Flash highlight applied to a field after search navigation. */
@keyframes settingFlash {
    0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
    25% { box-shadow: 0 0 0 3px var(--color-primary); }
    100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.setting-flash {
    animation: settingFlash 1.4s ease;
    border-radius: 0.5rem;
}

@media (prefers-reduced-motion: reduce) {
    #ledm-tooltip { animation: none; }
    .setting-flash {
        animation: none;
        outline: 2px solid var(--color-primary);
        outline-offset: 2px;
    }
}

/* Enhanced Navigation Tab Styles */
.nav-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.25rem;
    border-bottom-width: 2px;
    border-bottom-style: solid;
    border-bottom-color: transparent;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    color: var(--color-text-secondary);
    white-space: nowrap;
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
    cursor: pointer;
    background-color: transparent;
    border-top: none;
    border-left: none;
    border-right: none;
}

.nav-tab i {
    transition: color 0.15s ease;
    margin-right: 0.5rem;
}

/* Inactive state - improved contrast */
.nav-tab:not(.nav-tab-active) {
    color: var(--color-text-secondary);
}

.nav-tab:not(.nav-tab-active) i {
    color: var(--color-text-secondary);
}

/* Hover state - enhanced visibility */
.nav-tab:not(.nav-tab-active):hover {
    color: var(--color-text-primary);
    background-color: var(--color-border-light);
    border-bottom-color: var(--color-border);
}

.nav-tab:not(.nav-tab-active):hover i {
    color: var(--color-text-primary);
}

/* Active state - prominent with gradient background */
.nav-tab-active {
    color: var(--color-primary-hover);
    font-weight: 600;
    border-bottom-width: 3px;
    border-bottom-color: var(--color-primary);
    background: linear-gradient(135deg, rgb(37 99 235 / 10%) 0%, rgb(59 130 246 / 5%) 100%);
    box-shadow: 0 2px 4px rgb(37 99 235 / 10%);
}

.nav-tab-active i {
    color: #1d4ed8; /* text-blue-700 */
}

/* Responsive padding adjustments */
@media (min-width: 1024px) {
    .nav-tab {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

@media (min-width: 1280px) {
    .nav-tab {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* ==========================================================
   Dark Mode - Component Overrides
   ========================================================== */

/* Header */
[data-theme="dark"] header {
    background-color: var(--color-surface);
    border-color: var(--color-border);
}

/* Form controls */
[data-theme="dark"] .form-control:disabled {
    background-color: var(--color-surface);
}

/* Buttons with bg-white */
[data-theme="dark"] button.bg-white {
    background-color: var(--color-border) !important;
    color: var(--color-text-primary) !important;
}

/* Nav tabs */
[data-theme="dark"] .nav-tab:not(.nav-tab-active) {
    color: var(--color-text-secondary);
}

[data-theme="dark"] .nav-tab:not(.nav-tab-active) i {
    color: var(--color-text-secondary);
}

[data-theme="dark"] .nav-tab:not(.nav-tab-active):hover {
    color: var(--color-text-primary);
    background-color: var(--color-border);
    border-bottom-color: #6b7280;
}

[data-theme="dark"] .nav-tab:not(.nav-tab-active):hover i {
    color: var(--color-text-primary);
}

[data-theme="dark"] .nav-tab-active {
    color: #93c5fd;
    border-bottom-color: #3b82f6;
    background: linear-gradient(135deg, rgb(59 130 246 / 15%) 0%, rgb(59 130 246 / 5%) 100%);
}

[data-theme="dark"] .nav-tab-active i {
    color: #93c5fd;
}

/* Section header */
[data-theme="dark"] .section-header {
    background: linear-gradient(135deg, rgb(31 41 55 / 90%) 0%, rgb(17 24 39 / 90%) 100%);
}

/* Status indicators */
[data-theme="dark"] .status-indicator.success {
    background-color: #064e3b;
    color: #6ee7b7;
}

[data-theme="dark"] .status-indicator.error {
    background-color: #7f1d1d;
    color: #fca5a5;
}

[data-theme="dark"] .status-indicator.warning {
    background-color: #78350f;
    color: #fcd34d;
}

/* Skeleton loading */
[data-theme="dark"] .skeleton {
    background-color: var(--color-border);
}

/* Scrollbar */
[data-theme="dark"] ::-webkit-scrollbar-track {
    background: var(--color-surface);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #4b5563;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* Log panel - slightly deeper than surface for contrast */
[data-theme="dark"] #logs-container {
    background-color: #0f1623;
    border-color: var(--color-border);
}

[data-theme="dark"] #logs-display,
[data-theme="dark"] #logs-loading,
[data-theme="dark"] #logs-empty {
    background-color: #0f1623;
}

/* Warning/info boxes used in various partials */
[data-theme="dark"] .bg-yellow-50 { background-color: #422006; }
[data-theme="dark"] .border-yellow-200 { border-color: #78350f; }
[data-theme="dark"] .text-yellow-800 { color: #fcd34d; }
[data-theme="dark"] .text-yellow-700 { color: #fbbf24; }
[data-theme="dark"] .text-yellow-600 { color: #fbbf24; }
[data-theme="dark"] .bg-blue-50 { background-color: #1e3a5f; }
[data-theme="dark"] .border-blue-200 { border-color: #1e40af; }
[data-theme="dark"] .text-blue-800 { color: #93c5fd; }
[data-theme="dark"] .text-blue-700 { color: #93c5fd; }
[data-theme="dark"] .bg-red-50 { background-color: #450a0a; }
[data-theme="dark"] .border-red-200 { border-color: #7f1d1d; }
[data-theme="dark"] .text-red-800 { color: #fca5a5; }
[data-theme="dark"] .text-red-700 { color: #fca5a5; }
[data-theme="dark"] .bg-green-50 { background-color: #022c22; }
[data-theme="dark"] .border-green-200 { border-color: #064e3b; }
[data-theme="dark"] .text-green-800 { color: #6ee7b7; }
[data-theme="dark"] .text-green-700 { color: #6ee7b7; }

/* Dark theme for the generated color utilities */
[data-theme="dark"] .bg-amber-100 { background-color: rgb(245 158 11 / 18%); }
[data-theme="dark"] .bg-amber-50 { background-color: rgb(245 158 11 / 12%); }
[data-theme="dark"] .bg-blue-100 { background-color: rgb(59 130 246 / 18%); }
[data-theme="dark"] .bg-gray-300 { background-color: #4b5563; }
[data-theme="dark"] .bg-gray-400 { background-color: #6b7280; }
[data-theme="dark"] .bg-purple-100 { background-color: rgb(168 85 247 / 18%); }
[data-theme="dark"] .bg-purple-50 { background-color: rgb(168 85 247 / 12%); }
[data-theme="dark"] .border-amber-200 { border-color: rgb(245 158 11 / 40%); }
[data-theme="dark"] .border-amber-300 { border-color: rgb(245 158 11 / 55%); }
[data-theme="dark"] .border-blue-300 { border-color: rgb(59 130 246 / 55%); }
[data-theme="dark"] .border-gray-100 { border-color: var(--color-border); }
[data-theme="dark"] .border-gray-400 { border-color: #6b7280; }
[data-theme="dark"] .border-purple-200 { border-color: rgb(168 85 247 / 40%); }
[data-theme="dark"] .border-red-300 { border-color: rgb(239 68 68 / 55%); }
[data-theme="dark"] .border-yellow-300 { border-color: rgb(234 179 8 / 55%); }
[data-theme="dark"] .divide-gray-100 > :not(:first-child) { border-color: var(--color-border); }
[data-theme="dark"] .divide-gray-200 > :not(:first-child) { border-color: var(--color-border); }
[data-theme="dark"] .text-amber-500 { color: #fbbf24; }
[data-theme="dark"] .text-amber-600 { color: #fcd34d; }
[data-theme="dark"] .text-amber-700 { color: #fcd34d; }
[data-theme="dark"] .text-amber-800 { color: #fcd34d; }
[data-theme="dark"] .text-amber-900 { color: #fcd34d; }
[data-theme="dark"] .text-black { color: var(--color-text-primary); }
[data-theme="dark"] .text-blue-500 { color: #60a5fa; }
[data-theme="dark"] .text-blue-600 { color: #93c5fd; }
[data-theme="dark"] .text-blue-900 { color: #93c5fd; }
[data-theme="dark"] .text-gray-700 { color: var(--color-text-secondary); }
[data-theme="dark"] .text-gray-800 { color: var(--color-text-primary); }
[data-theme="dark"] .text-green-500 { color: #4ade80; }
[data-theme="dark"] .text-green-900 { color: #86efac; }
[data-theme="dark"] .text-purple-600 { color: #d8b4fe; }
[data-theme="dark"] .text-purple-700 { color: #d8b4fe; }
[data-theme="dark"] .text-purple-800 { color: #d8b4fe; }
[data-theme="dark"] .text-red-500 { color: #f87171; }
[data-theme="dark"] .text-red-900 { color: #fca5a5; }
[data-theme="dark"] .text-yellow-500 { color: #facc15; }
[data-theme="dark"] .text-yellow-900 { color: #fde047; }
[data-theme="dark"] .disabled\:bg-gray-400:disabled { background-color: #6b7280; }
[data-theme="dark"] .file\:bg-blue-50::file-selector-button { background-color: rgb(59 130 246 / 12%); }
[data-theme="dark"] .file\:text-blue-700::file-selector-button { color: #93c5fd; }
[data-theme="dark"] .hover\:bg-amber-50:hover { background-color: rgb(245 158 11 / 12%); }
[data-theme="dark"] .hover\:bg-blue-100:hover { background-color: rgb(59 130 246 / 18%); }
[data-theme="dark"] .hover\:bg-blue-50:hover { background-color: rgb(59 130 246 / 12%); }
[data-theme="dark"] .hover\:bg-gray-100:hover { background-color: var(--color-border); }
[data-theme="dark"] .hover\:bg-gray-300:hover { background-color: #4b5563; }
[data-theme="dark"] .hover\:bg-gray-400:hover { background-color: #6b7280; }
[data-theme="dark"] .hover\:bg-red-50:hover { background-color: rgb(239 68 68 / 12%); }
[data-theme="dark"] .hover\:file\:bg-blue-100::file-selector-button:hover { background-color: rgb(59 130 246 / 18%); }
[data-theme="dark"] .hover\:text-blue-600:hover { color: #bfdbfe; }
[data-theme="dark"] .hover\:text-blue-700:hover { color: #bfdbfe; }
[data-theme="dark"] .hover\:text-blue-800:hover { color: #bfdbfe; }
[data-theme="dark"] .hover\:text-gray-600:hover { color: var(--color-text-tertiary); }
[data-theme="dark"] .hover\:text-gray-900:hover { color: var(--color-text-primary); }
[data-theme="dark"] .hover\:text-red-600:hover { color: #fecaca; }
[data-theme="dark"] .hover\:text-red-800:hover { color: #fecaca; }
[data-theme="dark"] .hover\:text-red-900:hover { color: #fecaca; }
[data-theme="dark"] .hover\:text-yellow-700:hover { color: #fef08a; }
[data-theme="dark"] .hover\:text-yellow-800:hover { color: #fef08a; }
[data-theme="dark"] .hover\:text-yellow-900:hover { color: #fef08a; }
[data-theme="dark"] .hover\:text-gray-800:hover { color: var(--color-text-primary); }

/* Theme toggle button */
.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    border: none;
    background: transparent;
    color: #4b5563;
}

.theme-toggle-btn:hover {
    opacity: 0.8;
}

[data-theme="dark"] .theme-toggle-btn {
    color: #fbbf24;
}

/* Update available banner */
.update-banner {
    background-color: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}
.update-banner-action {
    background-color: #3b82f6;
    color: #fff;
}
.update-banner-action:hover {
    background-color: #2563eb;
}
.update-banner-dismiss {
    color: #1e40af;
    opacity: 0.6;
}
.update-banner-dismiss:hover {
    opacity: 1;
}

[data-theme="dark"] .update-banner {
    background-color: #1e293b;
    border-color: #334155;
    color: #93c5fd;
}
[data-theme="dark"] .update-banner-action {
    background-color: #2563eb;
}
[data-theme="dark"] .update-banner-action:hover {
    background-color: #3b82f6;
}
[data-theme="dark"] .update-banner-dismiss {
    color: #93c5fd;
}

/* Installed-plugin "Update" button when a newer version is published.
   A gentle pulsing ring draws the eye without being noisy. */
.plugin-update-available {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.6);
    animation: plugin-update-pulse 2s ease-out infinite;
}
@keyframes plugin-update-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.55); }
    70%  { box-shadow: 0 0 0 6px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}
@media (prefers-reduced-motion: reduce) {
    .plugin-update-available { animation: none; }
}

/* Under-voltage / throttling warning banner */
.power-warning-banner {
    background-color: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}
.power-warning-banner-dismiss {
    color: #991b1b;
    opacity: 0.6;
}
.power-warning-banner-dismiss:hover {
    opacity: 1;
}

[data-theme="dark"] .power-warning-banner {
    background-color: #450a0a;
    border-color: #7f1d1d;
    color: #fca5a5;
}
[data-theme="dark"] .power-warning-banner-dismiss {
    color: #fca5a5;
}

/* ===== Floating live preview (all tabs except Overview) ===== */
.floating-preview {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 70;
    background-color: #111827;
    border: 1px solid #374151;
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    /* Desktop: draggable resize handle (bottom-left visually, since the
       panel is anchored to the right). Touch devices use the size button. */
    resize: both;
    min-width: 160px;
    max-width: 90vw;
}
.floating-preview img {
    background-color: #000;
}
.floating-preview-toggle {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 70;
    width: 44px;
    height: 44px;
    border-radius: 9999px;
    background-color: var(--color-primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    align-items: center;
    justify-content: center;
}
@media (max-width: 640px) {
    /* Whatever size is chosen, never wider than the phone viewport */
    .floating-preview {
        max-width: calc(100vw - 2rem);
    }
}

/* ---- Style editor widget -------------------------------------------- */
/* One row per display element: label, font, size, colour, X, Y. The grid
   is declared once here so the header and the rows cannot drift apart. */
/* The plugin config panel is narrower than nine columns of controls, and a
   clipped table hides the offsets entirely -- scroll the table rather than
   crushing the controls or dropping columns. */
.style-editor {
    overflow-x: auto;
}
.style-editor-table {
    min-width: max-content;
}
/* Scrolled right, the element names would otherwise scroll away and the
   row you are editing becomes anonymous. */
.style-editor-label,
.style-editor-head > :first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background-color: var(--color-surface, #ffffff);
}
.style-editor-head > :first-child {
    background-color: var(--color-background, #f9fafb);
}
.style-editor-row {
    /* Set by the widget: the column count depends on what the plugin
       declares, so the track list cannot be fixed here. */
    grid-template-columns: var(--style-editor-columns,
        minmax(7rem, 1.4fr) minmax(8rem, 2fr) 5rem 4.5rem 5rem 5rem);
}
.style-editor-check {
    width: 1rem;
    height: 1rem;
}
.style-editor-row .form-control {
    padding: 0.2rem 0.4rem;
    height: auto;
}
.style-editor-row input[type="number"] {
    width: 100%;
}
.style-editor-row input[type="number"]:disabled {
    background-color: var(--color-border-light, #f3f4f6);
    color: var(--color-text-tertiary, #9ca3af);
    cursor: not-allowed;
}
.style-editor-colour {
    width: 2rem;
    height: 1.6rem;
    padding: 0;
    border: 1px solid var(--color-field-border, #d1d5db);
    border-radius: 0.25rem;
    background: none;
    cursor: pointer;
}
.style-editor-tab {
    border: 1px solid var(--color-field-border, #d1d5db);
    background-color: var(--color-background, #f9fafb);
    color: var(--color-text-secondary, #374151);
}
.style-editor-tab.is-active {
    background-color: var(--color-primary, #2563eb);
    border-color: var(--color-primary, #2563eb);
    color: #ffffff;
}
.style-editor-panel[hidden] {
    display: none;
}
@media (max-width: 768px) {
    /* Stack rather than squeeze: six columns on a phone is unreadable. */
    .style-editor-row {
        grid-template-columns: 1fr 1fr;
    }
    .style-editor-head {
        display: none;
    }
    .style-editor-label {
        grid-column: 1 / -1;
        font-weight: 600;
    }
}

/* A label wrapping a visually hidden file input shows the input's focus. */
.file-trigger:focus-within {
    outline: 2px solid var(--color-focus-ring);
    outline-offset: 2px;
}

/* Dark theme: native fields that no component or utility styles would
   otherwise keep the browser's white surface. */
[data-theme="dark"] :where(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"]), select, textarea) {
    background-color: var(--color-field-bg);
    color: var(--color-text-primary);
    border-color: var(--color-field-border);
}

[data-theme="dark"] ::placeholder {
    color: #9ca3af;
}

/* Range tracks and native controls follow the theme accent instead of the
   browser's default light chrome. */
input[type="range"],
input[type="checkbox"],
input[type="radio"],
progress {
    accent-color: var(--color-primary);
}

/* ===== Guards that must stay at the end of the file ===== */

/* `.hidden` has to beat component classes that set their own display. */
.btn.hidden,
.badge.hidden,
.status-indicator.hidden,
.help-tip.hidden,
.nav-tab.hidden,
.theme-toggle-btn.hidden {
    display: none;
}

@media (min-width: 768px) {
    /* .theme-toggle-btn (display: inline-flex) is declared after md:hidden,
       which left the mobile menu button visible on desktop. */
    .theme-toggle-btn.md\:hidden {
        display: none;
    }
}

/* Touch screens: controls in the page content get a 44px target. Switches
   and inline help triggers keep their drawn size. */
@media (pointer: coarse) {
    #tab-content button:not([role="switch"], .help-tip),
    #tab-content a.inline-flex,
    #tab-content select,
    #tab-content input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], .sr-only) {
        min-height: 44px;
    }
}

/* Reduced motion: no entrances, slides, pulses or smooth scrolling.
   Spinners keep turning, slowly, because they are the only busy signal. */
@media (prefers-reduced-motion: reduce) {
    html,
    #logs-container {
        scroll-behavior: auto;
    }
    *,
    ::before,
    ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .fa-spin,
    .fa-spinner,
    .animate-spin,
    .jfm-spin,
    .spinner {
        animation-duration: 1.5s !important;
        animation-iteration-count: infinite !important;
    }
    .card:hover,
    .plugin-card:hover,
    .btn:hover {
        transform: none;
    }
}