/* ====== 분석 페이지 공통 스타일 ====== */

/* 헤더 하단 구분선 - 모든 analysis 페이지 공통 적용 */
.app-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0px;
  right: 0px;
  height: 1px;
  background: var(--layer, #E5E5E5);
  border-radius: 1px;
}

/* 분석 날짜 선택 페이지 스타일 */
.analysis-date-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: var(--spacing-lg);
    text-align: center;
}

.analysis-title {
    color: var(--main, #56AAB2);
    font-family: Koulen;
    font-size: 40px;
    font-style: normal;
    font-weight: 400;
    line-height: normal;    
}

.analysis-subtitle {
    text-align: center;
    font-family: Inter;
    font-size: 15px;
    font-style: normal;
    line-height: 20px;
    color: var(--main, #56AAB2);
    margin-bottom: 45px;
}

.date-selection-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-lg);
    width: 100%;
    max-width: 320px;
}

.date-range-container {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: var(--spacing-md);
  width: 100%;
}

.date-input-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.date-label {
  font-size: 14px;
  color: var(--gray-100);
  text-align: center;
}

.date-input {
  padding: 14px var(--spacing-md);
  border: 1px solid var(--gray-50);
  border-radius: var(--border-radius-sm);
  font-size: 16px;
  font-family: var(--font-primary);
  background-color: var(--white);
  color: var(--black);
  text-align: center;
  transition: all 0.3s ease;
  width: 100%;
}

.date-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(86, 170, 178, 0.1);
}

.date-separator {
  font-size: 20px;
  color: var(--gray-100);
  margin-top: 20px;
  flex-shrink: 0;
}

.analyze-button {
    width: 100%;
    padding: 18px var(--spacing-lg);
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: var(--spacing-lg);
}

.analyze-button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(86, 170, 178, 0.3);
}

.analyze-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(86, 170, 178, 0.3);
}

.analyze-button:disabled {
    background-color: var(--gray-100);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 날짜 입력 placeholder 스타일 */
.date-input::-webkit-calendar-picker-indicator {
    color: #56AAB2;
    cursor: pointer;
}

/* ====== 분석 결과 페이지 공통 스타일 ====== */

.analysis-result-container {
    max-width: 100%;
}

.result-header {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.result-title {
    font-family: var(--font-title);
    font-size: 24px;
    color: var(--primary-color);
    margin-bottom: var(--spacing-sm);
}

.result-subtitle {
    font-size: 14px;
    color: var(--gray-100);
}

/* 분석 카드 스타일 */
.analysis-card {
    border-radius: 10px;
    border: 1px solid #E8E8E8;
    background: #FFF;
    box-shadow: 0 6px 4px 0 rgba(142, 142, 142, 0.25);
    margin: 10px 10px 40px 10px;
    padding: 25px 20px 40px 20px;
    flex-shrink: 0;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-md);
}

.card-title {
    font-size: 21px;
    font-weight: 600;
    color: var(--black);
}

.card-title3 {
    font-size: 19.5px;
    font-weight: 600;
    color: var(--black);
}
.card-icon {
    width: 24px;
    height: 24px;
    fill: var(--primary-color);
}

/* 영양소 분석 스타일 */
.nutrient-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0px 0px 20px 0px;
    border-bottom: 1px solid var(--gray-border);
}

.nutrient-item:last-child {
    border-bottom: none;
}

.nutrient-name {
    font-weight: 500;
    color: var(--black);
}

.nutrient-value {
    font-weight: 600;
    color: var(--primary-color);
}

/* 진행 바 스타일 */
.progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--gray-50);
    border-radius: 4px;
    overflow: hidden;
    margin: var(--spacing-sm) 0;
}

.progress-fill {
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

/* 상태 배지 스타일 */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: var(--white);
}

.status-good {
    background-color: var(--good-color);
    color: var(--black);
}

.status-normal {
    background-color: var(--normal-color);
    color: var(--black);
}

.status-bad {
    background-color: var(--bad-color);
    color: var(--black);
}

/* ====== 모바일 최적화 ====== */
@media (max-width: 480px) {
    .analysis-title {
        font-size: 36px;
    }
    
    .date-range-container {
        flex-direction: row;
        gap: var(--spacing-md);
    }
    
    .date-separator {
        margin: 0;
    }
    
    .analysis-card {
        padding: 25px 20px 40px 20px;
    }
    
    .result-title {
        font-size: 20px;
    }
}

/* ====== 차트 컨테이너 스타일 ====== */
.chart-container {
    width: 100%;
    height: 300px;
    margin: var(--spacing-md) 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--gray-50);
    border-radius: var(--border-radius-sm);
}

.chart-placeholder {
    color: var(--gray-100);
    font-size: 14px;
}

/* 데이터 부족 메시지 스타일 */
.no-data-message {
    text-align: center;
    color: #999;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
    padding: 8px;
    background: rgba(153, 153, 153, 0.1);
    border-radius: 8px;
}

