/* ============================================================
   SMARTCEMIC UX UTILITIES
   Consistent spacing, transitions, and design patterns
   ============================================================ */

/* Section Spacing */
.section-spacing {
    padding: 4rem 0;
}

.section-spacing-sm {
    padding: 2rem 0;
}

.section-spacing-lg {
    padding: 6rem 0;
}

.section-spacing-xl {
    padding: 8rem 0;
}

/* Content Spacing */
.content-gap {
    gap: 2rem;
}

.content-gap-sm {
    gap: 1rem;
}

.content-gap-lg {
    gap: 3rem;
}

/* Card Spacing */
.card-spacing {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-spacing-lg {
    padding: 2rem;
    margin-bottom: 2rem;
}

/* Divider Lines */
.section-divider {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin: 2rem 0;
}

.section-divider-lg {
    border-bottom: 2px solid rgba(16, 185, 129, 0.2);
    margin: 3rem 0;
}

/* Smooth Transitions */
.smooth-transition {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.smooth-transition-fast {
    transition: all 0.15s ease-out;
}

.smooth-transition-slow {
    transition: all 0.5s ease-in-out;
}

/* Hover Effects */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.3);
}

/* Focus States for Accessibility */
.focus-ring:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.4);
}

.focus-ring:focus-visible {
    outline: 2px solid #10b981;
    outline-offset: 2px;
}

/* Results Modal Styles */
.results-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.results-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.results-modal {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border-radius: 24px;
    padding: 2.5rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    border: 1px solid rgba(16, 185, 129, 0.2);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

.results-modal-overlay.active .results-modal {
    transform: scale(1) translateY(0);
}

.results-modal-header {
    text-align: center;
    margin-bottom: 2rem;
}

.results-modal-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    animation: pulse-success 2s infinite;
}

.results-modal-icon i {
    font-size: 2.5rem;
    color: white;
}

@keyframes pulse-success {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    50% { box-shadow: 0 0 0 20px rgba(16, 185, 129, 0); }
}

.results-modal-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 0.5rem;
}

.results-modal-subtitle {
    color: #94a3b8;
    font-size: 1rem;
}

.results-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.results-summary-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
}

.results-summary-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #10b981;
    margin-bottom: 0.25rem;
}

.results-summary-value.warning {
    color: #f59e0b;
}

.results-summary-value.critical {
    color: #ef4444;
}

.results-summary-label {
    font-size: 0.75rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.results-primary-reading {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 2rem;
}

.results-primary-label {
    font-size: 0.875rem;
    color: #94a3b8;
    margin-bottom: 0.5rem;
}

.results-primary-value {
    font-size: 3rem;
    font-weight: 800;
    color: #10b981;
    line-height: 1;
}

.results-primary-value.high {
    color: #f59e0b;
}

.results-primary-value.critical {
    color: #ef4444;
}

.results-primary-unit {
    font-size: 1.25rem;
    color: #64748b;
    margin-left: 0.5rem;
}

.results-primary-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    background: rgba(16, 185, 129, 0.2);
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #10b981;
}

