/*
 * STYLES.CSS - 2025 Canadian Election Map Visualization
 * Adapted from example-primitive-map design system
 */

/* ============================================================================
   LOCK SCREEN STYLES
   ============================================================================ */

.lock-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1d21 0%, #2b3036 50%, #1a1d21 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.lock-screen.unlocking {
    opacity: 0;
    transform: scale(1.05);
}

.lock-screen.hidden {
    display: none;
}

.lock-container {
    text-align: center;
    padding: 3rem;
    max-width: 420px;
    width: 90%;
}

.lock-logo {
    margin-bottom: 2rem;
}

.lock-logo-image {
    width: 80px;
    height: auto;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.lock-title {
    font-family: 'Manrope', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.lock-subtitle {
    font-size: 0.9rem;
    color: #8893a0;
    margin-bottom: 2.5rem;
    font-weight: 500;
}

.lock-form {
    margin-bottom: 2rem;
}

.lock-input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.lock-input-wrapper:focus-within {
    border-color: #2563EB;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.lock-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    color: #ffffff;
    font-family: 'Manrope', sans-serif;
    outline: none;
}

.lock-input::placeholder {
    color: #8893a0;
}

.lock-input.error {
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

.lock-submit {
    background: #2563EB;
    border: none;
    padding: 1rem 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #ffffff;
}

.lock-submit:hover {
    background: #1d4ed8;
}

.lock-submit:active {
    transform: scale(0.95);
}

.lock-submit.loading {
    opacity: 0.7;
    cursor: wait;
}

.lock-submit svg {
    transition: transform 0.2s ease;
}

.lock-submit:hover svg {
    transform: translateX(2px);
}

.lock-error {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 1rem;
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.2s ease;
    min-height: 1.25rem;
}

.lock-error.visible {
    opacity: 1;
    transform: translateY(0);
}

.lock-footer {
    font-size: 0.75rem;
    color: #5a646f;
    margin-top: 3rem;
}

/* App Content (hidden until unlocked) */
.app-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0; /* Allow flex shrinking */
    height: 100vh;
}

.app-content.hidden {
    display: none !important;
}

.app-content.unlocked {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================================================
   MAIN STYLES
   ============================================================================ */

:root {
    /* Cool Grey Palette */
    --grey-900: #1a1d21;
    --grey-800: #2b3036;
    --grey-700: #3a4149;
    --grey-600: #5a646f;
    --grey-500: #8893a0;
    --grey-400: #aeb8c4;
    --grey-300: #cdd4db;
    --grey-200: #e4e8ec;
    --grey-100: #f0f3f6;
    --grey-50: #f9faff;
    --white: #ffffff;

    /* Accent Palette (Conservative Blue) */
    --accent-700: #1d4ed8;
    --accent-600: #2563eb;
    --accent-500: #3b82f6;
    --accent-200: #bfdbfe;
    --accent-100: #dbeafe;
    --accent-50: #eff6ff;

    /* Party Colors */
    --liberal-color: #DC2626;
    --conservative-color: #2563EB;
    --ndp-color: #F97316;
    --bloc-color: #06B6D4;
    --green-color: #16A34A;
    --ppc-color: #7C3AED;

    /* Semantic Colors */
    --red-500: #ef4444;
    --yellow-500: #eab308;
    --green-600: #059669;

    /* Core Variables */
    --bg-primary: var(--white);
    --bg-secondary: var(--grey-100);
    --bg-tertiary: var(--grey-50);

    --text-primary: var(--grey-800);
    --text-secondary: var(--grey-600);
    --text-muted: var(--grey-500);

    --border-color: var(--grey-200);
    --border-color-dark: var(--grey-300);

    --accent-primary: var(--accent-500);
    --accent-primary-hover: var(--accent-600);
    --accent-primary-dark: var(--accent-700);

    /* Shadows */
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.03);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.05), 0 1px 2px -1px rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.07);
    --shadow-md: 0 6px 10px -2px rgb(0 0 0 / 0.08), 0 3px 6px -3px rgb(0 0 0 / 0.08);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Layout */
    --app-header-height: 65px;
    --border-radius-sm: 0.375rem;
    --border-radius: 0.5rem;
    --border-radius-md: 0.75rem;
    --border-radius-lg: 1rem;
    --sidebar-width: 320px;
    --info-panel-width: 380px;
    --mobile-appbar-height: 56px;
    --mobile-nav-height: 64px;

    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Manrope', 'Inter', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    cursor: url('../img/cpc-cursor.png'), auto;
}

/* HEADER */
.header {
    background: var(--bg-primary);
    flex-shrink: 0;
    padding: 0 1.5rem;
    height: var(--app-header-height);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    height: 100%;
}

.mobile-appbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    height: var(--mobile-appbar-height);
}

.mobile-appbar-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}

.mobile-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: var(--border-radius-sm);
}

.mobile-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 50vw;
}

.mobile-appbar-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.mobile-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.mobile-icon-btn svg {
    width: 18px;
    height: 18px;
}

.mobile-icon-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-color-dark);
}

.mobile-icon-btn:focus-visible,
.mobile-menu-item:focus-visible,
.mobile-nav-item:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.mobile-more-menu {
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 0.75rem;
    display: none;
    flex-direction: column;
    gap: 0.25rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.4rem;
    min-width: 190px;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    z-index: 2100;
}

.mobile-more-menu.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--border-radius);
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.mobile-menu-item:hover {
    background: var(--bg-tertiary);
}

.header-left { display: flex; align-items: center; gap: 1.5rem; }
.header-actions { display: flex; align-items: center; gap: 0.75rem; }

