/**
 * Personalized Nutrition Label Styles
 * Styles for compatibility ring, alerts, badges, progress bars, and ingredient analysis
 */

/* ============================================
   COMPATIBILITY RING (Animated SVG Circle)
   ============================================ */

.compatibility-ring-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.compatibility-ring {
    position: relative;
    width: 100px;
    height: 100px;
}

.compatibility-ring svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.compatibility-ring .ring-bg {
    fill: none;
    stroke: #e9ecef;
    stroke-width: 8;
}

.compatibility-ring .ring-progress {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease-out, stroke 0.3s ease;
}

/* Ring colors based on score */
.compatibility-ring .ring-progress.score-great {
    stroke: #28a745;
}

.compatibility-ring .ring-progress.score-good {
    stroke: #5cb85c;
}

.compatibility-ring .ring-progress.score-neutral {
    stroke: #ffc107;
}

.compatibility-ring .ring-progress.score-poor {
    stroke: #fd7e14;
}

.compatibility-ring .ring-progress.score-bad {
    stroke: #dc3545;
}

.compatibility-ring .ring-score {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.compatibility-ring .ring-score .score-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}

.compatibility-ring .ring-score .score-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: #6c757d;
    letter-spacing: 0.05em;
}

/* Compact ring variant for smaller displays */
.compatibility-ring.compact {
    width: 70px;
    height: 70px;
}

.compatibility-ring.compact .ring-score .score-value {
    font-size: 1.1rem;
}

.compatibility-ring.compact .ring-score .score-label {
    font-size: 0.55rem;
}


/* ============================================
   ALERTS (Critical / Warning / Caution)
   ============================================ */

.nutrition-alerts {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nutrition-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border-left: 4px solid;
}

.nutrition-alert .alert-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.nutrition-alert .alert-content {
    flex: 1;
    min-width: 0;
}

.nutrition-alert .alert-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.nutrition-alert .alert-message {
    font-size: 0.8rem;
    opacity: 0.85;
    margin-top: 0.1rem;
}

/* Critical (red) */
.nutrition-alert.alert-critical {
    background-color: rgba(220, 53, 69, 0.1);
    border-left-color: #dc3545;
    color: #842029;
}

.nutrition-alert.alert-critical .alert-icon {
    color: #dc3545;
}

/* Warning (yellow/amber) */
.nutrition-alert.alert-warning-custom {
    background-color: rgba(255, 193, 7, 0.15);
    border-left-color: #ffc107;
    color: #664d03;
}

.nutrition-alert.alert-warning-custom .alert-icon {
    color: #cc9a06;
}

/* Caution (cyan/info) */
.nutrition-alert.alert-caution {
    background-color: rgba(13, 202, 240, 0.1);
    border-left-color: #0dcaf0;
    color: #055160;
}

.nutrition-alert.alert-caution .alert-icon {
    color: #0dcaf0;
}


/* ============================================
   GOAL BADGES (Wellness attribute pills)
   ============================================ */

.goal-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.goal-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 500;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.goal-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.goal-badge i {
    font-size: 0.9rem;
}

/* Badge color variants */
.goal-badge.badge-success {
    background-color: rgba(40, 167, 69, 0.15);
    color: #198754;
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.goal-badge.badge-primary {
    background-color: rgba(13, 110, 253, 0.15);
    color: #0d6efd;
    border: 1px solid rgba(13, 110, 253, 0.3);
}

.goal-badge.badge-info {
    background-color: rgba(13, 202, 240, 0.15);
    color: #0dcaf0;
    border: 1px solid rgba(13, 202, 240, 0.3);
}

.goal-badge.badge-warning {
    background-color: rgba(255, 193, 7, 0.2);
    color: #997404;
    border: 1px solid rgba(255, 193, 7, 0.4);
}


/* ============================================
   NUTRITION PROGRESS BARS (% DRV)
   ============================================ */

.nutrition-progress-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.nutrition-progress-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nutrition-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.85rem;
}

.nutrition-progress-name {
    font-weight: 500;
    color: #212529;
}

.nutrition-progress-value {
    color: #6c757d;
    font-size: 0.8rem;
}

.nutrition-progress-bar {
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.nutrition-progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s ease-out;
}

/* Animated fill on page load */
.nutrition-progress-fill[data-animate] {
    width: 0 !important;
}

.nutrition-progress-fill.animated {
    transition: width 0.8s ease-out;
}

/* Progress bar colors */
.nutrition-progress-fill.bg-success {
    background-color: #28a745;
}

.nutrition-progress-fill.bg-info {
    background-color: #17a2b8;
}

.nutrition-progress-fill.bg-warning {
    background-color: #ffc107;
}

.nutrition-progress-fill.bg-danger {
    background-color: #dc3545;
}

.nutrition-progress-fill.bg-primary {
    background-color: #0d6efd;
}

