/**
 * HEALIST STAT CARD DETAIL MODALS
 * ================================
 */

/* Stat Card Click Hint */
.stat-card {
  cursor: pointer;
  position: relative;
}

.stat-card-hint {
  position: absolute;
  top: 8px;
  left: 12px;
  font-size: 11px;
  color: var(--brand-primary);
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.stat-card:hover .stat-card-hint {
  opacity: 1;
  color: var(--brand-secondary);
}

/* Modal Overlay */
.stat-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

/* Modal Container */
.stat-modal {
  background: var(--brand-surface);
  border-radius: 16px;
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
}

/* Modal Header */
.stat-modal-header {
  padding: var(--space-5);
  background: linear-gradient(135deg, var(--brand-primary-dark) 0%, var(--brand-primary) 100%);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 16px 16px 0 0;
}

.stat-modal-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.stat-modal-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.stat-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Day Range Selector */
.stat-modal-day-selector {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--brand-border);
  background: var(--brand-surface-elevated);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.stat-modal-day-label {
  font-size: var(--text-sm);
  color: var(--brand-text-muted);
  font-weight: var(--font-medium);
}

.stat-modal-day-select {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  font-size: var(--text-base);
  color: var(--brand-primary);
  background: var(--brand-surface);
  cursor: pointer;
  font-weight: var(--font-medium);
}

.stat-modal-day-select:focus {
  outline: none;
  border-color: var(--brand-secondary);
  box-shadow: 0 0 0 3px rgba(201, 169, 98, 0.2);
}

/* Modal Body */
.stat-modal-body {
  padding: var(--space-5);
  overflow-y: auto;
  max-height: calc(80vh - 180px);
}

/* Modal Footer */
.stat-modal-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--brand-border);
  background: var(--brand-surface-elevated);
  font-size: var(--text-sm);
  color: var(--brand-text-muted);
}

/* History Date Group */
.history-date-group {
  margin-bottom: var(--space-5);
}

.history-date-header {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--brand-primary);
  margin-bottom: var(--space-2);
  padding-bottom: var(--space-1);
  border-bottom: 1px solid var(--brand-border);
}

/* History Entry Row */
.history-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3);
  background: var(--brand-surface-elevated);
  border-radius: var(--radius);
  margin-bottom: var(--space-2);
}

.history-entry-time {
  font-size: var(--text-sm);
  color: var(--brand-text-muted);
}

.history-entry-value {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--brand-primary);
}

.history-entry-source {
  font-size: var(--text-xs);
  color: var(--brand-text-placeholder);
  margin-left: var(--space-2);
}

/* Daily Total */
.history-daily-total {
  display: flex;
  justify-content: space-between;
  padding: var(--space-3);
  background: var(--color-info-light);
  border-radius: var(--radius);
  margin-top: var(--space-2);
}

.history-daily-total-label {
  font-size: var(--text-sm);
  color: var(--color-info);
}

.history-daily-total-value {
  font-weight: var(--font-bold);
  color: var(--color-info);
}

/* Nutrition Day Card */
.nutrition-day-card {
  padding: var(--space-4);
  background: var(--brand-surface-elevated);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
}

.nutrition-day-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}

.nutrition-day-date {
  font-weight: var(--font-semibold);
  color: var(--brand-primary);
}

.nutrition-day-value {
  font-weight: var(--font-bold);
  color: var(--brand-primary);
}

/* Progress Bar */
.nutrition-progress-bar {
  height: 8px;
  background: var(--brand-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.nutrition-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-success) 0%, var(--color-success) 100%);
  border-radius: var(--radius-sm);
  transition: width 0.3s ease;
}

.nutrition-progress-fill.over {
  background: linear-gradient(90deg, var(--color-warning) 0%, var(--color-warning) 100%);
}

.nutrition-goal-text {
  font-size: var(--text-xs);
  color: var(--brand-text-muted);
  margin-top: var(--space-1);
}

/* Score Component */
.score-component {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4);
  background: var(--brand-surface-elevated);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
}

.score-component-info {
  flex: 1;
}

.score-component-name {
  font-weight: var(--font-semibold);
  color: var(--brand-primary);
  margin-bottom: 2px;
}

.score-component-desc {
  font-size: var(--text-sm);
  color: var(--brand-text-muted);
}

.score-component-values {
  text-align: right;
}

.score-component-score {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--brand-primary);
}

.score-component-weight {
  font-size: var(--text-xs);
  color: var(--brand-text-muted);
}

/* Total Score Box */
.score-total-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4);
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-light) 100%);
  border-radius: var(--radius-md);
  margin-top: var(--space-4);
  color: var(--brand-text-light);
}

.score-total-label {
  font-weight: var(--font-semibold);
}

.score-total-value {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
}

/* Loading State */
.stat-modal-loading {
  text-align: center;
  padding: var(--space-8);
  color: var(--brand-text-muted);
}