.logo { display: flex; align-items: center; gap: 0.75rem; }
.logo-icon {
    width: 40px; height: 40px;
    background: var(--conservative-color);
    color: var(--white);
    border-radius: var(--border-radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.85rem;
    font-family: 'JetBrains Mono', monospace;
    line-height: 1;
}
.logo-image {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: var(--border-radius-sm);
}

.logo-text {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.header-button {
    padding: 0.6rem 1rem;
    font-size: 0.875rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
}

.header-button:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-color-dark);
}


.header-scoreboard {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: nowrap;
    padding-left: 1rem;
    border-left: 1px solid var(--border-color);
    max-width: 60vw;
    overflow-x: auto;
}

.score-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.55rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.score-item.total {
    background: var(--bg-primary);
    border-color: var(--accent-200);
}

.score-values {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.score-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.score-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.score-dot.liberal { background: var(--liberal-color); }
.score-dot.conservative { background: var(--conservative-color); }
.score-dot.ndp { background: var(--ndp-color); }
.score-dot.bloc { background: var(--bloc-color); }
.score-dot.green { background: var(--green-color); }
.score-dot.ppc { background: var(--ppc-color); }

/* MAIN LAYOUT */
.main-container {
    flex: 1;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    position: relative;
    height: calc(100vh - var(--app-header-height));
    width: 100%;
    overflow: hidden;
}

/* MAP */
#map {
    grid-column: 2 / 3;
    width: 100%;
    height: 100%;
    background: var(--bg-secondary);
    position: relative;
    cursor: url('../img/cpc-cursor.png'), auto;
}

/* Override Leaflet cursor styles with custom cursor */
.leaflet-container {
    cursor: url('../img/cpc-cursor.png'), auto !important;
}

.leaflet-interactive {
    cursor: url('../img/cpc-cursor.png'), auto !important;
}

.leaflet-grab {
    cursor: url('../img/cpc-cursor.png'), auto !important;
}

.leaflet-dragging .leaflet-grab,
.leaflet-dragging .leaflet-grab .leaflet-interactive,
.leaflet-dragging .leaflet-marker-draggable {
    cursor: url('../img/cpc-cursor.png'), auto !important;
}

/* Leaflet Control Styling */
.leaflet-control-zoom {
    border: 1px solid var(--border-color) !important;
    border-radius: var(--border-radius) !important;
    box-shadow: var(--shadow) !important;
}

.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
    background-color: var(--bg-primary) !important;
    color: var(--text-primary) !important;
}

.leaflet-control-zoom-in {
    border-bottom: 1px solid var(--border-color) !important;
    border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
}

.leaflet-control-zoom-out {
    border-radius: 0 0 var(--border-radius) var(--border-radius) !important;
}

.leaflet-control-zoom-in:hover,
.leaflet-control-zoom-out:hover {
    background-color: var(--bg-tertiary) !important;
}

/* SIDEBAR */
.control-sidebar {
    grid-column: 1 / 2;
    width: var(--sidebar-width);
    min-width: 280px;
    max-width: 600px;
    background: var(--bg-primary);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    overflow-y: auto;
    height: calc(100vh - var(--app-header-height));
    position: relative;
}

/* Sidebar Resize Handle */
.sidebar-resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 100%;
    cursor: ew-resize;
    background: transparent;
    z-index: 1001;
    transition: background-color 0.15s ease;
}

.sidebar-resize-handle:hover,
.sidebar-resize-handle.dragging {
    background: var(--accent-primary);
}

.sidebar-resize-handle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 40px;
    background: var(--grey-300);
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.sidebar-resize-handle:hover::after,
.sidebar-resize-handle.dragging::after {
    opacity: 1;
}

/* Prevent text selection while resizing */
.resizing {
    user-select: none;
    cursor: ew-resize !important;
}

.resizing * {
    cursor: ew-resize !important;
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sidebar-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    display: none;
    padding: 0.25rem;
    border-radius: var(--border-radius-sm);
}

.sidebar-close:hover {
    color: var(--text-primary);
    background: var(--grey-100);
}

.sidebar-content {
    flex: 1;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--bg-tertiary);
    overflow-y: auto;
    max-height: calc(100vh - var(--app-header-height) - 80px);
}

.sidebar-backdrop {
    position: fixed;
    top: var(--app-header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 29, 33, 0.45);
    backdrop-filter: blur(2px);
    z-index: 950;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--transition-base), visibility var(--transition-base);
}

.sidebar-backdrop.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* CONTROL GROUPS */
.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-xs);
}

.control-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Experimental badge */
.experimental-badge {
    display: inline-block;
    font-size: 0.55rem;
    font-weight: 700;
    color: #b45309;
    background: #fef3c7;
    padding: 1px 4px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-left: 4px;
    vertical-align: middle;
}

/* Toggle Buttons */
.toggle-buttons {
    display: flex;
    gap: 0.25rem;
    background: var(--grey-200);
    padding: 4px;
    border-radius: var(--border-radius);
    width: 100%;
}

.toggle-btn {
    flex: 1;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-base);
    text-align: center;
}

.toggle-btn:hover:not(.active) {
    background: var(--white);
    color: var(--text-primary);
}

.toggle-btn.active {
    background: var(--white);
    color: var(--accent-primary);
    box-shadow: var(--shadow-sm);
    font-weight: 700;
}

.toggle-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.toggle-btn.disabled:hover {
    background: inherit;
    color: inherit;
}