.nutrition-progress-fill.bg-secondary {
    background-color: #6c757d;
}


/* ============================================
   CONTEXTUAL INSIGHTS
   ============================================ */

.contextual-insights {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.insight-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.85rem;
}

.insight-item i {
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.insight-item.insight-positive {
    background-color: rgba(40, 167, 69, 0.1);
    color: #155724;
}

.insight-item.insight-positive i {
    color: #28a745;
}

.insight-item.insight-concern {
    background-color: rgba(255, 193, 7, 0.15);
    color: #856404;
}

.insight-item.insight-concern i {
    color: #d39e00;
}

.insight-item.insight-neutral {
    background-color: rgba(108, 117, 125, 0.1);
    color: #495057;
}

.insight-item.insight-neutral i {
    color: #6c757d;
}


/* ============================================
   INGREDIENT ANALYSIS PANEL
   ============================================ */

.ingredient-analysis-panel {
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
    overflow: hidden;
}

.ingredient-analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background-color: #f8f9fa;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.ingredient-analysis-header:hover {
    background-color: #e9ecef;
}

.ingredient-analysis-header .header-title {
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ingredient-analysis-header .header-summary {
    font-size: 0.8rem;
    color: #6c757d;
}

.ingredient-analysis-header .toggle-icon {
    transition: transform 0.3s ease;
}

.ingredient-analysis-panel.expanded .toggle-icon {
    transform: rotate(180deg);
}

.ingredient-analysis-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.ingredient-analysis-panel.expanded .ingredient-analysis-body {
    max-height: 500px;
    overflow-y: auto;
}

.ingredient-analysis-list {
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ingredient-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.85rem;
    transition: background-color 0.2s ease;
}

.ingredient-item:hover {
    background-color: #f8f9fa;
}

.ingredient-item .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ingredient-item .status-dot.status-ok {
    background-color: #adb5bd;
}

.ingredient-item .status-dot.status-wanted {
    background-color: #28a745;
}

.ingredient-item .status-dot.status-warning {
    background-color: #ffc107;
}

.ingredient-item .status-dot.status-moderate {
    background-color: #17a2b8;
}

.ingredient-item .status-dot.status-avoid {
    background-color: #dc3545;
}

.ingredient-item .ingredient-name {
    flex: 1;
    min-width: 0;
}

.ingredient-item .ingredient-reason {
    font-size: 0.75rem;
    color: #6c757d;
    margin-left: auto;
    text-align: right;
    max-width: 50%;
}

/* Status-specific styling */
.ingredient-item.status-avoid {
    background-color: rgba(220, 53, 69, 0.08);
}

.ingredient-item.status-avoid .ingredient-name {
    color: #842029;
    font-weight: 500;
}

.ingredient-item.status-warning {
    background-color: rgba(255, 193, 7, 0.1);
}

.ingredient-item.status-warning .ingredient-name {
    color: #664d03;
}

.ingredient-item.status-wanted {
    background-color: rgba(40, 167, 69, 0.08);
}

.ingredient-item.status-wanted .ingredient-name {
    color: #155724;
}


/* ============================================
   MACRO PIE CHART (Large)
   ============================================ */

.macro-pie-wrapper {
    padding: 0.5rem;
}

.macro-pie-large {
    width: 120px;
    height: 120px;
    position: relative;
}

.macro-pie-svg {
    width: 100%;
    height: 100%;
}

.macro-pie-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: white;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.macro-cal-value {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1;
    color: #212529;
}

.macro-cal-label {
    font-size: 0.65rem;
    color: #6c757d;
    text-transform: uppercase;
}

.macro-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.8rem;
}

.macro-legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.macro-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}


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

@media (max-width: 576px) {
    .compatibility-ring {
        width: 80px;
        height: 80px;
    }

    .compatibility-ring .ring-score .score-value {
        font-size: 1.25rem;
    }

    .goal-badge {
        font-size: 0.75rem;
        padding: 0.25rem 0.6rem;
    }

    .nutrition-alert {
        padding: 0.6rem 0.75rem;
    }

    .nutrition-alert .alert-icon {
        font-size: 1rem;
    }

    .ingredient-item .ingredient-reason {
        display: none;
    }

    /* Macro pie chart responsive */
    .macro-pie-large {
        width: 100px;
        height: 100px;
    }

    .macro-pie-center {
        width: 50px;
        height: 50px;
    }

    .macro-cal-value {
        font-size: 0.95rem;
    }

    .macro-legend {
        font-size: 0.75rem;
        gap: 0.5rem;
    }
}

/* Print styles */
@media print {
    .compatibility-ring .ring-progress {
        transition: none;
    }

    .nutrition-progress-fill {
        transition: none;
    }

    .ingredient-analysis-panel.expanded .ingredient-analysis-body {
        max-height: none;
    }
}
