/**
 * Common Styles for Azure Latency Checker
 * Shared across all pages for consistency
 */

:root {
    color-scheme: light;
    /* Status Colors */
    --color-excellent: #48bb78;
    --color-good: #4299e1;
    --color-warning: #ed8936;
    --color-poor: #f56565;
    --color-critical: #c53030;
    --color-unknown: #a0aec0;
    --color-info: #667eea;
    
    /* Semantic Colors */
    --color-primary: #667eea;
    --color-secondary: #764ba2;
    --color-success: #48bb78;
    --color-danger: #f56565;
    
    /* Neutral Colors */
    --color-gray-50: #f7fafc;
    --color-gray-100: #edf2f7;
    --color-gray-200: #e2e8f0;
    --color-gray-300: #cbd5e0;
    --color-gray-400: #a0aec0;
    --color-gray-500: #718096;
    --color-gray-600: #4a5568;
    --color-gray-700: #2d3748;
    --color-gray-800: #1a202c;
    --color-gray-900: #171923;
    
    /* Spacing */
    --spacing-1: 0.25rem;
    --spacing-2: 0.5rem;
    --spacing-3: 0.75rem;
    --spacing-4: 1rem;
    --spacing-5: 1.25rem;
    --spacing-6: 1.5rem;
    --spacing-8: 2rem;
    
    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    /* Layout */
    --sidebar-width: 250px;
    --border-radius: 0.5rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: var(--color-gray-100);
    color: var(--color-gray-800);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: #1e3a5f;
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1001;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: var(--spacing-6);
    border-bottom: 2px solid rgba(255, 255, 255, 0.15);
    text-align: center;
    margin-bottom: var(--spacing-4);
}

.sidebar-logo {
    width: 120px;
    height: 120px;
    margin: 0 auto var(--spacing-4);
    transition: all 0.3s ease;
    cursor: pointer;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
}

.sidebar-logo:hover {
    transform: scale(1.1) rotate(5deg);
    filter: drop-shadow(0 4px 12px rgba(102, 126, 234, 0.6));
}

.sidebar-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0;
}

.sidebar-subtitle {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: var(--spacing-1);
}

.sidebar-menu {
    flex: 1;
    padding: var(--spacing-4) 0;
}

.sidebar-footer {
    padding: var(--spacing-4) var(--spacing-6);
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-3);
}

/* Footer info boxes (sidebar) — distinct colours + the jcoulterdesign "Fizzy
   button" hover: on hover the box fills with its accent colour, lifts, and
   colourful particles fizz upward out of it. Particles are injected by
   sidebar.js. (Adapted from codepen.io/jcoulterdesign Fizzy CSS Button.)
   No overflow:hidden — the particles need to escape the box. */
.version-info,
.build-info,
.developer-info {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-2);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.95);
    border: 2px solid transparent;
    cursor: default;
    transition: background 0.3s ease, color 0.3s ease, box-shadow 0.25s ease, transform 0.2s ease, border-color 0.3s ease;
}
.version-info > *,
.build-info > *,
.developer-info > * {
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}
.version-info:hover,
.build-info:hover,
.developer-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 22px -12px rgba(0, 0, 0, 0.6);
    color: #fff;
}
.version-info:hover > *,
.build-info:hover > *,
.developer-info:hover > * {
    transform: translateX(3px);
}