/* Poll view hint message */
.poll-view-hint {
    display: none;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-style: italic;
    margin-top: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.poll-view-hint.visible {
    display: block;
}

/* Smaller toggle buttons for display mode */
.toggle-buttons-small {
    padding: 3px;
}

.toggle-buttons-small .toggle-btn {
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
}

/* Wrapping toggle buttons for view level */
.toggle-buttons-wrap {
    flex-wrap: wrap;
}

.toggle-buttons-wrap .toggle-btn {
    flex: 0 1 calc(50% - 0.125rem);
    min-width: 0;
}

/* Province Checkbox Container */
.province-checkbox-container {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 280px;
    overflow-y: auto;
    padding: 0.5rem;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.province-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.4rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-primary);
    transition: background var(--transition-fast);
}

.province-checkbox-label:hover {
    background: var(--grey-100);
}

.province-checkbox {
    width: 14px;
    height: 14px;
    accent-color: var(--accent-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.province-checkbox-label span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Filter action buttons */
.filter-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.filter-action-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.filter-action-btn:hover {
    background: var(--grey-100);
    color: var(--text-primary);
}

/* Filter count */
.filter-count {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-weight: 400;
}

/* Region Checkbox Container */
.region-checkbox-container {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.region-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: background var(--transition-fast);
}

.region-checkbox-label:hover {
    background: var(--grey-100);
}

.region-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.region-checkbox-label span {
    flex: 1;
}

/* Riding Search */
.riding-search-wrapper {
    position: relative;
    margin-bottom: 0.5rem;
}

.riding-search-input {
    width: 100%;
    padding: 0.625rem 2.25rem 0.625rem 2.25rem;
    font-size: 0.85rem;
    font-family: inherit;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--white);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.riding-search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-100);
}

.riding-search-input::placeholder {
    color: var(--grey-400);
}

.riding-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    color: var(--grey-400);
    pointer-events: none;
}

.riding-search-clear {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--grey-100);
    border: none;
    border-radius: 50%;
    color: var(--grey-500);
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.riding-search-clear:hover {
    background: var(--grey-200);
    color: var(--grey-700);
}

.riding-search-clear.hidden {
    display: none;
}

/* Riding Selection Info */
.riding-selection-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    padding: 0 0.125rem;
}

#riding-count {
    font-size: 0.75rem;
    color: var(--grey-500);
    font-weight: 500;
}

.riding-action-btn {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent-primary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
}

.riding-action-btn:hover {
    background: var(--accent-50);
    color: var(--accent-600);
}

.riding-action-btn.hidden {
    display: none;
}

/* Riding Checkbox Container (multi-select) */
.riding-checkbox-container {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-height: 220px;
    overflow-y: auto;
    padding: 0.5rem;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    scrollbar-width: thin;
    scrollbar-color: var(--grey-300) transparent;
}

.riding-checkbox-container::-webkit-scrollbar {
    width: 6px;
}

.riding-checkbox-container::-webkit-scrollbar-track {
    background: transparent;
}

.riding-checkbox-container::-webkit-scrollbar-thumb {
    background: var(--grey-300);
    border-radius: 3px;
}

.riding-checkbox-container::-webkit-scrollbar-thumb:hover {
    background: var(--grey-400);
}

.riding-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-primary);
    transition: background var(--transition-fast);
}

.riding-checkbox-label:hover {
    background: var(--grey-100);
}

.riding-checkbox-label.selected {
    background: var(--accent-50);
}

.riding-checkbox-label.highlighted {
    background: var(--accent-100);
}

.riding-checkbox {
    width: 15px;
    height: 15px;
    accent-color: var(--accent-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.riding-checkbox-label span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.riding-checkbox-label .match-highlight {
    background: var(--accent-200);
    color: var(--accent-700);
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 600;
}

.riding-checkbox-empty {
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-style: italic;
}

.riding-no-results {
    padding: 1rem;
    text-align: center;
    color: var(--grey-400);
    font-size: 0.8rem;
}

/* Riding Boundaries Overlay Toggle */
.riding-overlay-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--grey-50);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.riding-overlay-toggle:hover {
    background: var(--grey-100);
}

.riding-overlay-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--text-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.riding-overlay-label {
    font-size: 0.85rem;
    color: var(--text-primary);
    user-select: none;
}

/* Census Browse/Search Mode Toggle */
.census-mode-toggle {
    display: flex;
    gap: 0;
    margin: 0.75rem 0;
    background: var(--grey-200);
    border-radius: var(--border-radius);
    padding: 4px;
}

/* Census controls wrapper */
.census-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    overflow: hidden;
}

.census-modes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.census-mode-btn {
    flex: 1;
    padding: 0.55rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Manrope', 'Inter', sans-serif;
    background: transparent;
    color: var(--grey-500);
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.census-mode-btn:hover:not(.active) {
    color: var(--grey-700);
    background: rgba(255, 255, 255, 0.5);
}

.census-mode-btn.active {
    background: var(--white);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    font-weight: 700;
}

/* Census Search Container */
.census-search-container {
    position: relative;
    margin-bottom: 0.75rem;
    width: 100%;
}

.census-search-input {
    width: 100%;
    padding: 0.65rem 2.4rem 0.65rem 2.4rem;
    font-size: 0.85rem;
    font-family: 'Manrope', 'Inter', sans-serif;
    background: var(--white);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

.census-search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1), 0 6px 16px rgba(0,0,0,0.06);
}

.census-search-input::placeholder {
    color: var(--text-secondary);
}

.census-search-icon {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    color: var(--grey-400);
    pointer-events: none;
}