/* 섹션 1 차트 스타일 */
.chart-surface {
    margin: 20px 0;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 200px;
    padding: 20px;
    border-radius: 12px;
    position: relative;
    background: var(--White, #FFF);
    border: 1px solid #E8E8E8;
    
}

.bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    max-width: 80px;
    position: relative; /* 툴팁 위치 설정을 위해 추가 */
    height: 200px; /* 고정 높이 설정 */
    justify-content: flex-end; /* 하단 정렬 */
}

.bar-track {
    width: 16px;
    height: 140px;
    background: #F0F0F0;
    border-radius: 8px;
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    flex-shrink: 0; /* 크기 고정 */
}

.bar-fill {
    width: 100%;
    background: #56AAB2;
    border-radius: 8px;
    min-height: 8px;
    transition: all 0.6s ease;
    position: absolute;
    bottom: 0;
}

.bar-label {
    margin-top: 10px;
    text-align: center;
    color: var(--Gray-04, #666);
    font-family: Inter;
    font-size: 10px;
    font-style: normal;
    font-weight: 400;
    line-height: 1.2;
    white-space: nowrap; /* 한 줄로 제한 */
    overflow: hidden; /* 넘치는 텍스트 숨김 */
    text-overflow: ellipsis; /* 말줄임표 표시 */
    width: 100%; /* 전체 너비 사용 */
    max-width: 80px; /* 최대 너비 제한 */
    height: 20px; /* 고정 높이 */
}

/* 빈 막대 차트 스타일 */
.empty-bar {
    fill: #F0F0F0;
    border-radius: 8px;
}

.empty-fill {
    background: transparent !important;
    border: none;
    min-height: 0 !important;
}

/* 툴팁 스타일 */
.bar-tooltip {
    position: absolute;
    bottom: 140px; /* bar-track 높이(140px) + 여백 */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 26, 26, 0.8);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0 !important;
    visibility: hidden !important;
    transition: all 0.3s ease;
    z-index: 1000;
    pointer-events: none;
    display: none; /* 추가로 display도 숨김 */
}

.bar-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(26, 26, 26, 0.8);
}

.bar-item:hover .bar-tooltip {
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important; /* hover시 다시 보이게 */
}

/* ====== 버튼 그룹 스타일 ====== */
.button-group {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-lg);
}

.btn-secondary {
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    color: #000;
    border-radius: 5px;
    border: 1px solid #E8E8E8;

    background: #FFF;

    text-align: center;
    font-family: Inter;
    font-size: 15px;
    font-style: normal;
    font-weight: 600;
    line-height: normal;
    letter-spacing: 0.26px;
    padding: 7px 0;
}

a{
    text-decoration: none;
}

.btn-secondary:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

/* ====== 로딩 스타일 ====== */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-50);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* static/analysis/analysis.css - 섹션1(카테고리) 제목 한 줄 처리 */
.category-summary .category-title{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  white-space: nowrap;     /* 줄바꿈 금지 */
}