.version-info,
.build-info {
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

/* Version — light blue */
.version-info { background: rgba(56, 189, 248, 0.16); border-color: rgba(56, 189, 248, 0.6); }
.version-info:hover { background: #0ea5e9; border-color: #0ea5e9; }

/* The version box is a link to the changelog page — keep the footer's white
   text (override the UA link colour) and signal it's clickable. */
a.version-info,
a.version-info:link,
a.version-info:visited { color: rgba(255, 255, 255, 0.95); text-decoration: none; cursor: pointer; }
a.version-info:hover { color: #fff; }
.version-chevron { opacity: 0.55; margin-left: 4px; transition: opacity 0.2s ease, transform 0.2s ease; }
a.version-info:hover .version-chevron { opacity: 1; transform: translateX(2px); }

/* Build date — gray */
.build-info { background: rgba(148, 163, 184, 0.16); border-color: rgba(148, 163, 184, 0.55); }
.build-info:hover { background: #64748b; border-color: #64748b; }

/* Developer — purple */
.developer-info {
    flex-direction: row;
    gap: 5px;
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1.4;
    background: rgba(167, 139, 250, 0.18);
    border-color: rgba(167, 139, 250, 0.65);
}
.developer-info:hover { background: #8b5cf6; border-color: #8b5cf6; }
.developer-info a { transition: color 0.2s ease; }
.developer-info:hover a { color: #fff; }

/* Fizzy particles — invisible at rest, spew upward/outward on hover */
.fizz-wrap { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.fizz {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.3);
}
.version-info:hover .fizz,
.build-info:hover .fizz,
.developer-info:hover .fizz {
    animation: fizz var(--dur, 1s) ease-out infinite;
    animation-delay: var(--delay, 0s);
}
@keyframes fizz {
    0% { transform: translate(0, 0) scale(0.35); opacity: 0; }
    25% { opacity: 0.9; }
    100% { transform: translate(var(--tx, 0), var(--ty, -32px)) scale(1.05); opacity: 0; }
}

/* ============================================================
   Kinetic CSS loaders — adapted from codepen.io/jenning/pen/LYWJdWz.
   Tuned for light card backgrounds (brand-coloured dots + a light track) at a
   fixed default size. Usage: <span class="loader loader--3"></span>
   (add `loader--on-dark` on dark backgrounds). Includes the flat loaders
   1/2/3/7/9, which read well at small sizes; the app uses loader--3 by default.
   ============================================================ */
.loader {
    --block-size: 108px;
    --loader-size: calc(var(--block-size) / 2);
    --loader-size-half: calc(var(--loader-size) / 2);
    --loader-size-half-neg: calc(var(--loader-size-half) * -1);
    --light-color: rgba(102, 126, 234, 0.25);
    --dot-size: 5px;
    --dot-size-half: calc(var(--dot-size) / 2);
    --dot-size-half-neg: calc(var(--dot-size-half) * -1);
    position: relative;
    display: grid;
    place-items: center;
    width: var(--loader-size);
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
    color: var(--color-primary);
}
.loader::before,
.loader::after { content: ''; position: absolute; }

/* dark-background variant (e.g. the Connectivity Signals panel) */
.loader--on-dark { color: #fff; --light-color: rgba(255, 255, 255, 0.35); }

/* loader--1 — dots tracing a square */
.loader--1 {
    --loader-size: calc(var(--block-size) / 3);
    --anim-duration: 1s;
    --loader-1-dist: calc(var(--loader-size) - var(--dot-size-half) + 1px);
    aspect-ratio: 1 / 1;
    border: 1px solid var(--light-color);
}
.loader--1::before,
.loader--1::after {
    width: var(--dot-size);
    aspect-ratio: 1 / 1;
    background: currentColor;
    border-radius: 50%;
    top: var(--dot-size-half-neg);
    left: var(--dot-size-half-neg);
    animation: loader-1 var(--anim-duration) cubic-bezier(0.27, 0.08, 0.26, 0.7) infinite;
}
.loader--1::after { animation-delay: calc(var(--anim-duration) / 4 * -1); }
@keyframes loader-1 {
    0%, 100% { transform: none; }
    25% { transform: translateX(var(--loader-1-dist)); }
    50% { transform: translateX(var(--loader-1-dist)) translateY(var(--loader-1-dist)); }
    75% { transform: translateX(0) translateY(var(--loader-1-dist)); }
}

/* loader--2 — dots bouncing along a line */
.loader--2 {
    --loader-size: calc(var(--block-size) / 3);
    --anim-duration: 1s;
    height: 1px;
    background-color: var(--light-color);
}
.loader--2::before,
.loader--2::after {
    width: var(--dot-size);
    aspect-ratio: 1 / 1;
    background: currentColor;
    border-radius: 50%;
    top: calc(var(--dot-size-half-neg) + 1px);
    left: var(--dot-size-half-neg);
    animation: loader-2 var(--anim-duration) cubic-bezier(0.27, 0.08, 0.26, 0.7) infinite;
}
.loader--2::after { animation-delay: calc(var(--anim-duration) / 3 * -1); }
@keyframes loader-2 {
    0%, 100% { transform: none; }
    44% { transform: translateX(calc(var(--loader-size) + var(--dot-size-half))); }
}

/* loader--3 — ring with orbiting dots (app default) */
.loader--3 {
    --loader-size: calc(var(--block-size) / 3);
    --anim-duration: 1.2s;
    aspect-ratio: 1 / 1;
    border: 1px solid var(--light-color);
    border-radius: 50%;
    animation: loader-3 calc(var(--anim-duration) * 3) linear infinite;
}
.loader--3::before,
.loader--3::after {
    width: var(--dot-size);
    aspect-ratio: 1 / 1;
    background: currentColor;
    border-radius: 50%;
    top: var(--dot-size-half-neg);
    left: calc(50% - var(--dot-size-half));
    animation: loader-3 var(--anim-duration) cubic-bezier(0.27, 0.08, 0.26, 0.7) infinite;
    transform-origin: center calc(var(--loader-size-half) + var(--dot-size-half) - 1px);
}
.loader--3::after { animation-delay: calc(var(--anim-duration) / 3 * -1); }
@keyframes loader-3 { 100% { transform: rotate(1turn); } }

/* loader--7 — rotating ring with crossing dots */
.loader--7 {
    --loader-size: calc(var(--block-size) / 3);
    --anim-duration: 0.8s;
    aspect-ratio: 1 / 1;
    border: 1px solid var(--light-color);
    border-radius: 50%;
    animation: loader-7 calc(var(--anim-duration) * 2) linear infinite;
}
.loader--7::before,
.loader--7::after {
    width: var(--dot-size);
    aspect-ratio: 1 / 1;
    background: currentColor;
    border-radius: 50%;
    top: calc(50% - var(--dot-size-half));
    left: calc(50% - var(--dot-size-half));
    animation: loader-7-1 var(--anim-duration) cubic-bezier(0.32, 0.41, 0.3, 1.87) infinite;
}
.loader--7::after { animation-name: loader-7-2; animation-delay: calc(var(--anim-duration) / 3 * -1); }
@keyframes loader-7 { 100% { transform: rotate(1turn); } }
@keyframes loader-7-1 {
    0%, 100% { transform: translateX(var(--loader-size-half-neg)); }
    55% { transform: translateX(var(--loader-size-half)); }
}
@keyframes loader-7-2 {
    0%, 100% { transform: translateY(var(--loader-size-half-neg)); }
    55% { transform: translateY(var(--loader-size-half)); }
}

/* loader--9 — glowing core with orbiting dots */
.loader--9 {
    --loader-size: calc(var(--block-size) / 6);
    --anim-duration: 0.6s;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background-color: currentColor;
    box-shadow: 0 0 var(--loader-size) var(--light-color);
    animation: loader-9 calc(var(--anim-duration) * 6) linear infinite;
}
.loader--9::before,
.loader--9::after {
    width: var(--dot-size);
    aspect-ratio: 1 / 1;
    background: currentColor;
    border-radius: 50%;
    animation: loader-9-1 var(--anim-duration) cubic-bezier(0.27, 0.08, 0.26, 0.7) infinite;
}
.loader--9::before {
    --x-dist: 0;
    --y-dist: var(--loader-size-half);
    bottom: calc(100% + var(--loader-size));
    left: calc(50% - var(--dot-size-half));
    transform-origin: center var(--loader-size);
}
.loader--9::after {
    --x-dist: var(--loader-size-half);
    --y-dist: 0;
    top: calc(50% - var(--dot-size-half));
    right: calc(100% + var(--loader-size));
    transform-origin: var(--loader-size) center;
    animation-delay: calc(var(--anim-duration) / 2 * -1);
}
@keyframes loader-9 { 100% { transform: rotate(1turn); } }
@keyframes loader-9-1 {
    0%, 100% { opacity: 0; }
    33% { opacity: 1; }
    0% { transform: scale(1.1); }
    88% { transform: rotate(180deg) translate(var(--x-dist), var(--y-dist)); }
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: var(--spacing-2);
    letter-spacing: 0.5px;
}

.sidebar-subtitle {
    font-size: 0.875rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    padding: var(--spacing-3) var(--spacing-4);
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    border-radius: 8px;
    margin: 0 var(--spacing-2);
    position: relative;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(4px);
}

.menu-item.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: linear-gradient(180deg, #667eea, #764ba2);
    border-radius: 0 2px 2px 0;
}

.menu-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.menu-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    transition: all 0.3s ease;
}

.menu-item:hover .menu-icon svg {
    transform: scale(1.1);
}

.menu-item.active .menu-icon svg {
    fill: #667eea;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    /* Breathing room so page content isn't glued to the fixed sidebar.
       (The dashboard opts out via an inline padding:0 — it has its own layout.) */
    padding: var(--spacing-6) var(--spacing-8);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Mobile Sidebar Toggle */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: var(--spacing-4);
    left: var(--spacing-4);
    z-index: 1002;
    background: #1e3a5f;
    color: white;
    border: none;
    padding: var(--spacing-2) var(--spacing-3);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.25rem;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .main-content {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: block;
    }
}

/* Card — soft gradient surface, gentle border + shadow, smooth hover lift
   (matches the elegance of the "Your Connection" holographic cards). */
.card {
    background: linear-gradient(160deg, #ffffff 0%, #f7f9fc 100%);
    border: 1px solid var(--color-gray-200);
    border-radius: 14px;
    padding: var(--spacing-6);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 10px 24px -14px rgba(16, 24, 40, 0.18);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 18px 34px -16px rgba(16, 24, 40, 0.28);
    border-color: rgba(102, 126, 234, 0.4);
}

/* Vertical spacing between stacked cards (Settings / About, where cards are
   direct children of .main-content). Grid-based pages use `gap`, so the
   dashboard and others are unaffected. */
.main-content > .card {
    margin-bottom: var(--spacing-6);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-4);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-gray-800);
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--color-gray-500);
    margin-top: var(--spacing-1);
}

/* Buttons */
.btn {
    padding: var(--spacing-2) var(--spacing-4);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: var(--color-gray-200);
    color: var(--color-gray-700);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Loading */
.loading {
    color: var(--color-gray-400);
    font-style: italic;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.loading::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    border-top-color: var(--color-primary);
    animation: spin 0.8s linear infinite;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    border-top-color: var(--color-primary);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Page Layout */
.page-header {
    margin-bottom: var(--spacing-8);
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--spacing-2);
    color: var(--color-gray-800);
}

.page-subtitle {
    color: var(--color-gray-500);
    font-size: 1rem;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-4);
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
}

.info-label {
    color: var(--color-gray-500);
    font-size: 0.875rem;
    font-weight: 500;
}

.info-value {
    color: var(--color-gray-800);
    font-size: 1.125rem;
    font-weight: 600;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
}

.badge-current {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.badge-recent {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.badge-outdated {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.badge-very-outdated {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.badge-never-synced {
    background: rgba(100, 116, 139, 0.2);
    color: #64748b;
}

/* Forms */
.form-group {
    margin-bottom: var(--spacing-6);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-2);
    font-weight: 600;
    color: var(--color-gray-800);
}

.form-input {
    width: 100%;
    padding: var(--spacing-3) var(--spacing-4);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: var(--font-family);
    transition: all 0.2s;
    background: white;
    color: var(--color-gray-800);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Alerts */
.alert {
    padding: var(--spacing-4);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-4);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #f59e0b;
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

/* Sync Status */
.sync-status {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    padding: var(--spacing-4);
    background: rgba(59, 130, 246, 0.1);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--color-info);
    margin-top: var(--spacing-4);
}

.sync-status.syncing {
    background: rgba(245, 158, 11, 0.1);
    border-left-color: var(--color-warning);
}

.sync-status.success {
    background: rgba(16, 185, 129, 0.1);
    border-left-color: var(--color-success);
}

.sync-status.error {
    background: rgba(239, 68, 68, 0.1);
    border-left-color: var(--color-danger);
}

/* Feature List (for About page) */
.feature-list {
    list-style: none;
    padding: 0;
}

.feature-list li {
    padding: var(--spacing-3);
    margin-bottom: var(--spacing-2);
    background: var(--color-gray-50);
    border-left: 4px solid var(--color-primary);
    border-radius: 4px;
}

.feature-list li strong {
    color: var(--color-primary);
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: var(--spacing-4);
}

.mb-4 {
    margin-bottom: var(--spacing-4);
}

.mb-6 {
    margin-bottom: var(--spacing-6);
}

.p-4 {
    padding: var(--spacing-4);
}

/* Made with Bob */

/* Quick Links Styles */
.quick-link-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-2);
    padding: var(--spacing-4);
    background: white;
    border: 1px solid var(--color-gray-200);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.quick-link-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--color-primary);
}

.quick-link-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
}

.quick-link-item:hover .quick-link-icon {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.quick-link-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-gray-700);
    text-align: center;
    line-height: 1.2;
}

.quick-link-item:hover .quick-link-label {
    color: var(--color-primary);
}

/* Quick Links Compact Styles */
.quick-link-compact {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    background: transparent;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.quick-link-compact:hover {
    background: var(--color-gray-50);
}

.quick-link-icon-small {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    transition: all 0.2s ease;
}

.quick-link-compact:hover .quick-link-icon-small {
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.quick-link-compact span {
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--color-gray-600);
    text-align: center;
    line-height: 1.2;
}

.quick-link-compact:hover span {
    color: var(--color-primary);
}

/* ============================================================
   Dark theme — toggled via <html data-theme="dark"> by the floating
   button injected in sidebar.js (persisted in localStorage).
   Implemented by inverting the neutral ramp (so text/background vars flip)
   plus a few literal-white surfaces. Brand/status colours are kept.
   ============================================================ */
html[data-theme="dark"] {
    color-scheme: dark;
    --color-gray-50:  #0b1220;
    --color-gray-100: #0f172a;
    --color-gray-200: #1e293b;
    --color-gray-300: #334155;
    --color-gray-400: #475569;
    --color-gray-500: #94a3b8;
    --color-gray-600: #cbd5e1;
    --color-gray-700: #e2e8f0;
    --color-gray-800: #f1f5f9;
    --color-gray-900: #f8fafc;
}
html[data-theme="dark"] .card { background: linear-gradient(160deg, #18243a 0%, #111a2b 100%); border-color: var(--color-gray-200); }
html[data-theme="dark"] .card:hover { border-color: rgba(129, 140, 248, 0.5); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 18px 34px -16px rgba(0, 0, 0, 0.55); }
html[data-theme="dark"] .form-input { background: #0f172a; color: var(--color-gray-800); border-color: var(--color-gray-300); }
html[data-theme="dark"] .btn-secondary { background: var(--color-gray-200); color: var(--color-gray-800); }
html[data-theme="dark"] .info-item { color: var(--color-gray-800); }

/* Floating light/dark toggle — the "sparkle button" (adapted from a CodePen),
   fixed in the right corner. EVERY selector is scoped under .theme-fab and the
   keyframes are namespaced so the example's bare button/svg/.text/.particle rules
   can't leak into the rest of the app. */
.theme-fab {
    --transition: 0.25s;
    --spark: 1.8s;
    position: fixed;
    top: 14px;
    right: 18px;
    z-index: 1100;
}
/* When dropped into the command bar (dashboard), it flows inline instead of
   floating — so it never overlaps the fixed Connectivity Signals panel. */
.theme-fab--inline {
    position: relative;
    top: auto;
    right: auto;
    z-index: 0;
}
.theme-fab button {
    --cut: 0.1em;
    --active: 0;
    --bg:
        radial-gradient(40% 50% at center 100%, hsl(270 calc(var(--active) * 97%) 72% / var(--active)), transparent),
        radial-gradient(80% 100% at center 120%, hsl(260 calc(var(--active) * 97%) 70% / var(--active)), transparent),
        hsl(260 calc(var(--active) * 97%) calc((var(--active) * 44%) + 12%));
    background: var(--bg);
    font-size: 0.9rem;
    font-weight: 500;
    border: 0;
    cursor: pointer;
    padding: 0.5em 0.9em;
    display: flex;
    align-items: center;
    gap: 0.25em;
    white-space: nowrap;
    border-radius: 100px;
    position: relative;
    box-shadow:
        /* Discreet hover glow — toned down from the original 6em/3em/0.75 bloom. */
        0 0 calc(var(--active) * 1.8em) calc(var(--active) * 0.35em) hsl(260 97% 61% / 0.3),
        0 0.05em 0 0 hsl(260 calc(var(--active) * 97%) calc((var(--active) * 50%) + 30%)) inset,
        0 -0.05em 0 0 hsl(260 calc(var(--active) * 97%) calc(var(--active) * 60%)) inset;
    transition: box-shadow var(--transition), scale var(--transition), background var(--transition);
    scale: calc(1 + (var(--active) * 0.05));
}
.theme-fab button:active { scale: 1; }
/* Dark interface: the toggle reads "Light" and is a WHITE pill (so it stands out
   on the dark UI) with dark label + sparkle. The visible fill is the .backdrop,
   so override both it and the button. Hover still plays the purple sparkle. */
html[data-theme="dark"] .theme-fab button,
html[data-theme="dark"] .theme-fab .backdrop { background: #ffffff; }
html[data-theme="dark"] .theme-fab .text { -webkit-text-fill-color: #0f172a; color: #0f172a; }
html[data-theme="dark"] .theme-fab .sparkle path { color: #0f172a !important; }
html[data-theme="dark"] .theme-fab button:is(:hover, :focus-visible),
html[data-theme="dark"] .theme-fab button:is(:hover, :focus-visible) .backdrop { background: var(--bg); }
html[data-theme="dark"] .theme-fab button:is(:hover, :focus-visible) .text { -webkit-text-fill-color: #fff; color: #fff; }
html[data-theme="dark"] .theme-fab button:is(:hover, :focus-visible) .sparkle path { color: #fff !important; }
.theme-fab svg { overflow: visible !important; }
.theme-fab .sparkle path {
    color: hsl(0 0% calc((var(--active, 0) * 70%) + var(--base)));
    transform-box: fill-box;
    transform-origin: center;
    fill: currentColor;
    stroke: currentColor;
    animation-delay: calc((var(--transition) * 1.5) + (var(--delay) * 1s));
    animation-duration: 0.6s;
    transition: color var(--transition);
}
.theme-fab button:is(:hover, :focus-visible) path { animation-name: theme-fab-bounce; }
@keyframes theme-fab-bounce { 35%, 65% { scale: var(--scale); } }
.theme-fab .sparkle path:nth-of-type(1) { --scale: 0.5; --delay: 0.1; --base: 40%; }
.theme-fab .sparkle path:nth-of-type(2) { --scale: 1.5; --delay: 0.2; --base: 20%; }
.theme-fab .sparkle path:nth-of-type(3) { --scale: 2.5; --delay: 0.35; --base: 30%; }
.theme-fab button:before {
    content: "";
    position: absolute;
    inset: -0.25em;
    z-index: -1;
    border: 0.25em solid hsl(260 97% 50% / 0.5);
    border-radius: 100px;
    opacity: var(--active, 0);
    transition: opacity var(--transition);
}
.theme-fab .spark {
    position: absolute;
    inset: 0;
    border-radius: 100px;
    rotate: 0deg;
    overflow: hidden;
    -webkit-mask: linear-gradient(white, transparent 50%);
    mask: linear-gradient(white, transparent 50%);
    animation: theme-fab-flip calc(var(--spark) * 2) infinite steps(2, end);
}
@keyframes theme-fab-flip { to { rotate: 360deg; } }
.theme-fab .spark:before {
    content: "";
    position: absolute;
    width: 200%;
    aspect-ratio: 1;
    top: 0%;
    left: 50%;
    z-index: -1;
    translate: -50% -15%;
    rotate: 0;
    transform: rotate(-90deg);
    opacity: calc((var(--active)) + 0.4);
    background: conic-gradient(from 0deg, transparent 0 340deg, white 360deg);
    transition: opacity var(--transition);
    animation: theme-fab-rotate var(--spark) linear infinite both;
}
.theme-fab .spark:after { content: ""; position: absolute; inset: var(--cut); border-radius: 100px; }
.theme-fab .backdrop { position: absolute; inset: var(--cut); background: var(--bg); border-radius: 100px; transition: background var(--transition); }
@keyframes theme-fab-rotate { to { transform: rotate(90deg); } }
.theme-fab button:is(:hover, :focus-visible) { --active: 1; --play-state: running; }
.theme-fab button:is(:hover, :focus-visible) ~ .particle-pen { --active: 1; --play-state: running; }
.theme-fab .particle-pen {
    position: absolute;
    width: 150%;
    aspect-ratio: 1;
    top: 50%;
    left: 50%;
    translate: -50% -50%;
    -webkit-mask: radial-gradient(white, transparent 65%);
    mask: radial-gradient(white, transparent 65%);
    z-index: -1;
    opacity: var(--active, 0);
    transition: opacity var(--transition);
    pointer-events: none;
}
.theme-fab .particle {
    fill: white;
    width: calc(var(--size, 0.25) * 1rem);
    aspect-ratio: 1;
    position: absolute;
    top: calc(var(--y) * 1%);
    left: calc(var(--x) * 1%);
    opacity: var(--alpha, 1);
    animation: theme-fab-float-out calc(var(--duration, 1) * 1s) calc(var(--delay) * -1s) infinite linear;
    transform-origin: var(--origin-x, 1000%) var(--origin-y, 1000%);
    z-index: -1;
    animation-play-state: var(--play-state, paused);
}
.theme-fab .particle path { fill: hsl(0 0% 90%); stroke: none; }
.theme-fab .particle:nth-of-type(even) { animation-direction: reverse; }
@keyframes theme-fab-float-out { to { rotate: 360deg; } }
.theme-fab .text {
    translate: 2% -6%;
    letter-spacing: 0.01ch;
    background: linear-gradient(90deg, hsl(0 0% calc((var(--active) * 100%) + 65%)), hsl(0 0% calc((var(--active) * 100%) + 26%)));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    transition: background var(--transition);
}
.theme-fab button svg { inline-size: 1.25em; translate: -25% -5%; }
@media (prefers-reduced-motion: reduce) {
    .theme-fab .spark,
    .theme-fab .spark:before,
    .theme-fab .particle,
    .theme-fab .sparkle path { animation: none !important; }
}

/* ============================================================
   Sidebar brand — uppercase title with a glitch (RGB-split) effect on hover,
   sized to fit the 250px sidebar. Subtitle becomes a small stylized tag.
   (Appended last so it wins over the earlier .sidebar-title rules.)
   ============================================================ */
.sidebar-title {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    line-height: 1.25;
    margin: 0 0 var(--spacing-3);
    overflow-wrap: break-word;
}
.sidebar-title.glitch {
    position: relative;
    color: #fff;
    cursor: default;
}
.sidebar-title.glitch::before,
.sidebar-title.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background: #1e3a5f;            /* matches the sidebar so slices blend */
    overflow: hidden;
    clip: rect(0, 0, 0, 0);         /* hidden until hover */
    pointer-events: none;
}
.sidebar-title.glitch::before { left: -1px; text-shadow: 1px 0 rgba(255, 0, 0, 0.7); }
.sidebar-title.glitch::after  { left: 1px;  text-shadow: -1px 0 rgba(0, 153, 255, 0.7); }
.sidebar-title.glitch:hover::before {
    text-shadow: 3px 0 rgba(255, 0, 0, 0.85);
    animation: sidebar-glitch-1 0.8s infinite ease-in-out alternate-reverse;
}
.sidebar-title.glitch:hover::after {
    text-shadow: -3px 0 rgba(0, 153, 255, 0.85);
    animation: sidebar-glitch-2 0.8s infinite ease-in-out alternate-reverse;
}
@keyframes sidebar-glitch-1 {
    0%   { clip: rect(2px, 9999px, 8px, 0); }
    25%  { clip: rect(10px, 9999px, 28px, 0); }
    50%  { clip: rect(4px, 9999px, 16px, 0); }
    75%  { clip: rect(20px, 9999px, 36px, 0); }
    100% { clip: rect(12px, 9999px, 42px, 0); }
}
@keyframes sidebar-glitch-2 {
    0%   { top: -1px; left: 1px;  clip: rect(14px, 9999px, 30px, 0); }
    25%  { top: -3px; left: 3px;  clip: rect(26px, 9999px, 40px, 0); }
    50%  { top: -2px; left: 2px;  clip: rect(6px, 9999px, 20px, 0); }
    75%  { top: 0;    left: -2px; clip: rect(30px, 9999px, 44px, 0); }
    100% { top: -1px; left: -1px; clip: rect(18px, 9999px, 34px, 0); }
}
@media (prefers-reduced-motion: reduce) {
    .sidebar-title.glitch:hover::before,
    .sidebar-title.glitch:hover::after { animation: none; }
}

/* Stylized subtitle tag */
.sidebar-subtitle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-top: 0;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    white-space: nowrap;
    color: #bae6fd;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.35);
    opacity: 1;
}