.census-search-clear {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.census-search-clear:hover {
    background: var(--grey-100);
    color: var(--text-primary);
}

/* Census Search Results Info */
.census-search-results-info {
    font-size: 0.7rem;
    color: var(--grey-500);
    margin-bottom: 0.65rem;
    padding: 0.5rem 0.75rem;
    background: var(--grey-50);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
}

/* Census Search Results List */
.census-search-results {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--white);
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.census-search-placeholder {
    padding: 2rem 1.5rem;
    text-align: center;
    color: var(--grey-400);
    font-size: 0.8rem;
    font-style: normal;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.census-search-result {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--grey-100);
    transition: background var(--transition-fast);
}

.census-search-result:last-child {
    border-bottom: none;
}

.census-search-result:hover {
    background: var(--grey-50);
}

.census-search-result.selected {
    background: rgba(37, 99, 235, 0.08);
}

.census-search-result-radio {
    flex-shrink: 0;
    width: 1rem;
    font-size: 0.7rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.census-search-result.selected .census-search-result-radio {
    color: var(--accent-primary);
}

.census-search-result-name {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.4;
    word-break: break-word;
}

.census-search-subcategory {
    flex-shrink: 0;
    font-size: 0.7rem;
    color: var(--text-secondary);
    background: var(--grey-100);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    white-space: nowrap;
    margin-top: 0.1rem;
}

/* Select Dropdowns */
.control-select {
    width: 100%;
    padding: 0.65rem 2.25rem 0.65rem 0.85rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: 'Manrope', 'Inter', sans-serif;
    background: var(--white);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6L8 10L12 6' stroke='%235a646f' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
    background-size: 16px;
}

.control-select:hover {
    border-color: var(--border-color-dark);
}

.control-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-100);
}

/* Help Toggle & Text */
.help-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    margin-top: 0.5rem;
}

.help-toggle.inline-help {
    margin-top: 0;
}

.help-toggle input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
}

.help-text {
    display: none;
    font-size: 0.75rem;
    color: var(--grey-600);
    background: var(--grey-50);
    border: 1px solid var(--border-color);
    padding: 0.65rem 0.75rem;
    border-radius: var(--border-radius);
    margin: 0.5rem 0 0.75rem 0;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

#control-sidebar.show-help .help-text {
    display: block;
}

.map-mode-group {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.map-mode-group .subtle {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.comparison-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.secondary-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.secondary-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--border-color-dark);
}

.control-select.compact {
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
}

/* Control Button */
.control-button {
    width: 100%;
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--bg-primary);
    color: var(--accent-primary);
    border: 1px solid var(--accent-200);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.control-button:hover {
    background: var(--accent-50);
    border-color: var(--accent-primary);
}

.control-input {
    width: 100%;
    padding: 0.65rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--white);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.control-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-100);
}

/* Transfer panel layout */
.transfer-rule {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    background: var(--bg-tertiary);
    margin-bottom: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.transfer-rule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    color: var(--text-primary);
}

.transfer-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.transfer-field label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.transfer-input-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.transfer-rule .control-select {
    width: 100%;
}

.transfer-field.two-col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

/* Stats Panel */
.stats-panel {
    padding: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-xs);
}

.stats-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.stat-item {
    text-align: center;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-top: 0.25rem;
}

/* INFO PANEL (right side) */
.info-panel {
    position: fixed;
    right: 0;
    top: var(--app-header-height);
    bottom: 0;
    width: var(--info-panel-width);
    background: linear-gradient(180deg, var(--grey-50) 0%, var(--white) 100%);
    /* Enhanced box-shadow for better visual separation from map */
    box-shadow:
        -8px 0 32px -4px rgba(0, 0, 0, 0.15),
        -2px 0 8px -2px rgba(0, 0, 0, 0.08);
    z-index: 1300;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    border-left: 1px solid var(--grey-200);
}

.info-panel.hidden {
    transform: translateX(100%);
    opacity: 0;
}

.info-panel-header {
    padding: 1.25rem 1.5rem;
    background: var(--white);
    border-bottom: 1px solid var(--grey-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    position: relative;
}

.info-panel-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 1.5rem;
    right: 1.5rem;
    height: 1px;
    background: linear-gradient(90deg, var(--accent-200), transparent);
}

.info-panel-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--grey-800);
    letter-spacing: -0.01em;
}

/* Close button with 44x44px touch target for accessibility */
.info-panel-close {
    background: var(--grey-100);
    border: 1px solid var(--grey-200);
    color: var(--grey-500);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
    /* Ensure touch target is respected */
    touch-action: manipulation;
}

.info-panel-close:hover {
    background: var(--grey-200);
    border-color: var(--grey-300);
    color: var(--grey-700);
    transform: scale(1.05);
}

/* Content wrapper for smooth height transitions */
.info-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--grey-300) transparent;
}

/* Inner content wrapper for height animations */
.info-panel-content-inner {
    transition: opacity var(--transition-base) cubic-bezier(0.4, 0, 0.2, 1);
}

.info-panel-content-inner.transitioning {
    opacity: 0;
}

/* Loading skeleton styles */
.info-panel-skeleton {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0.5rem 0;
}