.category-summary .category-title .emoji{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.category-summary .category-title .emoji svg{
  display: block;          /* 베이스라인 여백 제거 */
  width: 17px;
  height: 23px;
}

.category-summary .card-title{
  margin: 0;
  white-space: nowrap;     /* 제목도 한 줄 유지 */
  overflow: hidden;
  text-overflow: ellipsis; /* 길면 말줄임 */
}

/* 섹션1 부제 및 강조 색상 */
.category-summary .category-subtitle{
  color: #666666;
  margin: 6px 0 16px;
  font-family: Inter;
    font-size: 19px;
    font-style: normal;
    font-weight: 600;
    line-height: normal;
    letter-spacing: 0.24px;
}

.category-summary .highlight-green{ color:#3CB371; font-weight:800; }
.category-summary .highlight-red{ color:#E56565; font-weight:800; }

/* Section 2 - 평균 영양소 섭취량 카드 스타일 */
.avg-nutrients-card .section2-title{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.avg-nutrients-card .section2-icon{
  font-size: 20px;
}

.avg-nutrients-card .section2-subtitle{
  color: #666;
  margin: 8px 0 18px;
  font-family: Inter;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.24px;
}

/* 영양소 박스 (라운드 테두리) */
.avg-nutrients-card .nutrients-box{
  border: 2px solid #56AAB2;
  border-radius: 20px;
  padding: 30px 17px;
  margin: 16px 0;
}

.avg-nutrients-card {
    border-radius: 10px;
    border: 1px solid #E8E8E8;
    background: #FFF;
    box-shadow: 0 6px 4px 0 rgba(142, 142, 142, 0.25);

}

.avg-nutrients-card .nutrients-header{
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.avg-nutrients-card .nutrients-dot{
  width: 12px;
  height: 12px;
  background: #56AAB2;
  border-radius: 50%;
}

.avg-nutrients-card .nutrients-label{
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

/* 영양소 아이템들 */
.avg-nutrients-card .nutrient-item{
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: none;
}

.avg-nutrients-card .nutrient-name{
  font-size: 15px;
  font-weight: 500;
  font-family: Inter;
  color: #333;
}

.avg-nutrients-card .nutrient-value{
    color: #000;
    text-align: right;
    font-family: Inter;
    font-size: 12px;
    font-style: normal;
    font-weight: 400;
    line-height: normal;
    letter-spacing: 0.24px;
}

/* 하단 주석 - 라운드 탭 스타일 */
.avg-nutrients-card .section2-note{
  background: #F0F0F0;
  padding: 10px 10px;
  margin: 10px 0 23px;
  color: #B7B5B5;

    text-align: center;
    font-family: Inter;
    font-size: 11.5px;
    font-style: normal;
    font-weight: 500;
    line-height: normal;
    letter-spacing: -0.16px;
}

/* Section 3 - 2020 한국인 영양소 섭취 기준과 비교 */
.compare-krda-card .section3-title{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.compare-krda-card .section3-icon{
  font-size: 20px;
}

.compare-krda-card .section3-subtitle{
  color: #666;
  margin: 8px 0 18px;
  font-family: Inter;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.24px;
}

/* 차트 컨테이너 */
.compare-krda-card .krda-chart-container{
  width: 100%;
  height: 200px;
  
  margin: 16px 0;
  
}

.compare-krda-card .krda-chart{
  width: 100%;
  height: 100%;
  position: relative;
}

.compare-krda-card .chart-grid{
  display: flex;
  height: 100%;
}

.compare-krda-card .bars-container{
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: 215px;
  position: relative;
  padding: 0 10px;
}



.compare-krda-card .bar-wrapper{
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  flex: 1;
  max-width: 60px;
}

.compare-krda-card .bar-track-bg{
  width: 45px;
  height: 215px;
  background: transparent;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.compare-krda-card .bar-fill-krda{
  width: 100%;
  background: #56AAB2;
  border-radius: 4px 4px 0 0;
  min-height: 0;
  max-height: 140px;
  transition: all 0.6s ease;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}

.compare-krda-card .bar-label-krda{
  font-size: 12px;
  color: #333;
  font-weight: 600;
  margin-top: 8px;
  text-align: center;
  font-family: Inter;
  white-space: nowrap;
}

/* 권장량 박스 */
.compare-krda-card .krda-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    font-family: Inter;
    font-style: normal;

    line-height: normal;
    letter-spacing: 0.28px;
}

.compare-krda-card .krda-header{
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.compare-krda-card .krda-dot{
  width: 12px;
  height: 12px;
  background: #56AAB2;
  border-radius: 50%;
}

.compare-krda-card .krda-label{

    color: #000;
    font-family: Inter;
    font-size: 15px;
    font-style: normal;
    font-weight: 500;
    line-height: normal;
    letter-spacing: 0.3px;
}

.compare-krda-card .krda-item{
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
}

.compare-krda-card .krda-name{
  font-size: 15px;
  font-weight: 500;
  color: #000;
  font-family: Inter;
}

.compare-krda-card .krda-value{
  font-size: 15px;
  font-weight: 400;
  color: #000;
  font-family: Inter;
}

/* 섹션 구분선 */
.compare-krda-card .section-divider {
  width: 100%;
  height: 1px;
  background: #E8E8E8;
  margin: 25px 0;
  border: none;
}

/* 영양소 섭취 평가 */
.compare-krda-card .krda-evaluation{
  margin: 20px 0;
}

.compare-krda-card .krda-eval-header{
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.compare-krda-card .krda-eval-dot{
  width: 12px;
  height: 12px;
  background: #56AAB2;
  border-radius: 50%;
}

.compare-krda-card .krda-eval-label{
    color: #000;
    font-family: Inter;
    font-size: 15px;
    font-style: normal;
    font-weight: 500;
    line-height: normal;
    letter-spacing: 0.3px;
}

.compare-krda-card .evaluation-item{
  margin-bottom: 16px;
}

.compare-krda-card .eval-row{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.compare-krda-card .eval-name{
  font-size: 17px;
  font-weight: 600;
  color: #333;
}

.compare-krda-card .eval-percentage{
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 700;
}

.compare-krda-card .eval-message{
  font-size: 12px;
  color: #444;
  margin: 0;
  line-height: 1.3;
}

.compare-krda-card .bar-fill-krda{
  width: 100%;
  background: #56AAB2;
  border-radius: 4px 4px 0 0;
  min-height: 0;
  max-height: 140px;
  transition: all 0.6s ease;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  cursor: pointer; /* 마우스 포인터 변경 */
}

/* 툴팁 스타일 */
.compare-krda-card .bar-fill-krda::after {
  content: attr(data-percentage);
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 1000;
}

/* 화살표 추가 */
.compare-krda-card .bar-fill-krda::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid rgba(0, 0, 0, 0.8);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none;
}

/* 호버 시 툴팁 표시 */
.compare-krda-card .bar-fill-krda:hover::after,
.compare-krda-card .bar-fill-krda:hover::before {
  opacity: 1;
  visibility: visible;
}