/* ==========================================================================
   GARMIN ENDURANCE AUTONOMOUS COACH - PRECISION DARK PALETTE & DESIGN SYSTEM
   Framework: Bootstrap 5.3 + Vanilla CSS (No Tailwind CSS)
   ========================================================================== */

:root {
    --font-body: 'Inter', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-heading: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    /* Precision Dark Palette (Obsidian & Linear Depth) */
    --obsidian: #080A0E;
    --surface: #10141E;
    --surface-light: #161D2B;
    --surface-accent: #131926;
    --line: rgba(255, 255, 255, 0.06);
    --line-subtle: rgba(255, 255, 255, 0.04);
    --line-hover: rgba(255, 255, 255, 0.12);

    /* Signal colors */
    --optimal: #10B981;
    --optimal-glow: rgba(16, 185, 129, 0.35);
    --warn: #F59E0B;
    --warn-glow: rgba(245, 158, 11, 0.3);
    --alert: #F43F5E;
    --alert-glow: rgba(244, 63, 94, 0.35);
    --tele: #38BDF8;
    --tele-glow: rgba(56, 189, 248, 0.35);
    --inactive: #64748b;

    /* Semantic mapping */
    --background: var(--obsidian);
    --foreground: #F8FAFC;
    --card: var(--surface);
    --border: var(--line);
    --radius-lg: 1rem;
    --radius-md: 0.75rem;
    --radius-sm: 0.5rem;
}

body {
    background-color: var(--obsidian) !important;
    color: var(--foreground);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    letter-spacing: -0.011em;
}

h1, h2, h3, h4, h5, h6, .font-heading {
    font-family: var(--font-heading);
    letter-spacing: -0.02em;
}

code, .font-mono {
    font-family: var(--font-mono) !important;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--obsidian);
}
::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #334155;
}