.skeleton-line {
    height: 1rem;
    background: linear-gradient(
        90deg,
        var(--grey-200) 0%,
        var(--grey-100) 50%,
        var(--grey-200) 100%
    );
    background-size: 200% 100%;
    border-radius: var(--border-radius);
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-line.skeleton-title {
    height: 1.5rem;
    width: 70%;
    margin-bottom: 0.5rem;
}

.skeleton-line.skeleton-short {
    width: 40%;
}

.skeleton-line.skeleton-medium {
    width: 60%;
}

.skeleton-line.skeleton-long {
    width: 85%;
}

.skeleton-block {
    height: 4rem;
    background: linear-gradient(
        90deg,
        var(--grey-200) 0%,
        var(--grey-100) 50%,
        var(--grey-200) 100%
    );
    background-size: 200% 100%;
    border-radius: var(--border-radius-md);
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-chart {
    height: 120px;
    background: linear-gradient(
        90deg,
        var(--grey-200) 0%,
        var(--grey-100) 50%,
        var(--grey-200) 100%
    );
    background-size: 200% 100%;
    border-radius: var(--border-radius-md);
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    margin-top: 1rem;
}

@keyframes skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.info-panel-content::-webkit-scrollbar {
    width: 6px;
}

.info-panel-content::-webkit-scrollbar-track {
    background: transparent;
}

.info-panel-content::-webkit-scrollbar-thumb {
    background: var(--grey-300);
    border-radius: 3px;
}

.info-panel-content::-webkit-scrollbar-thumb:hover {
    background: var(--grey-400);
}

.info-hint {
    color: var(--text-muted);
    text-align: center;
    font-style: normal;
    margin: 3rem 1rem;
    font-size: 0.9rem;
    line-height: 1.6;
}

.info-chart-container {
    width: 100%;
    max-width: 200px;
    margin: 0 auto 1.5rem;
    padding: 1rem;
    background: var(--white);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--grey-100);
}

.info-chart-container.hidden {
    display: none;
}

.info-section {
    margin-bottom: 1.5rem;
}

.info-section:last-child {
    margin-bottom: 0;
}

.info-section-header {
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--grey-500);
    margin-bottom: 0.75rem;
    padding-left: 0.125rem;
}

.info-data-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.info-data-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 0.875rem;
    background: var(--white);
    border-radius: var(--border-radius);
    font-size: 0.85rem;
    border: 1px solid var(--grey-100);
    transition: all var(--transition-fast);
}

.info-data-row:hover {
    border-color: var(--grey-200);
    box-shadow: var(--shadow-xs);
}

.info-data-label {
    font-weight: 500;
    color: var(--grey-600);
}

.info-data-value {
    font-weight: 600;
    color: var(--grey-800);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
}

/* Demographic breakdown styling */
.info-section.demographic-section {
    padding: 0.75rem 0.75rem 0.6rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
    border: 1px solid var(--grey-100);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-xs);
}

.info-section.demographic-section .info-section-header {
    color: var(--grey-600);
    margin-bottom: 0.6rem;
}

.info-section.demographic-section .info-data-grid {
    gap: 0.4rem;
}

.info-section.demographic-section .info-data-row {
    background: transparent;
    border: 1px solid transparent;
    padding: 0.5rem 0.75rem;
    position: relative;
    overflow: hidden;
}

.info-section.demographic-section .info-data-row::after {
    content: '';
    position: absolute;
    inset: 0;
    width: calc(var(--bar, 0) * 1%);
    background: linear-gradient(90deg, rgba(34, 102, 255, 0.16), rgba(34, 102, 255, 0.02));
    z-index: 0;
}

.info-section.demographic-section .info-data-row::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(34, 102, 255, 0.4);
    z-index: 0;
}

.info-section.demographic-section .info-data-row > * {
    position: relative;
    z-index: 1;
}

.info-section.demographic-section .info-data-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    flex: 1;
}

.info-section.demographic-section .info-data-rank {
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 999px;
    background: rgba(34, 102, 255, 0.12);
    color: var(--accent-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}

.info-section.demographic-section .info-data-label {
    color: var(--grey-700);
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.info-section.demographic-section .info-data-value {
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid var(--grey-100);
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    font-size: 0.75rem;
}

.info-section.demographic-section .info-data-row:hover {
    border-color: rgba(34, 102, 255, 0.15);
    box-shadow: none;
}

/* Census characteristic in info panel */
.census-char-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
    cursor: help;
}

.census-char-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent-primary);
}

/* Winner badge - redesigned */
.info-winner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.125rem;
    background: var(--white);
    border-radius: var(--border-radius-md);
    margin-bottom: 1.5rem;
    border: 1px solid var(--grey-100);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.info-winner::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--winner-color, var(--grey-300));
    border-radius: 4px 0 0 4px;
}

.info-winner-badge {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--border-radius);
    flex-shrink: 0;
    box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.25);
}

.info-winner-info {
    flex: 1;
    min-width: 0;
}

.info-winner-party {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--grey-800);
    letter-spacing: -0.01em;
    margin-bottom: 0.125rem;
}

.info-winner-votes {
    color: var(--grey-500);
    font-size: 0.8rem;
    font-weight: 500;
}

.info-winner-margin {
    color: var(--grey-400);
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 0.25rem;
}

/* Party results list - redesigned */
.party-results {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.party-result-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    background: var(--white);
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
    border: 1px solid var(--grey-100);
    position: relative;
    overflow: hidden;
}

.party-result-row::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--party-color, var(--grey-300));
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.party-result-row:hover {
    border-color: var(--grey-200);
    box-shadow: var(--shadow-xs);
}

.party-result-row:hover::before {
    opacity: 1;
}

.party-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8), 0 1px 3px rgba(0, 0, 0, 0.15);
}

.party-result-name {
    flex: 1;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--grey-700);
}

.party-result-share {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--grey-500);
    font-family: 'JetBrains Mono', monospace;
}

/* Historical comparison styles */
.comparison-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
}

