/* Metabolic Physio Dashboard */
/* Neon theme (dashboards) + MP theme (home/branding) */

/* Biomarker Grid */
.marker-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
@media (min-width: 640px) { .marker-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .marker-grid { grid-template-columns: repeat(4, 1fr); } }

.marker-card {
    background: var(--neon-bg);
    border: 1px solid var(--neon-border);
    border-radius: 12px;
    padding: 12px 14px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}
.marker-card:hover {
    border-color: var(--neon-cyan);
    transform: translateY(-1px);
}
.marker-card .mc-name {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--neon-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.marker-card .mc-value {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}
.marker-card .mc-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
    font-size: 0.68rem;
}
.marker-card .mc-trend {
    font-weight: 600;
}
.mc-trend-good { color: #00FF9D; }
.mc-trend-bad { color: #FF3D71; }
.mc-trend-flat { color: var(--neon-muted); }

.marker-card .mc-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.mc-status-red { background: #FF3D71; }
.mc-status-amber { background: #FFB300; }
.mc-status-green { background: #00FF9D; }

/* Biomarker Detail View */
.biomarker-detail {
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.biomarker-detail .bd-info {
    background: var(--neon-bg);
    border: 1px solid var(--neon-border);
    border-radius: 12px;
    padding: 16px;
    margin-top: 16px;
}
.biomarker-detail .bd-info h4 {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--neon-muted);
    margin-bottom: 6px;
}
.biomarker-detail .bd-info p {
    font-size: 0.82rem;
    color: var(--neon-text);
    line-height: 1.55;
}

/* Panel tabs for biomarker grid */
.panel-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.panel-tab {
    padding: 5px 12px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--neon-muted);
    border: 1px solid var(--neon-border);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}
.panel-tab:hover { border-color: var(--neon-cyan); color: var(--neon-text); }
.panel-tab.active { background: var(--neon-cyan); color: var(--neon-bg); border-color: var(--neon-cyan); }

/* Toast Notifications */
#toastContainer {
    position: fixed;
    top: 80px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 380px;
}
.toast-notification {
    pointer-events: auto;
    transition: all 0.3s ease;
    transform: translateX(0);
    opacity: 1;
}
.toast-enter {
    transform: translateX(100%);
    opacity: 0;
}
.toast-exit {
    transform: translateX(100%);
    opacity: 0;
}

/* Notification toggle switch */
.notif-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.notif-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}
.notif-toggle .slider {
    position: absolute;
    inset: 0;
    background: #333;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}
.notif-toggle .slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #666;
    border-radius: 50%;
    transition: all 0.2s;
}
.notif-toggle input:checked + .slider {
    background: #00E5FF;
}
.notif-toggle input:checked + .slider::before {
    transform: translateX(20px);
    background: #fff;
}

/* Base Styles */
:root {
    /* Neon theme — used by dashboard, login, and other pages */
    --neon-bg: #0a0a0a;
    --neon-surface: #111111;
    --neon-border: #1a1a1a;
    --neon-cyan: #00E5FF;
    --neon-cyan-dim: rgba(0, 229, 255, 0.2);
    --neon-cyan-glow: rgba(0, 229, 255, 0.4);
    --neon-green: #00FF9D;
    --neon-amber: #FFB300;
    --neon-red: #FF3D71;
    --neon-text: #E0E0E0;
    --neon-muted: #6B7280;

    /* MP brand theme — used by index/home page */
    --mp-bg: #0c1929;
    --mp-deep: #0f2942;
    --mp-border: #1e3a5f;
    --mp-cyan: #22D3D8;
    --mp-text: #ffffff;
    --mp-muted: #94a3b8;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--neon-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--neon-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--neon-muted);
}

/* Selection */
::selection {
    background: var(--neon-cyan-dim);
    color: var(--neon-text);
}

/* Gauge Component */
.gauge-container {
    position: relative;
    width: 200px;
    height: 120px;
}

.gauge-svg {
    width: 100%;
    height: 100%;
}

.gauge-value {
    transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 0 8px var(--neon-cyan-glow));
}

.gauge-center {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Protocol Item Styling */
.protocol-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: var(--neon-bg);
    border: 1px solid var(--neon-border);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.protocol-item:hover {
    border-color: var(--neon-cyan-dim);
    background: rgba(0, 229, 255, 0.02);
}

.protocol-item .icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--neon-cyan-dim);
    border-radius: 6px;
    color: var(--neon-cyan);
}

.protocol-item .content {
    flex: 1;
    min-width: 0;
}

.protocol-item .name {
    font-weight: 500;
    color: var(--neon-text);
    margin-bottom: 2px;
}

.protocol-item .dosage {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--neon-cyan);
}

.protocol-item .timing {
    font-size: 11px;
    color: var(--neon-muted);
    margin-top: 4px;
}

/* Glow Effects */
.glow-cyan {
    box-shadow: 0 0 20px var(--neon-cyan-dim),
                0 0 40px rgba(0, 229, 255, 0.1);
}

.glow-text-cyan {
    text-shadow: 0 0 10px var(--neon-cyan-glow),
                 0 0 20px rgba(0, 229, 255, 0.2);
}

/* Stat Cards */
.stat-value {
    font-variant-numeric: tabular-nums;
}

/* Animation Keyframes */
@keyframes pulse-glow {
    0%, 100% {
        opacity: 1;
        filter: drop-shadow(0 0 8px var(--neon-cyan-glow));
    }
    50% {
        opacity: 0.8;
        filter: drop-shadow(0 0 15px var(--neon-cyan-glow));
    }
}

@keyframes scan-line {
    0% {
        transform: translateY(-100%);
    }
    100% {
        transform: translateY(100%);
    }
}

/* Scan line effect for forensic feel */
.scan-effect {
    position: relative;
    overflow: hidden;
}

.scan-effect::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg,
        transparent,
        var(--neon-cyan-dim),
        var(--neon-cyan),
        var(--neon-cyan-dim),
        transparent);
    animation: scan-line 3s linear infinite;
    opacity: 0.5;
}

/* Grid Pattern Background */
.grid-pattern {
    background-image:
        linear-gradient(rgba(0, 229, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 229, 255, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
}

/* Status Indicators */
.status-optimal {
    color: var(--neon-green);
}

.status-warning {
    color: var(--neon-amber);
}

.status-alert {
    color: var(--neon-red);
}

/* Chart Container */
#insulinChart {
    max-height: 256px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .gauge-container {
        width: 160px;
        height: 100px;
    }

    .gauge-center span:first-child {
        font-size: 2rem;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
    }

    .bg-neon-surface {
        background: #f5f5f5 !important;
    }

    .text-neon-cyan {
        color: #0891b2 !important;
    }

    .border-neon-border {
        border-color: #e5e5e5 !important;
    }
}

/* Loading States */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(0, 229, 255, 0.1),
        transparent);
    animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
    100% {
        left: 100%;
    }
}

/* Focus States for Accessibility */
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--neon-cyan);
    outline-offset: 2px;
}

/* Transition Utilities */
.transition-glow {
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.transition-glow:hover {
    box-shadow: 0 0 20px var(--neon-cyan-dim);
    border-color: var(--neon-cyan-dim);
}