/* Glass & Glow */
.glass-panel {
    background: linear-gradient(180deg, #10141E 0%, #0C0F17 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px -4px rgba(0, 0, 0, 0.5);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.glass-panel:hover {
    border-color: var(--line-hover);
}

.card-linear {
    background: linear-gradient(180deg, #10141E 0%, #0C0F17 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px -4px rgba(0, 0, 0, 0.5);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.card-linear:hover {
    border-color: var(--line-hover);
}

/* Activity Feed Card */
.activity-feed-card {
    background-color: #10141E;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0.75rem;
    padding: 0.85rem 1.15rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 10px -2px rgba(0, 0, 0, 0.4);
}
.activity-feed-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background-color: #131926;
    transform: translateY(-1px);
    box-shadow: 0 4px 20px -4px rgba(0, 0, 0, 0.6);
}
.activity-feed-card .action-btn {
    opacity: 0;
    transform: translateX(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.activity-feed-card:hover .action-btn {
    opacity: 1;
    transform: translateX(0);
}

.panel-glow-tele {
    border-color: rgba(6, 182, 212, 0.35);
    box-shadow: 0 0 25px -5px rgba(6, 182, 212, 0.15);
}

.grid-bg-overlay {
    background-image: linear-gradient(to right, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
                      linear-gradient(to bottom, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 24px 24px;
}

/* Color accents */
.text-tele { color: var(--tele) !important; }
.text-optimal { color: var(--optimal) !important; }
.text-warn { color: var(--warn) !important; }
.text-alert { color: var(--alert) !important; }
.text-inactive { color: var(--inactive) !important; }

.bg-tele-subtle { background-color: rgba(6, 182, 212, 0.12) !important; color: var(--tele); border: 1px solid rgba(6, 182, 212, 0.25); }
.bg-optimal-subtle { background-color: rgba(16, 185, 129, 0.12) !important; color: var(--optimal); border: 1px solid rgba(16, 185, 129, 0.25); }
.bg-warn-subtle { background-color: rgba(245, 158, 11, 0.12) !important; color: var(--warn); border: 1px solid rgba(245, 158, 11, 0.25); }
.bg-alert-subtle { background-color: rgba(239, 68, 68, 0.12) !important; color: var(--alert); border: 1px solid rgba(239, 68, 68, 0.25); }

/* Status Dots */
.status-dot {
    width: 8px !important;
    height: 8px !important;
    min-width: 8px !important;
    min-height: 8px !important;
    max-width: 8px !important;
    max-height: 8px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 50% !important;
    display: inline-block !important;
    flex-shrink: 0 !important;
    box-sizing: content-box !important;
    vertical-align: middle !important;
}
.status-dot.optimal, .status-dot.dot-optimal { background-color: var(--optimal) !important; box-shadow: 0 0 8px var(--optimal-glow) !important; }
.status-dot.warn, .status-dot.dot-warn { background-color: var(--warn) !important; box-shadow: 0 0 8px var(--warn-glow) !important; }
.status-dot.alert, .status-dot.dot-alert { background-color: var(--alert) !important; box-shadow: 0 0 8px var(--alert-glow) !important; }
.status-dot.tele, .status-dot.dot-tele { background-color: var(--tele) !important; box-shadow: 0 0 8px var(--tele-glow) !important; }
.status-dot.neutral, .status-dot.dot-neutral { background-color: #64748b !important; box-shadow: none !important; }

@keyframes pulseGlow {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.55; transform: scale(0.92); }
}
.pulse {
    animation: pulseGlow 2.2s infinite ease-in-out;
}

/* Sidebar Styling */
.app-sidebar {
    width: 260px;
    background: #090C12;
    border-right: 1px solid var(--line);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1025;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        top: 57px;
        bottom: 0;
        left: 0;
        transform: translateX(-100%);
    }
    .app-sidebar.show {
        transform: translateX(0);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    }
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    color: #94a3b8;
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
}
.sidebar-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}
.sidebar-link.active {
    color: #06b6d4;
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.25);
    font-weight: 600;
}

/* AI Copilot Drawer */
.copilot-drawer {
    position: fixed;
    top: 57px;
    right: 0;
    bottom: 0;
    width: 440px;
    max-width: 100vw;
    background: #0f1629;
    border-left: 1px solid var(--line);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1050;
    display: flex;
    flex-direction: column;
}
.copilot-drawer.open {
    transform: translateX(0);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
}
.copilot-backdrop {
    display: none;
    position: fixed;
    top: 57px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    z-index: 1045;
}
.copilot-backdrop.show {
    display: block;
}

@media (max-width: 767.98px) {
    .copilot-drawer {
        width: 100vw;
        border-left: none;
        top: 0;
        z-index: 1060;
    }
    .copilot-backdrop {
        top: 0;
        z-index: 1055;
    }
}

body.copilot-open {
    overflow: hidden !important;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 57px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    z-index: 1020;
}
.sidebar-backdrop.show {
    display: block;
}

.copilot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.chat-msg {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    line-height: 1.5;
    max-width: 88%;
}
.chat-msg.user {
    background: rgba(6, 182, 212, 0.15);
    border: 1px solid rgba(6, 182, 212, 0.3);
    color: #e2e8f0;
    align-self: flex-end;
}
.chat-msg.ai {
    background: #151e34;
    border: 1px solid var(--line);
    color: #cbd5e1;
    align-self: flex-start;
}

/* Custom Table Style */
.table-dark-custom {
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--line);
    color: #e2e8f0;
    font-size: 0.825rem;
    margin: 0;
}
.table-dark-custom th {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--inactive);
    border-bottom-width: 1px;
    font-family: var(--font-mono);
    font-weight: 600;
    padding: 0.75rem 0.6rem;
}
.table-dark-custom td {
    padding: 0.75rem 0.6rem;
    border-color: var(--line);
}
.table-dark-custom tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Dial/Gauge widget */
.kpi-dial-wrapper {
    position: relative;
    width: 68px;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.kpi-dial-text {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Muscle part hover */
.muscle-part {
    cursor: pointer;
    transition: all 0.2s ease;
}
.muscle-part:hover {
    filter: brightness(1.3) drop-shadow(0 0 5px rgba(6, 182, 212, 0.6));
}

/* Tooltip helper trigger */
.explain-tooltip-trigger {
    cursor: pointer;
    color: var(--inactive);
    transition: color 0.15s ease;
    font-size: 0.8rem;
    margin-left: 0.35rem;
}
.explain-tooltip-trigger:hover {
    color: var(--tele);
}

/* HR Zone Progress Bar */
.hr-zone-bar {
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
}
.hr-zone-segment {
    height: 100%;
    transition: width 0.3s ease;
}
.hr-zone-1 { background-color: #64748b; }
.hr-zone-2 { background-color: #06b6d4; }
.hr-zone-3 { background-color: #10b981; }
.hr-zone-4 { background-color: #f59e0b; }
.hr-zone-5 { background-color: #ef4444; }

/* Modal Content Backdrops */
.modal-content {
    background-color: var(--surface) !important;
    border-color: var(--line) !important;
    border-radius: var(--radius-lg);
}
.modal-header, .modal-footer {
    border-color: var(--line) !important;
}

/* Form controls focus and dark state */
.form-control, .form-select {
    border-radius: var(--radius-md);
}
.form-control:focus, .form-select:focus {
    background-color: #0d1424 !important;
    border-color: var(--tele) !important;
    box-shadow: 0 0 0 0.2rem rgba(6, 182, 212, 0.25) !important;
    color: #fff !important;
}

/* ==========================================================================
   NEW MODULES: Onboarding Checklist, Recovery Hub, Telemetry Chart
   ========================================================================== */

/* Step / Onboarding cards */
.onboarding-step-card {
    transition: transform 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}
.onboarding-step-card:hover {
    border-color: rgba(6, 182, 212, 0.4) !important;
    background: rgba(19, 27, 46, 0.95) !important;
    transform: translateY(-1px);
}
.onboarding-step-badge {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
}
.onboarding-step-badge.done {
    background: rgba(16, 185, 129, 0.2);
    color: var(--optimal);
    border: 1px solid var(--optimal);
}
.onboarding-step-badge.pending {
    background: rgba(100, 116, 139, 0.2);
    color: var(--inactive);
    border: 1px solid var(--line);
}

/* Telemetry Chart Toggle Buttons */
.telemetry-btn.active {
    background-color: rgba(6, 182, 212, 0.2) !important;
    border-color: var(--tele) !important;
    color: #fff !important;
}

/* Recovery Hub Cards */
.recovery-metric-card {
    transition: border-color 0.2s ease;
}
.recovery-metric-card:hover {
    border-color: rgba(6, 182, 212, 0.3) !important;
}

/* Bootstrap Accordion & Collapse vs Tailwind CSS Conflict Fix */
.accordion-collapse,
.accordion-collapse.collapse,
.accordion-collapse.collapse.show,
.collapse.show,
.collapsing {
    visibility: visible !important;
}

/* Linear Precision Workout Card in AI Copilot Chat */
.workout-card {
    background: #0f1629;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.workout-card-header {
    background: rgba(15, 23, 42, 0.7);
    border-bottom: 1px solid var(--line);
}

.workout-card-body {
    background: #0d1322;
}

.workout-step-item {
    background: rgba(21, 30, 52, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.workout-step-item:hover {
    background: rgba(21, 30, 52, 0.9);
    border-color: rgba(6, 182, 212, 0.3);
}

.workout-step-badge {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
}

.workout-step-badge.warmup {
    background: rgba(234, 179, 8, 0.15);
    color: #facc15;
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.workout-step-badge.cooldown {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.workout-step-badge.strength {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.workout-step-badge.interval {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.workout-step-badge.rest {
    background: rgba(100, 116, 139, 0.15);
    color: #94a3b8;
    border: 1px solid rgba(100, 116, 139, 0.3);
}

.workout-card-footer {
    background: rgba(15, 23, 42, 0.85);
    border-top: 1px solid var(--line);
}