.comparison-party-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.comparison-data {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding-left: 1.85rem;
    font-size: 0.8rem;
}

.comparison-year-data {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.comparison-year-label {
    font-weight: 600;
    color: var(--grey-600);
    font-size: 0.75rem;
    min-width: 45px;
}

.comparison-year-value {
    font-family: 'JetBrains Mono', monospace;
    color: var(--grey-700);
    font-weight: 500;
}

.comparison-change {
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    padding-top: 0.25rem;
    border-top: 1px solid var(--grey-100);
}

/* Vote type breakdown - redesigned */
.vote-type-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.vote-type-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    background: var(--white);
    border-radius: var(--border-radius);
    font-size: 0.85rem;
    border: 1px solid var(--grey-100);
    transition: all var(--transition-fast);
}

.vote-type-row:hover {
    border-color: var(--grey-200);
    box-shadow: var(--shadow-xs);
}

.vote-type-label {
    font-weight: 500;
    color: var(--grey-700);
}

.vote-type-value {
    font-weight: 600;
    color: var(--grey-600);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    text-align: right;
    min-width: 55px;
}

.vote-type-pct {
    font-weight: 600;
    color: var(--grey-400);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    text-align: right;
    min-width: 45px;
}

/* Advanced Analytics Button */
.advanced-analytics-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Manrope', 'Inter', sans-serif;
    background: var(--white);
    color: var(--grey-700);
    border: 1px solid var(--grey-200);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    letter-spacing: 0.01em;
}

.advanced-analytics-btn:hover {
    background: var(--grey-50);
    border-color: var(--accent-500);
    color: var(--accent-600);
}

.advanced-analytics-btn:active {
    background: var(--accent-50);
}

/* Census data source label */
.info-census-source {
    font-size: 0.7rem;
    color: var(--grey-400);
    margin-top: 0.5rem;
    padding-left: 0.125rem;
    font-style: italic;
}

/* LEGEND */
.legend-wrapper {
    position: fixed;
    bottom: 1.5rem;
    left: calc(var(--sidebar-width) + 1.5rem);
    width: 200px;
    background: var(--bg-primary);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    z-index: 1200;
    padding: 0.5rem 1rem 1rem;
    transition: left var(--transition-base), padding var(--transition-fast), width var(--transition-fast);
}

.legend-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.25rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-tertiary);
    transition: color var(--transition-fast);
}

.legend-toggle:hover {
    color: var(--text-secondary);
}

.legend-toggle-icon {
    width: 16px;
    height: 16px;
    transition: transform var(--transition-fast);
}

.legend-wrapper.collapsed .legend-toggle-icon {
    transform: rotate(180deg);
}

.legend-body {
    overflow: hidden;
    transition: max-height var(--transition-base), opacity var(--transition-fast);
    max-height: 500px;
    opacity: 1;
}

.legend-wrapper.collapsed .legend-body {
    max-height: 0;
    opacity: 0;
}

.legend-wrapper.collapsed {
    padding: 0.35rem 0.75rem;
    width: auto;
    min-width: 40px;
}

.mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom, 0));
    padding: 0.35rem 0.6rem calc(0.35rem + env(safe-area-inset-bottom, 0));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -10px 20px -15px rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem;
    z-index: 2050;
}

.mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    padding: 0.4rem 0.2rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.mobile-nav-item .mobile-nav-icon {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.mobile-nav-item svg {
    width: 20px;
    height: 20px;
}

.mobile-nav-item.active {
    color: var(--accent-primary);
    background: var(--accent-50);
}

.legend-title {
    font-weight: 700;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.legend-content {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* Gradient legend for demographics */
.legend-gradient {
    display: none;
}

.legend-gradient.visible {
    display: block;
}

.legend-scale {
    height: 10px;
    border-radius: 5px;
    margin-bottom: 0.5rem;
}

.legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Winner by Margin Electoral Legend Styles */
.legend-margin-parties {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.legend-gradient-bar {
    width: 48px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Individual party gradient backgrounds */
.legend-gradient-liberal {
    background: linear-gradient(to right, #fce4e4, #DC2626);
}

.legend-gradient-conservative {
    background: linear-gradient(to right, #e0e8f7, #2563EB);
}

.legend-gradient-ndp {
    background: linear-gradient(to right, #feecd6, #F97316);
}

.legend-gradient-bloc {
    background: linear-gradient(to right, #d9f5fa, #06B6D4);
}

.legend-gradient-green {
    background: linear-gradient(to right, #dcf5e4, #16A34A);
}

.legend-margin-scale {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--grey-500);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    padding: 0 2px;
}

.legend-tie-indicator {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.legend-tie-stripe {
    background: repeating-linear-gradient(
        45deg,
        #DC2626,
        #DC2626 3px,
        #2563EB 3px,
        #2563EB 6px
    );
    width: 20px;
    height: 12px;
}

/* LOADING OVERLAY (Keep for backward compatibility but hide by default) */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    z-index: 3000;
    display: none; /* Disabled by default */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: inline-block;
    border-top: 4px solid var(--grey-800);
    border-right: 4px solid transparent;
    box-sizing: border-box;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 1rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* LOADING PROGRESS BAR (Bottom-Right over Leaflet attribution) */
.loading-progress-bar {
    position: fixed;
    bottom: 10px;
    right: 10px;
    width: 320px;
    z-index: 1500; /* Above map (1000) but below info panel (1300) when visible */
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
    animation: slideUp 0.3s ease;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Move loading bar left when info panel is visible */
.loading-progress-bar.shift-for-panel {
    right: calc(var(--info-panel-width) + 10px);
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.loading-bar-content {
    padding: 0.875rem 1rem;
}

.loading-bar-text {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-family: 'Manrope', sans-serif;
    line-height: 1.3;
}

.loading-bar-track {
    height: 4px;
    background: var(--grey-200);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.loading-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #2563EB 0%, #3b82f6 50%, #2563EB 100%);
    background-size: 200% 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
    animation: shimmer 1.5s infinite;
    box-shadow: 0 0 8px rgba(37, 99, 235, 0.4);
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Responsive: Stack on mobile */
@media (max-width: 768px) {
    .loading-progress-bar {
        bottom: calc(var(--mobile-nav-height) + 0.5rem + env(safe-area-inset-bottom, 0));
        right: 10px;
        left: 10px;
        width: auto;
    }

    .loading-progress-bar.shift-for-panel {
        right: 10px;
    }
}

/* Leaflet Popup Styling */
.leaflet-popup-content-wrapper {
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0;
    border: 1px solid var(--border-color);
}

.leaflet-popup-content {
    margin: 0;
    min-width: 260px;
    font-family: 'Manrope', 'Inter', sans-serif;
}

.popup-header {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius-md) var(--border-radius-md) 0 0;
    color: white;
}

.popup-header h4 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
}

.popup-header .subtitle {
    font-size: 0.8rem;
    opacity: 0.85;
    margin-top: 0.25rem;
}

.popup-body {
    padding: 1rem 1.25rem;
}

.popup-stat {
    margin-bottom: 0.75rem;
}

.popup-stat:last-child {
    margin-bottom: 0;
}

.popup-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.2rem;
}

.popup-stat-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--accent-primary);
}

/* Utility */
.hidden {
    display: none !important;
}

/* RESPONSIVE */
@media (max-width: 1600px) {
    .header-scoreboard {
        gap: 0.5rem;
        padding-left: 0.9rem;
    }

    .score-item {
        padding: 0.32rem 0.48rem;
        gap: 0.32rem;
        font-size: 0.8rem;
    }

    .score-sub {
        font-size: 0.72rem;
    }

    .score-dot {
        width: 9px;
        height: 9px;
    }
}

@media (max-width: 1400px) {
    .header-scoreboard {
        gap: 0.4rem;
        padding-left: 0.75rem;
    }

    .score-item {
        padding: 0.28rem 0.4rem;
        gap: 0.28rem;
        font-size: 0.75rem;
    }

    .score-sub {
        font-size: 0.67rem;
    }

    .score-dot {
        width: 8px;
        height: 8px;
    }
}

@media (max-width: 1200px) {
    .header-scoreboard {
        gap: 0.3rem;
        padding-left: 0.6rem;
    }

    .score-item {
        padding: 0.24rem 0.34rem;
        font-size: 0.7rem;
        gap: 0.24rem;
    }

    .score-sub {
        font-size: 0.62rem;
    }

    .score-dot {
        width: 7px;
        height: 7px;
    }
}

@media (max-width: 1024px) {
    :root {
        --app-header-height: calc(var(--mobile-appbar-height) + env(safe-area-inset-top, 0px));
    }

    .main-container {
        grid-template-columns: minmax(0, 1fr);
    }

    .header {
        padding: 0 0.75rem;
        padding-top: env(safe-area-inset-top, 0);
    }

    .header-row {
        display: none;
    }

    .mobile-appbar {
        display: flex;
    }

    .mobile-more-menu {
        display: flex;
    }

    #open-controls-btn {
        display: none;
    }

    .header-scoreboard {
        display: none;
    }

    #map {
        grid-column: 1 / -1;
        min-height: 70vh;
    }

    .control-sidebar {
        position: fixed;
        left: 0;
        top: var(--app-header-height);
        bottom: 0;
        width: min(82vw, 360px);
        z-index: 2000;
        transform: translateX(-100%);
        box-shadow: var(--shadow-xl);
        padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom, 0));
    }

    .control-sidebar.open {
        transform: translateX(0);
    }

    .sidebar-close {
        display: inline-flex;
    }

    .legend-wrapper {
        left: 1rem;
        right: auto;
        width: min(150px, 36vw);
        max-width: none;
        bottom: calc(var(--mobile-nav-height) + 0.75rem + env(safe-area-inset-bottom, 0));
        padding: 0.35rem 0.5rem 0.5rem;
        box-shadow: var(--shadow-sm);
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(8px);
        pointer-events: auto;
    }

    .legend-wrapper.collapsed {
        padding: 0.25rem 0.5rem;
        width: auto;
        min-width: 32px;
    }

    .legend-toggle {
        padding: 0.15rem;
    }

    .legend-toggle-icon {
        width: 14px;
        height: 14px;
    }

    .legend-title {
        font-size: 0.68rem;
        margin-bottom: 0.4rem;
    }

    .legend-content {
        gap: 0.22rem;
    }

    .legend-item {
        font-size: 0.66rem;
        gap: 0.35rem;
    }

    .legend-color {
        width: 10px;
        height: 10px;
    }

    .info-panel {
        top: auto;
        left: 0;
        right: 0;
        bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom, 0));
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border-color);
        border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
        max-height: 55vh;
        padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0));
    }

    .info-panel.hidden {
        transform: translateY(110%);
    }

    .mobile-nav {
        display: flex;
    }

    body.mobile-view-filters #map,
    body.mobile-view-data #map {
        display: none;
    }

    body.mobile-view-map .control-sidebar,
    body.mobile-view-map .info-panel {
        display: none;
    }

    body.mobile-view-filters .info-panel {
        display: none;
    }

    body.mobile-view-filters .control-sidebar {
        transform: none;
        width: 100%;
        max-width: none;
        min-width: 0;
        box-shadow: none;
        border-right: none;
        bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom, 0));
    }

    body.mobile-view-filters .sidebar-resize-handle,
    body.mobile-view-filters .sidebar-backdrop {
        display: none;
    }

    body.mobile-view-data .control-sidebar {
        display: none;
    }

    body.mobile-view-data .info-panel {
        top: var(--app-header-height);
        bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom, 0));
        max-height: none;
        border-radius: 0;
        transform: none;
        opacity: 1;
    }

    body.mobile-view-filters .legend-wrapper,
    body.mobile-view-data .legend-wrapper {
        display: none;
    }
}