.results-primary-status.warning {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.results-primary-status.critical {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.results-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.results-btn {
    padding: 0.875rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.results-btn-primary {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.results-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.results-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.results-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Light Theme Adjustments */
:root[data-theme="light"] .results-modal {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border-color: rgba(16, 185, 129, 0.3);
}

:root[data-theme="light"] .results-modal-title {
    color: #1e293b;
}

:root[data-theme="light"] .results-summary-item {
    background: rgba(0, 0, 0, 0.03);
}

:root[data-theme="light"] .results-btn-secondary {
    background: rgba(0, 0, 0, 0.05);
    color: #1e293b;
    border-color: rgba(0, 0, 0, 0.1);
}

/* ============================================================
   PHASE 2: ENHANCED SECTION SPACING & NAVIGATION
   ============================================================ */

/* Page Content Wrapper */
.page-content {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .page-content {
        padding: 1rem;
    }
}

/* Section Headers */
.section-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.section-header h2,
.section-header .section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-header h2 i,
.section-header .section-title i {
    color: #10b981;
    font-size: 1.25rem;
}

.section-header .section-subtitle {
    color: #94a3b8;
    font-size: 0.9375rem;
}

:root[data-theme="light"] .section-header {
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

:root[data-theme="light"] .section-header h2,
:root[data-theme="light"] .section-header .section-title {
    color: #1e293b;
}

/* Card Grid Layouts */
.card-grid {
    display: grid;
    gap: 1.5rem;
}

.card-grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.card-grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.card-grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* Enhanced Card Styles */
.card-enhanced {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.card-enhanced:hover {
    border-color: rgba(16, 185, 129, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

:root[data-theme="light"] .card-enhanced {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border-color: rgba(0, 0, 0, 0.08);
}

:root[data-theme="light"] .card-enhanced:hover {
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

/* Navigation Enhancements */
.nav-enhanced .nav-link {
    position: relative;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.nav-enhanced .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #10b981, #059669);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-enhanced .nav-link:hover::after,
.nav-enhanced .nav-link.active::after {
    width: 80%;
}

.nav-enhanced .nav-link:hover {
    background: rgba(16, 185, 129, 0.1);
}

.nav-enhanced .nav-link.active {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

/* Breadcrumb Navigation */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #94a3b8;
    margin-bottom: 1.5rem;
}

.breadcrumb a {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb a:hover {
    color: #10b981;
}

.breadcrumb .separator {
    color: #475569;
}

.breadcrumb .current {
    color: #f8fafc;
    font-weight: 500;
}

:root[data-theme="light"] .breadcrumb .current {
    color: #1e293b;
}

/* Action Bar */
.action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.action-bar-left,
.action-bar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8125rem;
    font-weight: 600;
}

.status-badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.status-badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.status-badge-error {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.status-badge-info {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #94a3b8;
}

.empty-state-icon {
    font-size: 4rem;
    color: #475569;
    margin-bottom: 1.5rem;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #f8fafc;
    margin-bottom: 0.5rem;
}

.empty-state-description {
    max-width: 400px;
    margin: 0 auto 1.5rem;
}

:root[data-theme="light"] .empty-state-title {
    color: #1e293b;
}

/* Loading States */
.skeleton {
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.05) 25%, 
        rgba(255, 255, 255, 0.1) 50%, 
        rgba(255, 255, 255, 0.05) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-text-sm {
    height: 0.75rem;
    width: 60%;
}

.skeleton-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-card {
    height: 120px;
}

/* Notification Dot */
.notification-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid #0f172a;
}

.notification-dot.pulse {
    animation: notificationPulse 2s infinite;
}

@keyframes notificationPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Quick Actions FAB */
.quick-actions-fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
}

.fab-button {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab-button:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.5);
}

@media (max-width: 768px) {
    .quick-actions-fab {
        bottom: 5rem;
        right: 1rem;
    }
    
    .fab-button {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }
}

/* Responsive Visibility */
.hide-mobile {
    display: block;
}

.show-mobile {
    display: none;
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
    
    .show-mobile {
        display: block !important;
    }
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .page-content {
        padding: 0;
    }
    
    .card-enhanced {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* ============================================================
   PHASE 3: PROFESSIONAL POLISH & DEVICE FLOW
   ============================================================ */

/* Device Connection Flow */
.device-connection-wizard {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.wizard-steps {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-bottom: 2rem;
}

.wizard-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.wizard-step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: #94a3b8;
    transition: all 0.3s ease;
}

.wizard-step.active .wizard-step-number {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.wizard-step.completed .wizard-step-number {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.wizard-step.completed .wizard-step-number::before {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
}

.wizard-step-label {
    font-size: 0.875rem;
    color: #94a3b8;
    font-weight: 500;
}

.wizard-step.active .wizard-step-label {
    color: #f8fafc;
}

.wizard-step-connector {
    width: 60px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 0.5rem;
}

.wizard-step.completed + .wizard-step-connector,
.wizard-step-connector.completed {
    background: #10b981;
}

/* Device Cards */
.device-card {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.device-card:hover {
    border-color: rgba(16, 185, 129, 0.4);
    transform: translateX(4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.device-card.selected {
    border-color: #10b981;
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
}

.device-card.connected {
    border-color: #10b981;
}

.device-card.connected::after {
    content: 'Connected';
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.device-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(16, 185, 129, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #10b981;
    flex-shrink: 0;
}

.device-card-info {
    flex: 1;
    min-width: 0;
}

.device-card-name {
    font-weight: 600;
    color: #f8fafc;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.device-card-type {
    font-size: 0.8125rem;
    color: #94a3b8;
}

.device-card-signal {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: #64748b;
}

.device-card-signal i {
    color: #10b981;
}

/* Connection Status Indicator */
.connection-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.connection-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #64748b;
}

.connection-status-dot.connected {
    background: #10b981;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
    animation: statusPulse 2s infinite;
}

.connection-status-dot.connecting {
    background: #f59e0b;
    animation: statusBlink 1s infinite;
}

.connection-status-dot.error {
    background: #ef4444;
}

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

@keyframes statusBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.connection-status-text {
    flex: 1;
}

.connection-status-title {
    font-weight: 600;
    color: #f8fafc;
    font-size: 0.9375rem;
}

.connection-status-subtitle {
    font-size: 0.8125rem;
    color: #94a3b8;
}

/* Data Stream Indicator */
.data-stream-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 20px;
    font-size: 0.8125rem;
    color: #10b981;
}

.data-stream-indicator .stream-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    animation: streamPulse 1s infinite;
}

@keyframes streamPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
}

/* Reading Display Cards */
.reading-card {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.reading-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #10b981, #059669);
}

.reading-card.warning::before {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}

.reading-card.critical::before {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.reading-card-label {
    font-size: 0.8125rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.reading-card-value {
    font-size: 3rem;
    font-weight: 800;
    color: #f8fafc;
    line-height: 1;
    margin-bottom: 0.5rem;
    font-family: 'JetBrains Mono', monospace;
}

.reading-card-value.normal {
    color: #10b981;
}

.reading-card-value.warning {
    color: #f59e0b;
}

.reading-card-value.critical {
    color: #ef4444;
}

.reading-card-unit {
    font-size: 1rem;
    color: #64748b;
}

.reading-card-trend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: #94a3b8;
}

.reading-card-trend i {
    font-size: 1.25rem;
}

.reading-card-trend.rising i {
    color: #f59e0b;
}

.reading-card-trend.falling i {
    color: #3b82f6;
}

.reading-card-trend.stable i {
    color: #10b981;
}

/* Timestamp Display */
.timestamp-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: #64748b;
}

.timestamp-display i {
    color: #94a3b8;
}

/* Professional Table Styles */
.table-professional {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-professional thead th {
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.table-professional tbody tr {
    transition: background 0.2s ease;
}

.table-professional tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.table-professional tbody td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #f8fafc;
}

.table-professional tbody tr:last-child td {
    border-bottom: none;
}

/* Tooltip Styles */
.tooltip-container {
    position: relative;
}

.tooltip-content {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    color: #f8fafc;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1e293b;
}

.tooltip-container:hover .tooltip-content {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-4px);
}

/* Light Theme Adjustments */
:root[data-theme="light"] .device-card {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border-color: rgba(0, 0, 0, 0.08);
}

:root[data-theme="light"] .device-card:hover {
    border-color: rgba(16, 185, 129, 0.5);
}

:root[data-theme="light"] .device-card-name {
    color: #1e293b;
}

:root[data-theme="light"] .reading-card {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border-color: rgba(0, 0, 0, 0.08);
}

:root[data-theme="light"] .reading-card-value {
    color: #1e293b;
}

:root[data-theme="light"] .connection-status-title {
    color: #1e293b;
}

:root[data-theme="light"] .table-professional thead th {
    background: rgba(0, 0, 0, 0.02);
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

:root[data-theme="light"] .table-professional tbody td {
    color: #1e293b;
    border-bottom-color: rgba(0, 0, 0, 0.05);
}

:root[data-theme="light"] .tooltip-content {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
    color: #1e293b;
}

:root[data-theme="light"] .tooltip-content::after {
    border-top-color: #ffffff;
}

/* ============================================================
   PHASE 4: COMPREHENSIVE RESPONSIVE DESIGN
   Mobile-First Approach for All Screen Sizes
   ============================================================ */

/* 
   Breakpoints:
   - Mobile:  < 480px (small phones)
   - Mobile:  480px - 767px (large phones)
   - Tablet:  768px - 1023px
   - Desktop: 1024px - 1279px
   - Large:   1280px - 1535px  
   - XL:      1536px+
*/

/* ============================================================
   BASE MOBILE STYLES (Mobile-First)
   ============================================================ */

/* Results Modal - Mobile */
.results-modal-overlay {
    padding: 1rem;
}

.results-modal {
    padding: 1.5rem;
    max-height: 90vh;
    border-radius: 20px;
}

.results-modal-icon {
    width: 64px;
    height: 64px;
}

.results-modal-icon i {
    font-size: 2rem;
}

.results-modal-title {
    font-size: 1.375rem;
}

.results-summary-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.results-summary-item {
    padding: 0.75rem 0.5rem;
}

.results-summary-value {
    font-size: 1.25rem;
}

.results-summary-label {
    font-size: 0.6875rem;
}

.results-primary-reading {
    padding: 1.25rem;
}

.results-primary-value {
    font-size: 2.5rem;
}

.results-primary-unit {
    font-size: 1rem;
}

.results-actions {
    flex-direction: column;
    gap: 0.75rem;
}

.results-btn {
    width: 100%;
    justify-content: center;
    padding: 1rem;
}

/* Device Cards - Mobile */
.device-card {
    padding: 1rem;
    flex-wrap: wrap;
}

.device-card-icon {
    width: 40px;
    height: 40px;
    font-size: 1rem;
}

.device-card-name {
    font-size: 0.9375rem;
}

.device-card-type {
    font-size: 0.75rem;
}

/* Reading Cards - Mobile */
.reading-card {
    padding: 1.25rem;
}

.reading-card-value {
    font-size: 2.25rem;
}

.reading-card-unit {
    font-size: 0.875rem;
}

/* Section Spacing - Mobile */
.section-spacing {
    padding: 2.5rem 0;
}

.section-spacing-lg {
    padding: 3.5rem 0;
}

.section-header {
    margin-bottom: 1.5rem;
}

.section-header h2,
.section-header .section-title {
    font-size: 1.25rem;
}

/* Card Grids - Mobile (stack) */
.card-grid,
.card-grid-2,
.card-grid-3,
.card-grid-4 {
    grid-template-columns: 1fr;
    gap: 1rem;
}

/* Wizard Steps - Mobile */
.wizard-steps {
    flex-wrap: wrap;
    gap: 0.5rem;
}

.wizard-step-connector {
    display: none;
}

.wizard-step-label {
    display: none;
}

.wizard-step-number {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
}

/* Navigation - Mobile */
.nav-enhanced .nav-link {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

/* FAB - Mobile */
.quick-actions-fab {
    bottom: 5rem;
    right: 1rem;
}

.fab-button {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
}

/* Tables - Mobile (horizontal scroll) */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-professional {
    min-width: 600px;
}

.table-professional thead th,
.table-professional tbody td {
    padding: 0.75rem;
    font-size: 0.8125rem;
}

/* Action Bar - Mobile */
.action-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
}

.action-bar-left,
.action-bar-right {
    justify-content: center;
    flex-wrap: wrap;
}

/* Breadcrumb - Mobile */
.breadcrumb {
    font-size: 0.75rem;
    flex-wrap: wrap;
}

/* Empty State - Mobile */
.empty-state {
    padding: 2.5rem 1.5rem;
}

.empty-state-icon {
    font-size: 3rem;
}

.empty-state-title {
    font-size: 1.125rem;
}

/* Connection Status - Mobile */
.connection-status {
    padding: 0.875rem;
}

.connection-status-title {
    font-size: 0.875rem;
}

.connection-status-subtitle {
    font-size: 0.75rem;
}

/* Tooltips - Mobile (disabled, use tap) */
@media (hover: none) {
    .tooltip-content {
        display: none;
    }
}

/* ============================================================
   SMALL PHONES (< 480px)
   ============================================================ */
@media (max-width: 479px) {
    .results-modal {
        padding: 1.25rem;
        border-radius: 16px;
    }

    .results-modal-title {
        font-size: 1.25rem;
    }

    .results-summary-grid {
        gap: 0.5rem;
    }

    .results-summary-value {
        font-size: 1.125rem;
    }

    .results-primary-value {
        font-size: 2rem;
    }

    .device-card {
        padding: 0.875rem;
    }

    .reading-card-value {
        font-size: 2rem;
    }

    .page-content {
        padding: 0.75rem;
    }

    .card-enhanced {
        padding: 1rem;
        border-radius: 12px;
    }

    .section-header h2 {
        font-size: 1.125rem;
    }

    .fab-button {
        width: 44px;
        height: 44px;
        font-size: 1.125rem;
    }
}

/* ============================================================
   LARGE PHONES (480px - 767px)
   ============================================================ */
@media (min-width: 480px) and (max-width: 767px) {
    .results-modal {
        padding: 1.75rem;
    }

    .results-primary-value {
        font-size: 2.75rem;
    }

    .card-grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .reading-card-value {
        font-size: 2.5rem;
    }

    .wizard-step-label {
        display: block;
        font-size: 0.75rem;
    }
}

/* ============================================================
   TABLETS (768px - 1023px)
   ============================================================ */
@media (min-width: 768px) {
    .results-modal-overlay {
        padding: 2rem;
    }

    .results-modal {
        padding: 2rem;
        max-width: 550px;
    }

    .results-modal-icon {
        width: 72px;
        height: 72px;
    }

    .results-modal-icon i {
        font-size: 2.25rem;
    }

    .results-modal-title {
        font-size: 1.5rem;
    }

    .results-summary-value {
        font-size: 1.375rem;
    }

    .results-summary-label {
        font-size: 0.75rem;
    }

    .results-primary-value {
        font-size: 3rem;
    }

    .results-actions {
        flex-direction: row;
    }

    .results-btn {
        width: auto;
        min-width: 160px;
    }

    /* Device Cards */
    .device-card {
        padding: 1.25rem;
    }

    .device-card-icon {
        width: 44px;
        height: 44px;
    }

    /* Grids */
    .card-grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .card-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .card-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Section Spacing */
    .section-spacing {
        padding: 3rem 0;
    }

    .section-spacing-lg {
        padding: 4.5rem 0;
    }

    .section-header h2 {
        font-size: 1.375rem;
    }

    /* Reading Cards */
    .reading-card {
        padding: 1.5rem;
    }

    .reading-card-value {
        font-size: 2.75rem;
    }

    /* Wizard */
    .wizard-step-connector {
        display: block;
        width: 40px;
    }

    .wizard-step-label {
        display: block;
    }

    .wizard-step-number {
        width: 32px;
        height: 32px;
    }

    /* Navigation */
    .nav-enhanced .nav-link {
        padding: 0.625rem 1rem;
    }

    /* FAB */
    .quick-actions-fab {
        bottom: 2rem;
        right: 2rem;
    }

    .fab-button {
        width: 52px;
        height: 52px;
    }

    /* Action Bar */
    .action-bar {
        flex-direction: row;
    }

    /* Page Content */
    .page-content {
        padding: 1.5rem;
    }

    /* Empty State */
    .empty-state {
        padding: 3.5rem 2rem;
    }
}

/* ============================================================
   DESKTOP (1024px - 1279px)
   ============================================================ */
@media (min-width: 1024px) {
    .results-modal {
        padding: 2.5rem;
        max-width: 600px;
    }

    .results-modal-icon {
        width: 80px;
        height: 80px;
    }

    .results-modal-icon i {
        font-size: 2.5rem;
    }

    .results-modal-title {
        font-size: 1.75rem;
    }

    .results-summary-value {
        font-size: 1.5rem;
    }

    .results-primary-reading {
        padding: 1.5rem;
    }

    /* Grids */
    .card-grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .card-grid-4 {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Device Cards */
    .device-card {
        padding: 1.5rem;
    }

    .device-card-icon {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }

    /* Reading Cards */
    .reading-card-value {
        font-size: 3rem;
    }

    /* Section */
    .section-spacing {
        padding: 4rem 0;
    }

    .section-spacing-lg {
        padding: 6rem 0;
    }

    .section-header h2 {
        font-size: 1.5rem;
    }

    /* Wizard */
    .wizard-step-connector {
        width: 60px;
    }

    /* Page Content */
    .page-content {
        padding: 2rem;
    }

    /* FAB */
    .fab-button {
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }

    /* Tables */
    .table-professional thead th,
    .table-professional tbody td {
        padding: 1rem;
    }
}

/* ============================================================
   LARGE DESKTOP (1280px - 1535px)
   ============================================================ */
@media (min-width: 1280px) {
    .card-grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }

    .page-content {
        max-width: 1400px;
    }

    .section-spacing-xl {
        padding: 8rem 0;
    }

    .reading-card-value {
        font-size: 3.5rem;
    }
}

/* ============================================================
   EXTRA LARGE (1536px+)
   ============================================================ */
@media (min-width: 1536px) {
    .page-content {
        max-width: 1600px;
        padding: 2.5rem;
    }

    .card-grid {
        gap: 2rem;
    }

    .results-modal {
        max-width: 650px;
    }

    .reading-card {
        padding: 2rem;
    }

    .reading-card-value {
        font-size: 4rem;
    }
}

/* ============================================================
   LANDSCAPE ORIENTATION (Mobile)
   ============================================================ */
@media (max-width: 896px) and (orientation: landscape) {
    .results-modal {
        max-height: 85vh;
        padding: 1.25rem;
    }

    .results-modal-icon {
        width: 48px;
        height: 48px;
    }

    .results-modal-icon i {
        font-size: 1.5rem;
    }

    .results-modal-header {
        margin-bottom: 1rem;
    }

    .results-modal-title {
        font-size: 1.25rem;
    }

    .results-summary-grid {
        margin-bottom: 1rem;
    }

    .results-primary-reading {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .results-primary-value {
        font-size: 2rem;
    }

    .quick-actions-fab {
        bottom: 1rem;
    }
}

/* ============================================================
   HIGH DPI / RETINA DISPLAYS
   ============================================================ */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .device-card,
    .reading-card,
    .card-enhanced {
        border-width: 0.5px;
    }
}

/* ============================================================
   REDUCED MOTION (Accessibility)
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .smooth-transition,
    .hover-lift,
    .hover-glow {
        transition: none !important;
    }

    .section-animate {
        opacity: 1;
        transform: none;
    }

    .results-modal-icon {
        animation: none;
    }

    .status-badge,
    .connection-status-dot,
    .data-stream-indicator .stream-dot {
        animation: none;
    }
}

/* ============================================================
   DARK MODE SYSTEM PREFERENCE
   ============================================================ */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
    }
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        color-scheme: light;
    }
}

/* ============================================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================================ */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .nav-enhanced .nav-link {
        min-height: 44px;
        min-width: 44px;
    }

    .results-btn {
        min-height: 48px;
    }

    .device-card {
        min-height: 64px;
    }

    .fab-button {
        width: 56px;
        height: 56px;
    }

    /* Remove hover effects on touch */
    .device-card:hover {
        transform: none;
    }

    .card-enhanced:hover {
        transform: none;
    }

    .hover-lift:hover {
        transform: none;
    }

    /* Active states instead */
    .device-card:active {
        transform: scale(0.98);
    }

    .results-btn:active {
        transform: scale(0.98);
    }

    .fab-button:active {
        transform: scale(0.95);
    }
}

/* ============================================================
   SAFE AREA INSETS (iPhone X+, notch devices)
   ============================================================ */
@supports (padding: max(0px)) {
    .page-content {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }

    .quick-actions-fab {
        bottom: max(2rem, calc(env(safe-area-inset-bottom) + 1rem));
        right: max(1rem, env(safe-area-inset-right));
    }

    .results-modal-overlay {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* ============================================================
   PRINT RESPONSIVE
   ============================================================ */
@media print {
    .results-modal-overlay,
    .quick-actions-fab,
    .nav-enhanced,
    .wizard-steps {
        display: none !important;
    }

    .page-content {
        padding: 0;
        max-width: none;
    }

    .card-grid,
    .card-grid-2,
    .card-grid-3,
    .card-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .reading-card,
    .device-card,
    .card-enhanced {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .reading-card-value {
        color: #000 !important;
    }
}

/* ============================================================
   DEMO UX ENHANCEMENTS
   Post-measurement scroll, highlight, and mobile modal
   ============================================================ */

/* Results Highlight Animation */
.demo-device.results-highlight {
    animation: deviceHighlight 2s ease-out;
}

@keyframes deviceHighlight {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
    }
    30% {
        box-shadow: 0 0 40px 10px rgba(16, 185, 129, 0.4);
    }
    100% {
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    }
}

/* Value Pulse Animation */
.demo-reading-value.value-pulse {
    animation: valuePulse 1.5s ease-out;
}

@keyframes valuePulse {
    0% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.15);
        text-shadow: 0 0 30px currentColor;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        text-shadow: none;
    }
}

/* Primary Reading Glow */
.demo-primary-reading.reading-glow {
    animation: readingGlow 2s ease-out;
}

@keyframes readingGlow {
    0% {
        border-color: rgba(16, 185, 129, 0.2);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.3);
    }
    30% {
        border-color: rgba(16, 185, 129, 0.6);
        box-shadow: 0 0 30px 5px rgba(16, 185, 129, 0.3);
    }
    100% {
        border-color: rgba(16, 185, 129, 0.2);
        box-shadow: none;
    }
}

/* Metric Pop Animation */
.demo-metric.metric-pop {
    animation: metricPop 0.5s ease-out;
}

@keyframes metricPop {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    }
    100% {
        transform: scale(1);
    }
}

/* Correction Display Animation */
.correction-display.correction-animate {
    animation: correctionSlide 1.5s ease-out;
}

@keyframes correctionSlide {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }
    30% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 1;
    }
}

/* ============================================================
   MOBILE RESULTS OVERLAY
   ============================================================ */
.mobile-results-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-results-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-results-modal {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border-radius: 24px;
    padding: 2rem 1.5rem;
    width: 100%;
    max-width: 360px;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    border: 1px solid rgba(16, 185, 129, 0.2);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

.mobile-results-overlay.active .mobile-results-modal {
    transform: scale(1) translateY(0);
}

.mobile-results-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.mobile-results-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #059669);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    animation: successPulse 2s infinite;
}

.mobile-results-icon i {
    font-size: 2rem;
    color: white;
}

.mobile-results-icon.elevated,
.mobile-results-icon.high {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.mobile-results-icon.low {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

@keyframes successPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    50% { box-shadow: 0 0 0 15px rgba(16, 185, 129, 0); }
}

.mobile-results-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #f8fafc;
    margin: 0;
}

.mobile-results-primary {
    text-align: center;
    padding: 1.5rem;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 16px;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.mobile-results-label {
    font-size: 0.8125rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.mobile-results-value {
    font-size: 3.5rem;
    font-weight: 800;
    color: #10b981;
    line-height: 1;
    font-family: 'JetBrains Mono', monospace;
}

.mobile-results-value.elevated,
.mobile-results-value.high {
    color: #f59e0b;
}

.mobile-results-value.low {
    color: #ef4444;
}

.mobile-results-unit {
    font-size: 1rem;
    color: #64748b;
    margin-top: 0.25rem;
}

.mobile-results-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    background: rgba(16, 185, 129, 0.2);
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #10b981;
}

.mobile-results-status.elevated,
.mobile-results-status.high {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.mobile-results-status.low {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.mobile-results-secondary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.mobile-result-item {
    text-align: center;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.mobile-result-label {
    display: block;
    font-size: 0.6875rem;
    color: #94a3b8;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.mobile-result-value {
    font-size: 1rem;
    font-weight: 700;
    color: #f8fafc;
}

.mobile-results-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.mobile-results-btn {
    width: 100%;
    padding: 1rem;
    border-radius: 12px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.mobile-results-btn.primary {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.mobile-results-btn.primary:hover,
.mobile-results-btn.primary:active {
    transform: scale(0.98);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.mobile-results-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.mobile-results-btn.secondary:hover,
.mobile-results-btn.secondary:active {
    background: rgba(255, 255, 255, 0.15);
}

/* Light Theme */
:root[data-theme="light"] .mobile-results-modal {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
}

:root[data-theme="light"] .mobile-results-header h3 {
    color: #1e293b;
}

:root[data-theme="light"] .mobile-result-item {
    background: rgba(0, 0, 0, 0.03);
}

:root[data-theme="light"] .mobile-result-value {
    color: #1e293b;
}

:root[data-theme="light"] .mobile-results-btn.secondary {
    background: rgba(0, 0, 0, 0.05);
    color: #1e293b;
    border-color: rgba(0, 0, 0, 0.1);
}

/* Responsive adjustments for demo on mobile */
@media (max-width: 767px) {
    .live-demo-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    
    .demo-device {
        order: 1;
    }
    
    .demo-control-panel {
        order: 2;
    }
    
    .demo-primary-reading {
        padding: 1.25rem !important;
    }
    
    .demo-reading-value {
        font-size: 3rem !important;
    }
    
    .demo-secondary-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.5rem !important;
    }
    
    .demo-metric {
        padding: 0.75rem 0.5rem !important;
    }
    
    .demo-metric-value {
        font-size: 1.125rem !important;
    }
    
    .demo-metric-label {
        font-size: 0.625rem !important;
    }
    
    .measure-btn {
        padding: 1rem !important;
        font-size: 1rem !important;
    }
}

/* Tablet adjustments */
@media (min-width: 768px) and (max-width: 1023px) {
    .live-demo-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 1.5rem !important;
    }
    
    .demo-reading-value {
        font-size: 2.5rem !important;
    }
}

/* Desktop - ensure side by side layout */
@media (min-width: 1024px) {
    .live-demo-grid {
        grid-template-columns: 1.2fr 0.8fr !important;
        gap: 2rem !important;
        align-items: start !important;
    }
}

/* ============================================================
   RESPONSIVE FIX: QUANTUM CORRECTION DISPLAY
   ============================================================ */

/* Base correction display improvements */
.correction-display {
    padding: 1rem;
    overflow: hidden;
}

.correction-values {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.correction-item {
    flex: 1;
    min-width: 80px;
    max-width: 150px;
    text-align: center;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
}

.correction-item-label {
    font-size: 0.65rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
    white-space: nowrap;
}

.correction-item-value {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    line-height: 1.2;
    word-break: break-word;
}

.correction-item-value.raw {
    color: #9ca3af;
    text-decoration: line-through;
    font-size: 1.5rem;
}

.correction-item-value.corrected {
    color: #16a34a;
}

.correction-arrow {
    font-size: 1.25rem;
    color: #f59e0b;
    flex-shrink: 0;
}

.correction-factor {
    text-align: center;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 0.7rem;
    color: #64748b;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.correction-factor code {
    background: rgba(16, 163, 127, 0.1);
    color: #059669;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-family: 'JetBrains Mono', monospace;
}

/* Mobile: Small screens */
@media (max-width: 480px) {
    .correction-display {
        padding: 0.75rem;
    }
    
    .correction-values {
        gap: 0.5rem;
    }
    
    .correction-item {
        min-width: 70px;
        max-width: 120px;
        padding: 0.375rem;
    }
    
    .correction-item-label {
        font-size: 0.6rem;
    }
    
    .correction-item-value {
        font-size: 1.375rem;
    }
    
    .correction-item-value.raw {
        font-size: 1.25rem;
    }
    
    .correction-arrow {
        font-size: 1rem;
    }
    
    .correction-factor {
        font-size: 0.625rem;
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .correction-factor code {
        font-size: 0.625rem;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    .correction-item {
        min-width: 60px;
        max-width: 100px;
    }
    
    .correction-item-value {
        font-size: 1.25rem;
    }
    
    .correction-item-value.raw {
        font-size: 1.125rem;
    }
    
    .correction-arrow {
        font-size: 0.875rem;
    }
}

/* ============================================================
   RESPONSIVE FIX: FULL BIOMARKER PANEL
   ============================================================ */

/* Panel header - make tabs wrap on mobile */
.demo-panel-header {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

@media (min-width: 600px) {
    .demo-panel-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.demo-panel-title {
    font-weight: 600;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #374151;
    white-space: nowrap;
}

.demo-panel-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.demo-panel-tab {
    padding: 0.375rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    background: #f3f4f6;
    color: #6b7280;
    border: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.demo-panel-tab:hover,
.demo-panel-tab.active {
    background: #10b981;
    color: white;
}

/* Biomarker grid - responsive columns */
.demo-biomarker-grid {
    display: grid;
    gap: 0.5rem;
}

/* 1 column on very small screens */
@media (max-width: 400px) {
    .demo-biomarker-grid {
        grid-template-columns: 1fr;
    }
}

/* 2 columns on small screens */
@media (min-width: 401px) and (max-width: 767px) {
    .demo-biomarker-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 2 columns on tablets and up */
@media (min-width: 768px) {
    .demo-biomarker-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

/* Biomarker items */
.demo-biomarker-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 0.75rem;
    background: #f9fafb;
    border-radius: 8px;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
    min-height: 44px; /* Touch-friendly */
}

.demo-biomarker-item.normal {
    border-left-color: #10b981;
}

.demo-biomarker-item.elevated {
    border-left-color: #f59e0b;
}

.demo-biomarker-item.high {
    border-left-color: #ef4444;
}

.demo-biomarker-item.low {
    border-left-color: #3b82f6;
}

.demo-biomarker-name {
    font-size: 0.8125rem;
    color: #374151;
    font-weight: 500;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 0.5rem;
}

.demo-biomarker-value {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #1f2937;
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
    text-align: right;
}

/* Smaller text on mobile */
@media (max-width: 480px) {
    .demo-biomarker-item {
        padding: 0.5rem 0.625rem;
    }
    
    .demo-biomarker-name {
        font-size: 0.75rem;
    }
    
    .demo-biomarker-value {
        font-size: 0.75rem;
    }
    
    .demo-panel-title {
        font-size: 0.8125rem;
    }
}

/* ============================================================
   RESPONSIVE FIX: SECONDARY METRICS GRID
   ============================================================ */

.demo-secondary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

@media (max-width: 400px) {
    .demo-secondary-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    
    .demo-metric {
        padding: 0.625rem 0.375rem !important;
    }
    
    .demo-metric-icon {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.875rem !important;
    }
    
    .demo-metric-value {
        font-size: 1rem !important;
    }
    
    .demo-metric-label {
        font-size: 0.5625rem !important;
    }
}

/* ============================================================
   RESPONSIVE FIX: DEMO DEVICE PANEL
   ============================================================ */

.demo-device {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.demo-device-header {
    padding: 0.875rem 1rem;
}

.demo-device-body {
    padding: 1rem;
}

@media (max-width: 480px) {
    .demo-device {
        border-radius: 12px;
    }
    
    .demo-device-header {
        padding: 0.75rem;
    }
    
    .demo-device-body {
        padding: 0.75rem;
    }
    
    .demo-device-title {
        font-size: 0.875rem;
    }
    
    .demo-device-title span {
        font-size: 0.8125rem;
    }
}

/* Primary reading responsive */
.demo-primary-reading {
    padding: 1.25rem;
    text-align: center;
}

@media (max-width: 480px) {
    .demo-primary-reading {
        padding: 1rem;
    }
    
    .demo-reading-label {
        font-size: 0.6875rem !important;
    }
    
    .demo-reading-value {
        font-size: 2.5rem !important;
    }
    
    .demo-reading-unit {
        font-size: 1rem !important;
    }
    
    .demo-reading-status {
        font-size: 0.75rem !important;
        padding: 0.375rem 0.75rem !important;
    }
}

@media (max-width: 360px) {
    .demo-reading-value {
        font-size: 2rem !important;
    }
}

/* ============================================================
   LIGHT THEME ADJUSTMENTS FOR CORRECTIONS
   ============================================================ */

:root[data-theme="light"] .correction-item {
    background: rgba(255, 255, 255, 0.9);
}

:root[data-theme="light"] .correction-factor {
    border-top-color: rgba(0, 0, 0, 0.08);
}

:root[data-theme="light"] .demo-biomarker-item {
    background: #f9fafb;
}

:root[data-theme="light"] .demo-biomarker-item:hover {
    background: #f3f4f6;
}

/* ============================================================
   PROFESSIONAL SPACING SYSTEM
   Consistent spacing for headers, sections, and footers
   ============================================================ */

/* 
   SPACING SCALE:
   --sp-xs:   0.5rem   (8px)   - Tight spacing
   --sp-sm:   1rem     (16px)  - Small gaps
   --sp-md:   1.5rem   (24px)  - Medium gaps
   --sp-lg:   2rem     (32px)  - Section internal
   --sp-xl:   3rem     (48px)  - Between sections
   --sp-2xl:  4rem     (64px)  - Major section breaks
   --sp-3xl:  6rem     (96px)  - Hero/Footer spacing
   --sp-4xl:  8rem     (128px) - Extra large (desktop)
*/

:root {
    --sp-xs: 0.5rem;
    --sp-sm: 1rem;
    --sp-md: 1.5rem;
    --sp-lg: 2rem;
    --sp-xl: 3rem;
    --sp-2xl: 4rem;
    --sp-3xl: 6rem;
    --sp-4xl: 8rem;
}

/* ============================================================
   HEADER SPACING
   ============================================================ */

/* Space below fixed/sticky header for content */
.header-spacer {
    height: var(--header-height, 64px);
}

/* Main navigation consistent padding */
.main-nav,
nav.main-nav {
    padding: 0.75rem 1.5rem !important;
}

@media (max-width: 768px) {
    .main-nav,
    nav.main-nav {
        padding: 0.5rem 1rem !important;
    }
}

/* ============================================================
   HERO SECTION SPACING
   ============================================================ */

.hero,
.hero-section,
section.hero {
    padding-top: var(--sp-3xl) !important;
    padding-bottom: var(--sp-3xl) !important;
    margin-bottom: 0 !important;
}

@media (max-width: 768px) {
    .hero,
    .hero-section,
    section.hero {
        padding-top: var(--sp-2xl) !important;
        padding-bottom: var(--sp-2xl) !important;
    }
}

@media (max-width: 480px) {
    .hero,
    .hero-section,
    section.hero {
        padding-top: var(--sp-xl) !important;
        padding-bottom: var(--sp-xl) !important;
    }
}

/* Hero content internal spacing */
.hero-container,
.hero-content {
    gap: var(--sp-lg);
}

.hero-title {
    margin-bottom: var(--sp-md);
}

.hero-description {
    margin-bottom: var(--sp-lg);
}

.hero-buttons {
    margin-top: var(--sp-lg);
    gap: var(--sp-sm);
}

/* ============================================================
   MAIN SECTION SPACING
   ============================================================ */

/* Standard section - applies to all main content sections */
.section,
section.section,
section[class*="section"] {
    padding-top: var(--sp-2xl) !important;
    padding-bottom: var(--sp-2xl) !important;
    padding-left: var(--sp-lg);
    padding-right: var(--sp-lg);
}

@media (max-width: 768px) {
    .section,
    section.section,
    section[class*="section"] {
        padding-top: var(--sp-xl) !important;
        padding-bottom: var(--sp-xl) !important;
        padding-left: var(--sp-md);
        padding-right: var(--sp-md);
    }
}

@media (max-width: 480px) {
    .section,
    section.section,
    section[class*="section"] {
        padding-top: var(--sp-lg) !important;
        padding-bottom: var(--sp-lg) !important;
        padding-left: var(--sp-sm);
        padding-right: var(--sp-sm);
    }
}

/* Section container - max-width and centering */
.section-container,
.container {
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
}

/* Section header spacing */
.section-header {
    text-align: center;
    margin-bottom: var(--sp-xl) !important;
}

@media (max-width: 768px) {
    .section-header {
        margin-bottom: var(--sp-lg) !important;
    }
}

.section-badge {
    margin-bottom: var(--sp-sm);
}

.section-title {
    margin-bottom: var(--sp-md) !important;
}

.section-description {
    margin-bottom: var(--sp-lg);
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================================
   CONTENT AREA SPACING (Dashboard, Measure, etc.)
   ============================================================ */

/* Main content wrapper */
.main-content,
.content-wrapper,
.page-content {
    padding: var(--sp-lg);
    min-height: calc(100vh - var(--header-height, 64px) - var(--footer-height, 200px));
}

@media (max-width: 768px) {
    .main-content,
    .content-wrapper,
    .page-content {
        padding: var(--sp-md);
    }
}

@media (max-width: 480px) {
    .main-content,
    .content-wrapper,
    .page-content {
        padding: var(--sp-sm);
    }
}

/* Content sections within pages */
.content-section {
    margin-bottom: var(--sp-xl);
}

.content-section:last-child {
    margin-bottom: 0;
}

/* Card containers spacing */
.cards-container,
.card-grid,
.grid-container {
    gap: var(--sp-md);
}

@media (max-width: 480px) {
    .cards-container,
    .card-grid,
    .grid-container {
        gap: var(--sp-sm);
    }
}

/* Individual cards */
.card,
.card-enhanced,
.panel {
    padding: var(--sp-md);
    margin-bottom: var(--sp-md);
}

@media (max-width: 480px) {
    .card,
    .card-enhanced,
    .panel {
        padding: var(--sp-sm);
        margin-bottom: var(--sp-sm);
    }
}

.card-header {
    margin-bottom: var(--sp-md);
    padding-bottom: var(--sp-sm);
}

.card-body {
    padding: 0;
}

.card-footer {
    margin-top: var(--sp-md);
    padding-top: var(--sp-sm);
}

/* ============================================================
   FEATURES/PRICING/OTHER GRID SECTIONS
   ============================================================ */

.features-grid,
.pricing-grid,
.biomarkers-grid,
.cards-grid {
    gap: var(--sp-lg);
    margin-top: var(--sp-lg);
}

@media (max-width: 768px) {
    .features-grid,
    .pricing-grid,
    .biomarkers-grid,
    .cards-grid {
        gap: var(--sp-md);
    }
}

/* Feature/Pricing cards internal spacing */
.feature-card,
.pricing-card,
.biomarker-card {
    padding: var(--sp-lg);
}

@media (max-width: 480px) {
    .feature-card,
    .pricing-card,
    .biomarker-card {
        padding: var(--sp-md);
    }
}

.feature-icon,
.card-icon {
    margin-bottom: var(--sp-md);
}

.feature-title,
.card-title {
    margin-bottom: var(--sp-sm);
}

.feature-description,
.card-description {
    margin-bottom: var(--sp-md);
}

.feature-list,
.card-list {
    margin-top: var(--sp-md);
}

.feature-list li,
.card-list li {
    margin-bottom: var(--sp-xs);
}

/* ============================================================
   DEMO SECTION SPECIFIC SPACING
   ============================================================ */

.live-demo-section,
#live-demo {
    padding-top: var(--sp-2xl) !important;
    padding-bottom: var(--sp-2xl) !important;
}

.live-demo-container {
    padding: 0 var(--sp-lg);
}

@media (max-width: 768px) {
    .live-demo-container {
        padding: 0 var(--sp-md);
    }
}

.live-demo-grid {
    gap: var(--sp-lg) !important;
    margin-top: var(--sp-lg);
}

@media (max-width: 768px) {
    .live-demo-grid {
        gap: var(--sp-md) !important;
    }
}

/* Demo device panel spacing */
.demo-device {
    margin-bottom: var(--sp-lg);
}

.demo-device-header {
    padding: var(--sp-sm) var(--sp-md) !important;
}

.demo-device-body {
    padding: var(--sp-md) !important;
}

@media (max-width: 480px) {
    .demo-device-header {
        padding: var(--sp-xs) var(--sp-sm) !important;
    }
    
    .demo-device-body {
        padding: var(--sp-sm) !important;
    }
}

.demo-primary-reading {
    margin-bottom: var(--sp-lg);
    padding: var(--sp-md) !important;
}

.demo-secondary-grid {
    margin-bottom: var(--sp-lg);
}

.demo-biomarker-panel {
    padding-top: var(--sp-md);
    margin-top: var(--sp-md);
}

/* Control panel spacing */
.demo-control-panel {
    padding: var(--sp-md);
}

.control-section {
    margin-bottom: var(--sp-md);
    padding-bottom: var(--sp-md);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.control-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.control-label {
    margin-bottom: var(--sp-sm);
}

/* ============================================================
   FAQ SECTION SPACING
   ============================================================ */

.faq-container,
.faq-grid {
    gap: var(--sp-md);
    max-width: 900px;
    margin: 0 auto;
}

.faq-item {
    padding: var(--sp-md);
    margin-bottom: var(--sp-sm);
}

.faq-question {
    padding: var(--sp-sm) 0;
}

.faq-answer {
    padding-top: var(--sp-sm);
}

/* ============================================================
   FOOTER SPACING
   ============================================================ */

.footer,
footer {
    padding-top: var(--sp-3xl) !important;
    padding-bottom: var(--sp-lg) !important;
    margin-top: var(--sp-2xl) !important;
}

@media (max-width: 768px) {
    .footer,
    footer {
        padding-top: var(--sp-2xl) !important;
        padding-bottom: var(--sp-md) !important;
        margin-top: var(--sp-xl) !important;
    }
}

.footer-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--sp-lg);
}

@media (max-width: 768px) {
    .footer-container {
        padding: 0 var(--sp-md);
    }
}

.footer-top {
    padding-bottom: var(--sp-xl);
    margin-bottom: var(--sp-xl);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-grid {
    gap: var(--sp-xl);
}

@media (max-width: 768px) {
    .footer-grid {
        gap: var(--sp-lg);
    }
}

.footer-column {
    margin-bottom: var(--sp-lg);
}

.footer-column-title {
    margin-bottom: var(--sp-md);
}

.footer-links {
    gap: var(--sp-sm);
}

.footer-link {
    padding: var(--sp-xs) 0;
}

.footer-bottom {
    padding-top: var(--sp-lg);
    margin-top: var(--sp-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ============================================================
   DIVIDERS AND SEPARATORS
   ============================================================ */

.section-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    margin: var(--sp-2xl) 0;
}

.content-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: var(--sp-lg) 0;
}

:root[data-theme="light"] .section-divider {
    background: linear-gradient(90deg, transparent, rgba(0,0,0,0.1), transparent);
}

:root[data-theme="light"] .content-divider {
    background: rgba(0, 0, 0, 0.08);
}

/* ============================================================
   FORM ELEMENT SPACING
   ============================================================ */

.form-group {
    margin-bottom: var(--sp-md);
}

.form-label {
    margin-bottom: var(--sp-xs);
    display: block;
}

.form-input,
.form-select,
.form-textarea {
    padding: var(--sp-sm);
}

.form-actions {
    margin-top: var(--sp-lg);
    gap: var(--sp-sm);
}

/* ============================================================
   BUTTON SPACING
   ============================================================ */

.btn-group {
    gap: var(--sp-sm);
}

.btn {
    padding: var(--sp-sm) var(--sp-md);
}

.btn-sm {
    padding: var(--sp-xs) var(--sp-sm);
}

.btn-lg {
    padding: var(--sp-md) var(--sp-lg);
}

/* ============================================================
   TABLE SPACING
   ============================================================ */

.table-container {
    margin: var(--sp-lg) 0;
}

.table th,
.table td {
    padding: var(--sp-sm) var(--sp-md);
}

@media (max-width: 480px) {
    .table th,
    .table td {
        padding: var(--sp-xs) var(--sp-sm);
    }
}

/* ============================================================
   ALERT/NOTIFICATION SPACING
   ============================================================ */

.alert,
.notification {
    padding: var(--sp-md);
    margin-bottom: var(--sp-md);
}

.alert-icon {
    margin-right: var(--sp-sm);
}

/* ============================================================
   MODAL SPACING
   ============================================================ */

.modal-content {
    padding: var(--sp-lg);
}

@media (max-width: 480px) {
    .modal-content {
        padding: var(--sp-md);
    }
}

.modal-header {
    margin-bottom: var(--sp-lg);
}

.modal-body {
    margin-bottom: var(--sp-lg);
}

.modal-footer {
    padding-top: var(--sp-md);
    gap: var(--sp-sm);
}

/* ============================================================
   UTILITY SPACING CLASSES
   ============================================================ */

/* Margin utilities */
.mt-0 { margin-top: 0 !important; }
.mt-xs { margin-top: var(--sp-xs) !important; }
.mt-sm { margin-top: var(--sp-sm) !important; }
.mt-md { margin-top: var(--sp-md) !important; }
.mt-lg { margin-top: var(--sp-lg) !important; }
.mt-xl { margin-top: var(--sp-xl) !important; }
.mt-2xl { margin-top: var(--sp-2xl) !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-xs { margin-bottom: var(--sp-xs) !important; }
.mb-sm { margin-bottom: var(--sp-sm) !important; }
.mb-md { margin-bottom: var(--sp-md) !important; }
.mb-lg { margin-bottom: var(--sp-lg) !important; }
.mb-xl { margin-bottom: var(--sp-xl) !important; }
.mb-2xl { margin-bottom: var(--sp-2xl) !important; }

.my-0 { margin-top: 0 !important; margin-bottom: 0 !important; }
.my-sm { margin-top: var(--sp-sm) !important; margin-bottom: var(--sp-sm) !important; }
.my-md { margin-top: var(--sp-md) !important; margin-bottom: var(--sp-md) !important; }
.my-lg { margin-top: var(--sp-lg) !important; margin-bottom: var(--sp-lg) !important; }
.my-xl { margin-top: var(--sp-xl) !important; margin-bottom: var(--sp-xl) !important; }

/* Padding utilities */
.pt-0 { padding-top: 0 !important; }
.pt-sm { padding-top: var(--sp-sm) !important; }
.pt-md { padding-top: var(--sp-md) !important; }
.pt-lg { padding-top: var(--sp-lg) !important; }
.pt-xl { padding-top: var(--sp-xl) !important; }

.pb-0 { padding-bottom: 0 !important; }
.pb-sm { padding-bottom: var(--sp-sm) !important; }
.pb-md { padding-bottom: var(--sp-md) !important; }
.pb-lg { padding-bottom: var(--sp-lg) !important; }
.pb-xl { padding-bottom: var(--sp-xl) !important; }

.py-sm { padding-top: var(--sp-sm) !important; padding-bottom: var(--sp-sm) !important; }
.py-md { padding-top: var(--sp-md) !important; padding-bottom: var(--sp-md) !important; }
.py-lg { padding-top: var(--sp-lg) !important; padding-bottom: var(--sp-lg) !important; }
.py-xl { padding-top: var(--sp-xl) !important; padding-bottom: var(--sp-xl) !important; }

.px-sm { padding-left: var(--sp-sm) !important; padding-right: var(--sp-sm) !important; }
.px-md { padding-left: var(--sp-md) !important; padding-right: var(--sp-md) !important; }
.px-lg { padding-left: var(--sp-lg) !important; padding-right: var(--sp-lg) !important; }

.p-sm { padding: var(--sp-sm) !important; }
.p-md { padding: var(--sp-md) !important; }
.p-lg { padding: var(--sp-lg) !important; }

/* Gap utilities */
.gap-xs { gap: var(--sp-xs) !important; }
.gap-sm { gap: var(--sp-sm) !important; }
.gap-md { gap: var(--sp-md) !important; }
.gap-lg { gap: var(--sp-lg) !important; }
.gap-xl { gap: var(--sp-xl) !important; }

/* ============================================================
   RESPONSIVE SECTION ADJUSTMENTS
   ============================================================ */

/* Ensure proper spacing on tablets */
@media (min-width: 768px) and (max-width: 1024px) {
    .section,
    section.section {
        padding-top: var(--sp-xl);
        padding-bottom: var(--sp-xl);
    }
    
    .hero,
    .hero-section {
        padding-top: var(--sp-2xl);
        padding-bottom: var(--sp-2xl);
    }
}

/* Extra spacing on large screens */
@media (min-width: 1280px) {
    .section,
    section.section {
        padding-top: var(--sp-3xl);
        padding-bottom: var(--sp-3xl);
    }
    
    .hero,
    .hero-section {
        padding-top: var(--sp-4xl);
        padding-bottom: var(--sp-3xl);
    }
    
    .section-header {
        margin-bottom: var(--sp-2xl);
    }
}

/* ============================================================
   APP PAGE CONSISTENT HEADER/CONTENT SEPARATION
   ============================================================ */

/* For pages that use app_base.html */
.app-content,
.page-main {
    padding-top: var(--sp-lg, 2rem);
}

/* Sub-navigation bars */
.sub-nav,
.page-toolbar,
.filter-bar {
    background: var(--bg-card, #1e293b);
    border-bottom: 1px solid var(--border-color, #334155);
    padding: 0.875rem 1.5rem;
    margin-bottom: 0;
}

/* Content area after sub-nav */
.sub-nav + .content,
.page-toolbar + .content,
.filter-bar + .content {
    padding-top: 1.5rem;
}

/* Page section headers */
.page-header {
    margin-bottom: var(--sp-lg, 2rem);
    padding-bottom: var(--sp-md, 1.5rem);
    border-bottom: 1px solid var(--border-color, #334155);
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.page-subtitle {
    font-size: 0.9375rem;
    color: var(--text-secondary, #94a3b8);
}

@media (max-width: 768px) {
    .page-header {
        margin-bottom: var(--sp-md, 1.5rem);
        padding-bottom: var(--sp-sm, 1rem);
    }
    
    .page-title {
        font-size: 1.25rem;
    }
    
    .page-subtitle {
        font-size: 0.875rem;
    }
}

/* ============================================================
   FOOTER SEPARATION FROM CONTENT
   ============================================================ */

/* Ensure footer has proper separation */
main + footer,
.main-content + footer,
.container + footer {
    margin-top: var(--sp-2xl, 4rem);
}

/* Dashboard-specific footer spacing */
.dashboard-toolbar ~ .container ~ footer,
.grid-2col + footer {
    margin-top: var(--sp-xl, 3rem);
}
/* ============================================================
   DASHBOARD HEADER AREA - REFINED PROFESSIONAL DESIGN
   ============================================================ */

/* Container for search and quick access - unified sub-header */
main > #dashboard-biomarker-search,
main > script + #dashboard-biomarker-search {
    background: linear-gradient(180deg, rgba(30, 58, 138, 0.3) 0%, rgba(15, 23, 42, 0.95) 100%);
    padding: 1.25rem 1.5rem 0.75rem 1.5rem !important;
    margin: 0 !important;
    max-width: 100% !important;
    border-bottom: none !important;
}

/* Search input - subtle, integrated design */
#biomarker-search-container {
    max-width: 400px;
}

#biomarker-search-container input,
#biomarker-search-container .search-input,
.biomarker-search-input {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 10px !important;
    padding: 0.75rem 1rem 0.75rem 2.75rem !important;
    font-size: 0.875rem !important;
    color: #e2e8f0 !important;
    transition: all 0.2s ease !important;
    width: 100% !important;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

#biomarker-search-container input::placeholder,
.biomarker-search-input::placeholder {
    color: rgba(148, 163, 184, 0.7) !important;
}

#biomarker-search-container input:focus,
.biomarker-search-input:focus {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(99, 102, 241, 0.5) !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15), inset 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

/* Search icon styling */
#biomarker-search-container .search-icon,
.biomarker-search-wrapper .search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(148, 163, 184, 0.6);
    font-size: 0.9rem;
    pointer-events: none;
}

/* Quick Access / Analyte Bar - refined design */
.analyte-bar {
    background: rgba(15, 23, 42, 0.6) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 0.875rem 1.5rem !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
    margin: 0 !important;
    gap: 1rem !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Quick Access label */
.analyte-bar-label {
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    color: rgba(148, 163, 184, 0.8) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.analyte-bar-label i {
    color: var(--norcemic-green, #2E8B57);
    font-size: 0.8rem;
}

/* Analyte pills - refined style */
.analyte-pill {
    padding: 0.5rem 0.875rem !important;
    border-radius: 20px !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    background: rgba(255, 255, 255, 0.04) !important;
    color: rgba(226, 232, 240, 0.9) !important;
    font-size: 0.8125rem !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
    gap: 0.4rem !important;
}

.analyte-pill:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
    transform: translateY(-1px);
}

.analyte-pill.active {
    background: linear-gradient(135deg, var(--primary, #667eea), var(--primary-dark, #764ba2)) !important;
    border-color: transparent !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* Analyte dot indicators */
.analyte-dot {
    width: 8px !important;
    height: 8px !important;
    border-radius: 50%;
    flex-shrink: 0;
}

/* More biomarkers button */
.more-analytes-btn {
    padding: 0.5rem 1rem !important;
    border-radius: 20px !important;
    border: 1px dashed rgba(245, 166, 35, 0.5) !important;
    background: rgba(245, 166, 35, 0.08) !important;
    color: var(--norcemic-orange, #F5A623) !important;
    font-size: 0.8125rem !important;
    font-weight: 600 !important;
    transition: all 0.2s ease !important;
}

.more-analytes-btn:hover {
    background: var(--norcemic-orange, #F5A623) !important;
    border-style: solid !important;
    color: #fff !important;
}

/* Scrollbar for analyte bar */
#quickAnalyteBar {
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}

#quickAnalyteBar::-webkit-scrollbar {
    height: 4px;
}

#quickAnalyteBar::-webkit-scrollbar-track {
    background: transparent;
}

#quickAnalyteBar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
}

/* Main content spacing after sub-header */
.analyte-bar + .container {
    padding-top: 1.75rem !important;
}

/* ============================================================
   DASHBOARD CONTENT REFINEMENTS
   ============================================================ */

/* Hero card */
.hero-card {
    background: linear-gradient(145deg, var(--bg-card, #1e293b), rgba(30, 41, 59, 0.8)) !important;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
}

/* Cards general */
.card {
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Grid spacing */
.grid-2col {
    gap: 1.5rem !important;
}

.main-col, .side-col {
    gap: 1.5rem !important;
}

/* ============================================================
   RESPONSIVE - DASHBOARD HEADER
   ============================================================ */

@media (max-width: 1024px) {
    main > #dashboard-biomarker-search {
        padding: 1rem 1.25rem 0.5rem 1.25rem !important;
    }
    
    .analyte-bar {
        padding: 0.75rem 1.25rem !important;
    }
    
    #biomarker-search-container {
        max-width: 350px;
    }
}

@media (max-width: 768px) {
    main > #dashboard-biomarker-search {
        padding: 0.875rem 1rem 0.5rem 1rem !important;
    }
    
    #biomarker-search-container {
        max-width: 100%;
    }
    
    .analyte-bar {
        padding: 0.75rem 1rem !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
    }
    
    .analyte-bar-label {
        font-size: 0.6875rem !important;
    }
    
    .analyte-pill {
        padding: 0.4rem 0.75rem !important;
        font-size: 0.75rem !important;
    }
    
    .more-analytes-btn {
        padding: 0.4rem 0.75rem !important;
        font-size: 0.75rem !important;
    }
    
    .analyte-bar + .container {
        padding-top: 1.25rem !important;
    }
}

@media (max-width: 480px) {
    main > #dashboard-biomarker-search {
        padding: 0.75rem !important;
    }
    
    .analyte-bar {
        padding: 0.625rem 0.75rem !important;
    }
    
    .analyte-bar-label {
        display: none !important;
    }
    
    .analyte-pill {
        padding: 0.375rem 0.625rem !important;
        font-size: 0.6875rem !important;
    }
}

/* ============================================================
   LIGHT THEME - DASHBOARD HEADER
   ============================================================ */

:root[data-theme="light"] main > #dashboard-biomarker-search {
    background: linear-gradient(180deg, #f1f5f9 0%, #ffffff 100%);
}

:root[data-theme="light"] #biomarker-search-container input,
:root[data-theme="light"] .biomarker-search-input {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    color: #1e293b !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

:root[data-theme="light"] #biomarker-search-container input::placeholder {
    color: #94a3b8 !important;
}

:root[data-theme="light"] #biomarker-search-container input:focus {
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1), 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

:root[data-theme="light"] .analyte-bar {
    background: #ffffff !important;
    border-bottom-color: #e2e8f0 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

:root[data-theme="light"] .analyte-bar-label {
    color: #64748b !important;
}

:root[data-theme="light"] .analyte-pill {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
    color: #475569 !important;
}

:root[data-theme="light"] .analyte-pill:hover {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #1e293b !important;
}

:root[data-theme="light"] .analyte-pill.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
    color: #fff !important;
}

:root[data-theme="light"] .more-analytes-btn {
    background: rgba(245, 166, 35, 0.1) !important;
    border-color: rgba(245, 166, 35, 0.4) !important;
}

:root[data-theme="light"] #quickAnalyteBar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
}

/* ============================================================
   MOBILE QUICK ACCESS - IMPROVED LAYOUT
   ============================================================ */

/* Mobile Quick Access improvements */
@media (max-width: 768px) {
    /* Make analyte bar stack vertically on mobile */
    .analyte-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
        padding: 0.875rem 1rem !important;
    }
    
    /* Quick Access label row */
    .analyte-bar-label {
        display: flex !important;
        font-size: 0.6875rem !important;
        margin-bottom: 0.25rem;
    }
    
    /* Pills container - horizontal scroll */
    #quickAnalyteBar {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        gap: 0.5rem !important;
        padding: 0.375rem 0 !important;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
    }
    
    /* Individual pills */
    .analyte-pill {
        flex-shrink: 0 !important;
        scroll-snap-align: start;
        padding: 0.5rem 0.875rem !important;
        font-size: 0.75rem !important;
        min-width: auto !important;
    }
    
    /* More biomarkers button - full width below */
    .analyte-bar-right {
        display: flex !important;
        justify-content: center !important;
        width: 100% !important;
        padding-top: 0.5rem !important;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
        margin-top: 0.25rem;
    }
    
    .more-analytes-btn {
        width: 100% !important;
        justify-content: center !important;
        padding: 0.625rem 1rem !important;
        font-size: 0.8125rem !important;
    }
}

/* Small mobile - further refinements */
@media (max-width: 480px) {
    .analyte-bar {
        padding: 0.75rem !important;
        gap: 0.625rem !important;
    }
    
    .analyte-bar-label {
        font-size: 0.625rem !important;
    }
    
    #quickAnalyteBar {
        gap: 0.375rem !important;
        margin: 0 -0.75rem;
        padding: 0.375rem 0.75rem !important;
    }
    
    .analyte-pill {
        padding: 0.4375rem 0.75rem !important;
        font-size: 0.6875rem !important;
        border-radius: 16px !important;
    }
    
    .analyte-dot {
        width: 6px !important;
        height: 6px !important;
    }
    
    .more-analytes-btn {
        padding: 0.5rem 0.875rem !important;
        font-size: 0.75rem !important;
    }
    
    .analyte-bar-right {
        padding-top: 0.375rem !important;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    #quickAnalyteBar {
        gap: 0.25rem !important;
    }
    
    .analyte-pill {
        padding: 0.375rem 0.625rem !important;
        font-size: 0.625rem !important;
    }
}

/* Ensure scroll hint on mobile - gradient fade */
@media (max-width: 768px) {
    .analyte-bar {
        position: relative;
    }
    
    /* Right fade hint to indicate scrollability */
    #quickAnalyteBar::after {
        content: '';
        position: sticky;
        right: 0;
        top: 0;
        bottom: 0;
        width: 30px;
        background: linear-gradient(90deg, transparent, rgba(15, 23, 42, 0.9));
        pointer-events: none;
        flex-shrink: 0;
    }
}

/* Light theme mobile adjustments */
:root[data-theme="light"] #quickAnalyteBar::after {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.95));
}

:root[data-theme="light"] .analyte-bar-right {
    border-top-color: rgba(0, 0, 0, 0.06);
}

/* ============================================================
   MEASURE PAGE - STICKY ACTION BAR
   Appears when biomarkers are selected for better UX
   ============================================================ */

/* Sticky Measurement Bar */
.sticky-measure-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 1.5rem;
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.sticky-measure-bar.visible {
    transform: translateY(0);
}

.sticky-measure-bar-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

/* Selection info */
.sticky-measure-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.sticky-measure-count {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    color: #e2e8f0;
}

.sticky-measure-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 0.5rem;
    background: linear-gradient(135deg, var(--norcemic-green, #2E8B57), #059669);
    border-radius: 14px;
    font-size: 0.875rem;
    font-weight: 700;
    color: white;
}

.sticky-measure-label {
    color: #94a3b8;
    font-size: 0.875rem;
}

/* Selected biomarkers preview */
.sticky-measure-preview {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    max-width: 300px;
    overflow: hidden;
}

.sticky-preview-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    font-size: 0.75rem;
    color: #cbd5e1;
    white-space: nowrap;
}

.sticky-preview-more {
    font-size: 0.75rem;
    color: #64748b;
    white-space: nowrap;
}

/* Actions */
.sticky-measure-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sticky-settings-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sticky-settings-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
}

.sticky-settings-btn.active {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
    color: #818cf8;
}

.sticky-measure-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.875rem 2rem;
    background: linear-gradient(135deg, var(--norcemic-green, #2E8B57), #059669);
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(46, 139, 87, 0.3);
}

.sticky-measure-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 139, 87, 0.4);
}

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

.sticky-measure-btn i {
    font-size: 1.125rem;
}

/* Clear selection button */
.sticky-clear-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    font-size: 0.8125rem;
    color: #f87171;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sticky-clear-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.5);
}

/* Responsive - Tablet */
@media (max-width: 1024px) {
    .sticky-measure-bar {
        padding: 0.875rem 1.25rem;
    }
    
    .sticky-measure-preview {
        display: none;
    }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .sticky-measure-bar {
        padding: 0.75rem 1rem;
    }
    
    .sticky-measure-bar-container {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .sticky-measure-info {
        flex: 1 1 100%;
        justify-content: space-between;
    }
    
    .sticky-measure-actions {
        flex: 1 1 100%;
        justify-content: stretch;
    }
    
    .sticky-measure-btn {
        flex: 1;
        justify-content: center;
        padding: 0.75rem 1.5rem;
    }
    
    .sticky-settings-btn {
        width: 44px;
        flex-shrink: 0;
    }
    
    .sticky-clear-btn {
        display: none;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .sticky-measure-bar {
        padding: 0.625rem 0.75rem;
        padding-bottom: calc(0.625rem + env(safe-area-inset-bottom, 0));
    }
    
    .sticky-measure-count {
        font-size: 0.875rem;
    }
    
    .sticky-measure-btn {
        padding: 0.625rem 1rem;
        font-size: 0.9375rem;
    }
}

/* Light theme */
:root[data-theme="light"] .sticky-measure-bar {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.98) 100%);
    border-top-color: #e2e8f0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}

:root[data-theme="light"] .sticky-measure-count {
    color: #1e293b;
}

:root[data-theme="light"] .sticky-measure-label {
    color: #64748b;
}

:root[data-theme="light"] .sticky-preview-chip {
    background: #f1f5f9;
    color: #475569;
}

:root[data-theme="light"] .sticky-settings-btn {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #64748b;
}

:root[data-theme="light"] .sticky-settings-btn:hover {
    background: #f1f5f9;
    color: #1e293b;
}

/* Add padding to main content so it's not hidden behind sticky bar */
body.has-sticky-bar main,
body.has-sticky-bar .main-content {
    padding-bottom: 100px;
}

@media (max-width: 768px) {
    body.has-sticky-bar main,
    body.has-sticky-bar .main-content {
        padding-bottom: 140px;
    }
}



/* ============================================================
   QUANTUM CORRECTION LAYOUT FIX
   Ensures label stacks above value properly
   ============================================================ */

/* Reset any problematic styles and ensure proper stacking */
.correction-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
}

.correction-item-label {
    display: block !important;
    position: relative !important;
    width: 100% !important;
    font-size: 0.65rem !important;
    color: #64748b !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    margin-bottom: 0.5rem !important;
    order: 1 !important;
}

.correction-item-value {
    display: block !important;
    position: relative !important;
    width: 100% !important;
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    order: 2 !important;
}

.correction-item-value.raw {
    color: #94a3b8 !important;
    text-decoration: line-through !important;
}

.correction-item-value.corrected {
    color: #2e8b57 !important;
}

/* Container layout */
.correction-values {
    display: grid !important;
    grid-template-columns: 1fr auto 1fr !important;
    gap: 1rem !important;
    align-items: center !important;
}

.correction-arrow {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #2e8b57 !important;
    font-size: 1.25rem !important;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .correction-item-label {
        font-size: 0.55rem !important;
    }
    
    .correction-item-value {
        font-size: 1.25rem !important;
    }
    
    .correction-values {
        gap: 0.5rem !important;
    }
}

/* ============================================================
   QUANTUM CORRECTION - COMPREHENSIVE RESPONSIVE DESIGN
   Supports: Desktop, Tablet, Mobile, Small Mobile
   ============================================================ */

/* Large Desktop (1280px+) */
@media (min-width: 1280px) {
    .correction-values {
        gap: 1.5rem !important;
    }
    
    .correction-item-label {
        font-size: 0.75rem !important;
        margin-bottom: 0.625rem !important;
    }
    
    .correction-item-value {
        font-size: 1.75rem !important;
    }
    
    .correction-arrow {
        font-size: 1.5rem !important;
    }
}

/* Tablet (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .correction-values {
        gap: 1rem !important;
    }
    
    .correction-item-label {
        font-size: 0.65rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .correction-item-value {
        font-size: 1.5rem !important;
    }
    
    .correction-arrow {
        font-size: 1.25rem !important;
    }
}

/* Large Mobile (481px - 767px) */
@media (min-width: 481px) and (max-width: 767px) {
    .correction-values {
        gap: 0.75rem !important;
    }
    
    .correction-item-label {
        font-size: 0.6rem !important;
        margin-bottom: 0.375rem !important;
    }
    
    .correction-item-value {
        font-size: 1.375rem !important;
    }
    
    .correction-arrow {
        font-size: 1.125rem !important;
        padding: 0 0.25rem !important;
    }
}

/* Standard Mobile (361px - 480px) */
@media (min-width: 361px) and (max-width: 480px) {
    .correction-values {
        gap: 0.5rem !important;
        padding: 0 0.25rem !important;
    }
    
    .correction-item {
        min-width: 70px !important;
    }
    
    .correction-item-label {
        font-size: 0.55rem !important;
        letter-spacing: 0.03em !important;
        margin-bottom: 0.25rem !important;
    }
    
    .correction-item-value {
        font-size: 1.25rem !important;
    }
    
    .correction-arrow {
        font-size: 1rem !important;
        padding: 0 0.125rem !important;
    }
}

/* Small Mobile (≤360px) */
@media (max-width: 360px) {
    .correction-values {
        gap: 0.375rem !important;
        padding: 0 !important;
    }
    
    .correction-item {
        min-width: 60px !important;
    }
    
    .correction-item-label {
        font-size: 0.5rem !important;
        letter-spacing: 0 !important;
        margin-bottom: 0.1875rem !important;
    }
    
    .correction-item-value {
        font-size: 1.125rem !important;
    }
    
    .correction-arrow {
        font-size: 0.875rem !important;
        padding: 0 !important;
    }
    
    /* Correction display container */
    .correction-display {
        padding: 0.75rem !important;
    }
    
    .correction-header {
        font-size: 0.625rem !important;
    }
}

/* Extra Small (≤320px) - iPhone SE, etc */
@media (max-width: 320px) {
    .correction-values {
        gap: 0.25rem !important;
    }
    
    .correction-item {
        min-width: 50px !important;
    }
    
    .correction-item-label {
        font-size: 0.4375rem !important;
    }
    
    .correction-item-value {
        font-size: 1rem !important;
    }
    
    .correction-arrow {
        font-size: 0.75rem !important;
    }
}

/* Light theme support for all sizes */
:root[data-theme="light"] .correction-item-label {
    color: #64748b !important;
}

:root[data-theme="light"] .correction-item-value.raw {
    color: #94a3b8 !important;
}

:root[data-theme="light"] .correction-item-value.corrected {
    color: #059669 !important;
}

/* Dark theme support */
:root[data-theme="dark"] .correction-item-label {
    color: #94a3b8 !important;
}

:root[data-theme="dark"] .correction-item-value.raw {
    color: #64748b !important;
}

:root[data-theme="dark"] .correction-item-value.corrected {
    color: #10b981 !important;
}

/* ============================================================
   LIVE HEALTH DATA - IMPROVED RESPONSIVE GRID
   ============================================================ */

/* Health data grid container */
.health-data-grid,
.live-health-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
    gap: 1rem !important;
    padding: 1rem !important;
}

/* Individual health data cards */
.health-data-card,
.health-stat-card,
.live-health-item {
    background: rgba(30, 41, 59, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 12px !important;
    padding: 1.25rem !important;
    text-align: center !important;
    transition: all 0.2s ease !important;
}

.health-data-card:hover,
.health-stat-card:hover,
.live-health-item:hover {
    border-color: rgba(46, 139, 87, 0.4) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2) !important;
}

/* Label styling */
.health-data-label,
.health-stat-label {
    font-size: 0.7rem !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    color: #94a3b8 !important;
    margin-bottom: 0.5rem !important;
}

/* Value styling */
.health-data-value,
.health-stat-value {
    font-size: 2rem !important;
    font-weight: 700 !important;
    color: #f1f5f9 !important;
    line-height: 1.2 !important;
}

.health-data-value .unit,
.health-stat-value .unit {
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    color: #94a3b8 !important;
    margin-left: 0.25rem !important;
}

/* Status indicator */
.health-data-status,
.health-stat-status {
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    margin-top: 0.5rem !important;
    padding: 0.25rem 0.75rem !important;
    border-radius: 20px !important;
    display: inline-block !important;
}

.health-data-status.normal,
.health-stat-status.normal {
    background: rgba(34, 197, 94, 0.15) !important;
    color: #22c55e !important;
}

.health-data-status.warning {
    background: rgba(245, 158, 11, 0.15) !important;
    color: #f59e0b !important;
}

.health-data-status.danger {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444 !important;
}

/* Source device indicator */
.health-data-source,
.health-stat-source {
    font-size: 0.65rem !important;
    color: #64748b !important;
    margin-top: 0.375rem !important;
}

/* Responsive breakpoints */
@media (min-width: 1280px) {
    .health-data-grid,
    .live-health-grid {
        grid-template-columns: repeat(5, 1fr) !important;
    }
}

@media (min-width: 1024px) and (max-width: 1279px) {
    .health-data-grid,
    .live-health-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .health-data-grid,
    .live-health-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .health-data-value,
    .health-stat-value {
        font-size: 1.75rem !important;
    }
}

@media (min-width: 480px) and (max-width: 767px) {
    .health-data-grid,
    .live-health-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }
    
    .health-data-card,
    .health-stat-card,
    .live-health-item {
        padding: 1rem !important;
    }
    
    .health-data-value,
    .health-stat-value {
        font-size: 1.5rem !important;
    }
}

@media (max-width: 479px) {
    .health-data-grid,
    .live-health-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
        padding: 0.5rem !important;
    }
    
    .health-data-card,
    .health-stat-card,
    .live-health-item {
        padding: 0.75rem !important;
        border-radius: 8px !important;
    }
    
    .health-data-label,
    .health-stat-label {
        font-size: 0.6rem !important;
    }
    
    .health-data-value,
    .health-stat-value {
        font-size: 1.25rem !important;
    }
    
    .health-data-value .unit,
    .health-stat-value .unit {
        font-size: 0.7rem !important;
    }
    
    .health-data-status,
    .health-stat-status {
        font-size: 0.65rem !important;
        padding: 0.2rem 0.5rem !important;
    }
}

/* Light theme support */
:root[data-theme="light"] .health-data-card,
:root[data-theme="light"] .health-stat-card,
:root[data-theme="light"] .live-health-item {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
}

:root[data-theme="light"] .health-data-value,
:root[data-theme="light"] .health-stat-value {
    color: #1e293b !important;
}

:root[data-theme="light"] .health-data-label,
:root[data-theme="light"] .health-stat-label {
    color: #64748b !important;
}

/* ============================================================
   FITNESS EQUIPMENT BRAND COLORS
   ============================================================ */
.brand-concept2 { background: linear-gradient(135deg, #000000, #333333) !important; }
.brand-peloton { background: linear-gradient(135deg, #df1c2f, #b01525) !important; }
.brand-wahoo { background: linear-gradient(135deg, #00a0df, #0080b3) !important; }

/* ============================================================
   CATEGORY FILTER CARDS - IMPROVED UX
   ============================================================ */

/* Make category filter buttons look clickable */
.category-filter-btn {
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    user-select: none !important;
}

.category-filter-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.category-filter-btn:hover:not(.active) {
    border-color: var(--primary) !important;
    background: rgba(46, 139, 87, 0.1) !important;
}

.category-filter-btn:active {
    transform: translateY(0) !important;
}

.category-filter-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
    border-color: var(--primary) !important;
    color: white !important;
}

.category-filter-btn .badge {
    background: rgba(255, 255, 255, 0.2) !important;
    padding: 0.2rem 0.5rem !important;
    border-radius: 10px !important;
    font-size: 0.75rem !important;
    margin-left: 0.5rem !important;
}

.category-filter-btn.active .badge {
    background: rgba(255, 255, 255, 0.3) !important;
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth !important;
}

/* Your Devices section highlight when filtered */
#yourDevicesSection {
    scroll-margin-top: 100px !important;
}

/* Empty state when filtering */
.devices-empty-filtered {
    text-align: center !important;
    padding: 3rem 2rem !important;
    color: var(--text-muted) !important;
}

.devices-empty-filtered i {
    font-size: 3rem !important;
    margin-bottom: 1rem !important;
    opacity: 0.5 !important;
}

.devices-empty-filtered p {
    margin: 0 !important;
    font-size: 1rem !important;
}

/* Google/Pixel brand */
.brand-google { background: linear-gradient(135deg, #4285f4, #34a853) !important; }
.brand-phone { background: linear-gradient(135deg, #6366f1, #8b5cf6) !important; }

/* Generic smartwatch brand */
.brand-generic-watch { background: linear-gradient(135deg, #6366f1, #8b5cf6) !important; }

/* Data verification indicators */
.data-unknown {
    color: var(--text-muted) !important;
    font-style: italic !important;
    opacity: 0.7 !important;
}

.data-verified {
    color: var(--success) !important;
}

.data-verified::after {
    content: ' ✓';
    font-size: 0.7em;
    opacity: 0.7;
}

/* Device card data status */
.device-stat .stat-value .data-unknown {
    font-size: 0.9em;
}

/* ============================================================
   CATEGORY NAVIGATION & SECTION HIGHLIGHTING
   ============================================================ */

/* Section highlight animation when navigating */
.section-highlight {
    animation: sectionPulse 1.5s ease-out !important;
}

@keyframes sectionPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(46, 139, 87, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(46, 139, 87, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(46, 139, 87, 0);
    }
}

/* Category filter buttons - clickable styling */
.category-filter-btn {
    cursor: pointer !important;
    transition: all 0.25s ease !important;
    user-select: none !important;
    position: relative !important;
}

.category-filter-btn::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: all 0.25s ease;
    transform: translateX(-50%);
}

.category-filter-btn:hover::after {
    width: 80%;
}

.category-filter-btn.active::after {
    width: 100%;
    background: white;
}

/* Empty category state */
.devices-empty-category {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 2rem;
    background: rgba(30, 41, 59, 0.4);
    border-radius: 12px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

.devices-empty-category i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    opacity: 0.5;
}

.devices-empty-category p {
    color: var(--text-muted);
    margin: 0;
}

/* Scroll margin for header offset */
#yourDevicesSection {
    scroll-margin-top: 120px !important;
}
