/* ==================== FASTING DASHBOARD ==================== */

/* State-based color variables */
body.state-fasting {
    --primary-gradient: linear-gradient(135deg, #5e35b1 0%, #7e57c2 100%);
    --secondary-gradient: linear-gradient(135deg, #7e57c2 0%, #9575cd 100%);
    --accent-color: #9575cd;
    --text-primary: #4527a0;
    --text-secondary: #5e35b1;
}

body.state-eating {
    --primary-gradient: linear-gradient(135deg, #1b5e20 0%, #2e7d32 100%);
    --secondary-gradient: linear-gradient(135deg, #2e7d32 0%, #388e3c 100%);
    --accent-color: #66bb6a;
    --text-primary: #1b5e20;
    --text-secondary: #2e7d32;
}

.fasting-panel {
    background: var(--glass-bg);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    margin: 0 var(--spacing-lg) var(--spacing-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--glass-border);
    transition: var(--transition);
}

.fasting-container {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--spacing-xl);
    align-items: center;
}

/* Circular Timer */
.fasting-timer {
    position: relative;
    width: 200px;
    height: 200px;
}

.timer-circle {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-bg {
    fill: none;
    stroke: var(--bg-tertiary);
    stroke-width: 8;
}

.timer-progress {
    fill: none;
    stroke: url(#timer-gradient);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 565.48;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
}

.timer-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 100%;
}

.timer-state {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.timer-display {
    font-size: 32px;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.timer-label {
    font-size: 12px;
    color: var(--text-muted);
}

/* Fasting Info */
.fasting-info {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.fasting-protocol {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.protocol-icon {
    font-size: 32px;
}

.protocol-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.protocol-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.protocol-window {
    font-size: 14px;
    color: var(--text-muted);
}

/* Dynamic Tips */
.fasting-tips {
    padding: var(--spacing-md);
    background: linear-gradient(135deg, rgba(27, 94, 32, 0.05) 0%, rgba(46, 125, 50, 0.05) 100%);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--accent-color);
}

.tip-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.tip-icon {
    font-size: 20px;
}

.tip-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
}

.tip-content {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    margin: 0;
}

/* Protocol Options in Onboarding */
.protocol-option {
    padding: var(--spacing-md) !important;
}

.protocol-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-left: var(--spacing-sm);
}

.protocol-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.protocol-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
}

.form-helper {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
    margin-bottom: var(--spacing-sm);
}

/* Responsive Design */
@media (max-width: 768px) {
    .fasting-container {
        grid-template-columns: 1fr;
        text-align: center;
        justify-items: center;
    }

    .fasting-timer {
        width: 180px;
        height: 180px;
    }

    .timer-display {
        font-size: 28px;
    }

    .fasting-panel {
        padding: var(--spacing-lg);
        margin: 0 var(--spacing-md) var(--spacing-md);
    }
}

/* Add SVG gradient definition */
svg defs {
    display: none;
}

/* ==================== METABOLIC TIMELINE (Issue #20) ==================== */
.metabolic-timeline {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--glass-border);
}

.timeline-header {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: 8px;
}

.timeline-header::before {
    content: '🧬';
    font-size: 18px;
}

.timeline-track {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-left: 12px;
    /* Space for the line */
}

/* The vertical line */
.timeline-track::before {
    content: '';
    position: absolute;
    left: 27px;
    /* Align with marker center */
    top: 10px;
    bottom: 30px;
    width: 2px;
    background: var(--bg-tertiary);
    /* Inactive line color */
    z-index: 0;
}

.timeline-step {
    display: flex;
    gap: 16px;
    position: relative;
    z-index: 1;
    opacity: 0.5;
    /* Default inactive state */
    transition: all 0.5s ease;
    filter: grayscale(0.8);
}

.step-marker {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 2px solid var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
    z-index: 2;
}

.step-icon {
    font-size: 16px;
}

.step-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 4px;
}

.step-time {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.step-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: left;
    /* Ensure title is left-aligned even if container is centered in mobile */
}

.step-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
    display: none;
    /* Hidden by default to save space */
    text-align: left;
}

/* === STATES === */

/* Past (Completed) */
.timeline-step.past {
    opacity: 1;
    filter: grayscale(0);
}

.timeline-step.past .step-marker {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

/* Active (Current) */
.timeline-step.active {
    opacity: 1;
    filter: grayscale(0);
    transform: scale(1.02);
}

.timeline-step.active .step-marker {
    background: var(--accent-color);
    border-color: var(--text-primary);
    box-shadow: 0 0 15px rgba(102, 187, 106, 0.4);
    animation: pulseMarker 2s infinite;
}

.timeline-step.active .step-desc {
    display: block;
    /* Show details for active stage */
    animation: fadeIn 0.5s ease;
}

@keyframes pulseMarker {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.4);
    }

    /* Using green approx as base, specific color varies by theme */
    70% {
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}