@media (max-width: 768px) {
    .logo-text {
        font-size: 0.95rem;
    }

    .legend-wrapper {
        padding: 0.3rem 0.4rem 0.45rem;
        bottom: calc(var(--mobile-nav-height) + 0.65rem + env(safe-area-inset-bottom, 0));
        left: 0.6rem;
        width: min(130px, 34vw);
    }

    .legend-wrapper.collapsed {
        padding: 0.2rem 0.4rem;
        width: auto;
        min-width: 28px;
    }

    .toggle-buttons {
        flex-wrap: wrap;
    }

    .toggle-btn {
        flex: 1 1 calc(50% - 0.25rem);
    }

    .comparison-row {
        flex-direction: column;
        align-items: stretch;
    }

    #map {
        min-height: 65vh;
    }
}

@media (max-width: 520px) {
    .control-sidebar {
        width: 100vw;
        min-width: 0;
        max-width: none;
    }

    .sidebar-header {
        padding: 1rem 1.1rem;
    }

    .sidebar-content {
        padding: 1rem;
        gap: 0.75rem;
    }

    .control-group {
        padding: 0.85rem;
        gap: 0.5rem;
    }

    .control-label {
        font-size: 0.65rem;
    }

    .help-text {
        font-size: 0.75rem;
    }

    .toggle-btn {
        font-size: 0.8rem;
        padding: 0.45rem 0.6rem;
    }

    .toggle-buttons-wrap .toggle-btn {
        flex: 1 1 100%;
    }

    .region-checkbox-container {
        max-height: 160px;
    }
}

@media (min-width: 1025px) {
    .sidebar-backdrop {
        display: none;
    }
}

/* ==========================================
   CENSUS CHARACTERISTIC SELECTOR
   ========================================== */

.census-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.census-loading {
    font-size: 0.8rem;
    color: var(--accent-500);
    padding: 0.5rem;
    text-align: center;
    background: var(--accent-50);
    border-radius: var(--border-radius-sm);
}

.control-subgroup {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-subgroup.hidden {
    display: none;
}

/* Census Mode Sections */
#census-search-mode,
#census-browse-mode {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    overflow: hidden;
}

#census-search-mode.hidden,
#census-browse-mode.hidden {
    display: none;
}

/* Census Tree Styles */
.census-tree {
    max-height: 300px;
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: var(--bg-primary);
    padding: 0.5rem;
    font-size: 0.8rem;
    min-width: 0;
}

.census-tree.hidden {
    display: none;
}

.char-tree-item {
    line-height: 1.4;
    white-space: nowrap;
}

.char-tree-label {
    display: flex;
    align-items: center;
    padding: 0.35rem 0.5rem;
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    transition: background var(--transition-fast);
    gap: 0.35rem;
}

.char-tree-label:hover {
    background: var(--grey-100);
}

.char-tree-label.selected {
    background: var(--accent-100);
    color: var(--accent-700);
}

.char-tree-toggle {
    font-size: 0.65rem;
    width: 1rem;
    text-align: center;
    color: var(--grey-500);
    flex-shrink: 0;
}

.char-tree-spacer {
    width: 1rem;
    flex-shrink: 0;
}

.char-tree-name {
    flex: 1;
    min-width: 0;
}

.char-tree-type {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    flex-shrink: 0;
    color: var(--white);
    background: var(--grey-500);
}

.char-tree-children {
    margin-left: 0.5rem;
    border-left: 1px solid var(--grey-200);
}

/* Selected Characteristic Display */
.selected-characteristic {
    margin-top: 0.75rem;
    padding: 0.85rem 1rem;
    background: var(--accent-50);
    border: 1px solid var(--accent-200);
    border-radius: var(--border-radius);
    font-size: 0.85rem;
}

.selected-char-prefix {
    color: var(--grey-600);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: block;
    margin-bottom: 0.35rem;
}

.selected-char-label {
    font-weight: 600;
    color: var(--accent-700);
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}

/* ==========================================
   OFFLINE INDICATOR
   ========================================== */

.offline-indicator {
    position: fixed;
    top: var(--app-header-height);
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
}

.offline-indicator::before {
    content: '⚡';
    font-size: 1rem;
}

body.offline-mode .offline-indicator {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
}

/* Toast notifications for connection status */
.connection-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--grey-800);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: var(--border-radius);
    font-size: 0.85rem;
    font-weight: 500;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.connection-toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.connection-toast.online {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.connection-toast.offline {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

@media (max-width: 1024px) {
    .offline-indicator {
        font-size: 0.75rem;
        padding: 0.4rem 0.8rem;
    }
    
    .connection-toast {
        bottom: calc(var(--mobile-nav-height) + 1rem + env(safe-area-inset-bottom, 0));
    }
}
