/* ==========================================================================
   계란 시세 및 매출 분석 페이지 스타일 (eggPrice.css)
   ========================================================================== */

/* 전체 페이지 레이아웃
   색은 3계열로만 사용한다: 도매(브랜드 블루) / 산지(오렌지) / 등락(적·청)
   금액 숫자 자체는 무채색으로 두고, 색은 구분 표식과 등락에만 쓴다. */
.egg-price-page {
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --muted-light: #94a3b8;
  --line: #e2e8f0;
  --line-soft: #f1f5f9;
  --surface: #f8fafc;
  --brand: #1f8ef1;
  --producer: #ea580c;
  --up: #d92d20;
  --down: #1570ef;

  color: var(--ink-soft);
  font-size: 0.925rem;
}

.egg-price-page .card {
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  background-color: #ffffff;
  margin-bottom: 1.5rem;
}

.egg-price-page .card-header {
  background-color: transparent;
  border-bottom: 1px solid var(--line-soft);
  padding: 1rem 1.25rem;
}

.egg-price-page .card-body {
  padding: 1.25rem;
}

/* 페이지 제목 영역 (검색 유입 첫 화면) */
.egg-price-page .page-hero {
  margin-bottom: 1.25rem;
}

.egg-price-page .page-hero h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.7px;
  margin: 0 0 0.35rem;
  line-height: 1.3;
}

.egg-price-page .page-hero p {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
  max-width: 62ch;
  line-height: 1.6;
}

/* 시세 요약 패널 : 당일 도매·산지가를 주 지표로, 기간 최고·최저를 보조 지표로 배치 */
.price-summary {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.price-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--line-soft);
}

.price-summary-head .summary-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin: 0;
}

.price-summary-head .summary-meta {
  font-size: 0.8rem;
  color: var(--muted-light);
  margin-left: 0.5rem;
  font-weight: 500;
}

.price-summary-body {
  display: flex;
  flex-wrap: wrap;
}

.price-main {
  display: flex;
  flex: 1 1 460px;
  min-width: 0;
  /* 넓은 화면에서 숫자가 과하게 벌어지지 않도록 폭을 제한 */
  max-width: 760px;
}

.price-cell {
  flex: 1 1 0;
  min-width: 0;
  padding: 1.35rem 1.25rem;
}

.price-cell+.price-cell {
  border-left: 1px solid var(--line-soft);
}

.price-cell .cell-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--muted);
}

.price-cell .cell-label::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background-color: var(--brand);
  flex: 0 0 auto;
}

.price-cell[data-market="producer"] .cell-label::before {
  background-color: var(--producer);
}

.price-cell .cell-value {
  display: block;
  margin-top: 0.5rem;
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
  letter-spacing: -1.2px;
  font-variant-numeric: tabular-nums;
}

.price-cell .cell-value .unit {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0;
  margin-left: 1px;
}

.price-cell .cell-delta {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.825rem;
  color: var(--muted);
}

/* 보조 지표 : 기간 최고·최저 */
.price-range {
  flex: 1 1 268px;
  border-left: 1px solid var(--line-soft);
  background-color: #fff;
  padding: 1.1rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.7rem;
}

.price-range .range-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.price-range .range-label {
  flex: 0 0 104px;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.price-range .range-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.price-range .range-date {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted-light);
  margin-left: 0.3rem;
}

/* 매출 분석 탭 요약 수치 */
.egg-price-stats .stats-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.15rem 1.25rem;
  height: 100%;
}

.egg-price-stats .stats-label {
  display: block;
  color: var(--muted);
  font-size: 0.825rem;
  font-weight: 600;
}

.egg-price-stats .stats-value {
  margin-top: 0.4rem;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
  letter-spacing: -0.7px;
  font-variant-numeric: tabular-nums;
}

.egg-price-stats .stats-sub {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted-light);
}

/* 시세 색상 및 뱃지 */
.price-up {
  color: var(--up) !important;
  font-weight: 600;
}

.price-down {
  color: var(--down) !important;
  font-weight: 600;
}

.price-change-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.775rem;
  font-weight: 600;
  min-width: 62px;
  line-height: 1;
}

.price-change-up {
  color: var(--up);
  background-color: #fef3f2;
}

.price-change-down {
  color: var(--down);
  background-color: #eff8ff;
}

.price-change-none {
  color: var(--muted);
  background-color: var(--line-soft);
}

/* 규격 선택 세그먼트 컨트롤 (트랙 위 흰색 활성 알약) */
.segmented-btn-group {
  background-color: var(--line-soft);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.segmented-btn-group .btn {
  padding: 0.32rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  border-radius: 6px !important;
  color: var(--muted);
  background-color: transparent;
  box-shadow: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.segmented-btn-group .btn:hover {
  color: var(--ink);
  background-color: rgba(255, 255, 255, 0.6);
}

.segmented-btn-group .btn.active {
  background-color: #ffffff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.segmented-btn-group .btn:focus {
  box-shadow: none;
  outline: 2px solid rgba(31, 142, 241, 0.35);
  outline-offset: 1px;
}

/* 탭 스타일 개편 */
.egg-price-page .custom-nav-tabs {
  border-bottom: 2px solid #e2e8f0;
  gap: 0.5rem;
}

.egg-price-page .custom-nav-tabs .nav-link {
  border: none;
  border-bottom: 2px solid transparent;
  color: #64748b;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 1.25rem;
  margin-bottom: -2px;
  border-radius: 0;
  transition: color 0.2s ease, border-color 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.egg-price-page .custom-nav-tabs .nav-link i {
  font-size: 1.1rem;
}

.egg-price-page .custom-nav-tabs .nav-link:hover {
  color: #1f8ef1;
  border-bottom-color: #cbd5e1;
}

.egg-price-page .custom-nav-tabs .nav-link.active {
  color: #1f8ef1;
  background-color: transparent;
  border-bottom: 2px solid #1f8ef1;
}

/* 검색 필터 바 */
.filter-card {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.filter-card .form-control,
.filter-card .form-select {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.875rem;
  padding: 0.45rem 0.75rem;
  height: calc(1.5em + 0.9rem + 2px);
  background-color: #ffffff;
  color: #334155;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.filter-card .form-control:focus,
.filter-card .form-select:focus {
  border-color: #1f8ef1;
  box-shadow: 0 0 0 2px rgba(31, 142, 241, 0.15);
}

.filter-card label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.35rem;
  display: block;
}

/* 차트 컨테이너
   높이는 Highcharts 옵션이 직접 지정한다. 컨테이너에 고정 높이를 주면
   퍼센트 높이를 읽지 못한 차트 SVG와 크기가 어긋나 잘리는 문제가 생긴다. */
.egg-price-page .chart-container {
  position: relative;
  width: 100%;
}

/* 테이블 스타일 */
.egg-price-page .table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 0;
}

.egg-price-page .table thead th {
  background-color: #f8fafc;
  color: #475569;
  font-size: 0.825rem;
  font-weight: 600;
  text-align: right;
  padding: 0.85rem 1rem;
  border-top: none;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
  vertical-align: middle;
}

.egg-price-page .table thead th:nth-child(1),
.egg-price-page .table thead th:nth-child(2) {
  text-align: center;
}

.egg-price-page .table tbody td {
  padding: 0.85rem 1rem;
  vertical-align: middle;
  border-top: none;
  border-bottom: 1px solid #f1f5f9;
  text-align: right;
  font-size: 0.9rem;
  color: #1e293b;
}

.egg-price-page .table tbody td:nth-child(1),
.egg-price-page .table tbody td:nth-child(2) {
  text-align: center;
  color: #475569;
  font-weight: 500;
}

.egg-price-page .table tbody tr:hover td {
  background-color: #f8fafc;
}

.egg-price-page .price-value {
  font-weight: 600;
  color: #0f172a;
}

/* DataTables 커스텀 UI */
.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: 4px !important;
  padding: 0.35rem 0.75rem !important;
  font-size: 0.85rem !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: #1f8ef1 !important;
  border-color: #1f8ef1 !important;
  color: #ffffff !important;
}

.dataTables_wrapper .dataTables_info {
  font-size: 0.85rem;
  color: #64748b;
  padding-top: 0.75rem;
}

.dataTables_wrapper .dt-buttons {
  margin-bottom: 0.75rem;
}

/* 생산성 PDF 탭 */
.pdf-item-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.85rem 1.15rem;
  margin-bottom: 0.5rem;
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.pdf-item-card:hover {
  border-color: #cbd5e1;
  background-color: #f8fafc;
}

.pdf-item-card.active {
  border-color: #1f8ef1;
  background-color: #eff6ff;
}

.pdf-item-card .pdf-title {
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pdf-item-card .pdf-meta {
  font-size: 0.8rem;
  color: #64748b;
}

#productionPdfViewer {
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background-color: #f8fafc;
  padding: 1rem;
  min-height: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#productionPdfViewer canvas {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  background-color: #ffffff;
  max-width: 100%;
}

/* 반응형 대응 */
@media (max-width: 1199px) {

  /* 보조 지표를 아래로 내려 가로 폭 확보 */
  .price-main {
    max-width: none;
  }

  .price-range {
    flex: 1 1 100%;
    border-left: none;
    border-top: 1px solid var(--line-soft);
    flex-direction: row;
    justify-content: flex-start;
    gap: 2.5rem;
    padding: 0.85rem 1.25rem;
  }

  .price-range .range-row {
    gap: 0.6rem;
  }

  .price-range .range-label {
    flex: 0 0 auto;
  }
}

@media (max-width: 768px) {

  /* 모바일에서는 카드가 화면 폭을 꽉 채우므로 제목만 좌우 여백을 준다 */
  .egg-price-page .page-hero {
    padding: 0 1.25rem;
  }

  .egg-price-page .page-hero h1 {
    font-size: 1.35rem;
  }

  .price-cell {
    padding: 1.1rem 1rem;
  }

  .price-cell .cell-value {
    font-size: 1.7rem;
  }

  .egg-price-stats .stats-value {
    font-size: 1.35rem;
  }

  .price-change-badge {
    display: block;
    margin-top: 0.25rem;
    text-align: center;
    width: 100%;
  }

  .egg-price-page .custom-nav-tabs .nav-link {
    padding: 0.6rem 0.85rem;
    font-size: 0.85rem;
  }

  .segmented-btn-group {
    width: 100%;
  }

  .segmented-btn-group .btn {
    flex: 1 1 0;
    padding: 0.32rem 0.35rem;
  }
}

@media (max-width: 575px) {
  .price-main {
    flex: 1 1 100%;
    flex-wrap: wrap;
  }

  .price-cell {
    flex: 1 1 100%;
  }

  .price-cell+.price-cell {
    border-left: none;
    border-top: 1px solid var(--line-soft);
  }

  .price-range {
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* 시세 안내 문단 (검색 유입 방문자용 설명) */
.egg-price-page .price-guide {
  margin-bottom: 1.5rem;
}

.egg-price-page .price-guide h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 0.6rem;
}

.egg-price-page .price-guide h3 {
  font-size: 0.925rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin: 0 0 0.35rem;
}

.egg-price-page .price-guide p {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.75;
  margin: 0;
}

.egg-price-page .price-guide p+h3 {
  margin-top: 1.1rem;
}

/* 서비스 안내 배너 (비로그인 방문자 전환용) */
.egg-price-page .service-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: 10px;
  background-color: var(--surface);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.egg-price-page .service-cta .cta-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 0.3rem;
}

.egg-price-page .service-cta .cta-desc {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.6;
}

.egg-price-page .service-cta .cta-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

@media (max-width: 575px) {
  .egg-price-page .service-cta .cta-actions {
    width: 100%;
  }

  .egg-price-page .service-cta .cta-actions .btn {
    flex: 1 1 0;
  }
}

/* 인쇄 스타일 */
@media print {
  body.printing-revenue>* {
    display: none !important;
  }

  body.printing-revenue,
  body.printing-revenue .wrapper,
  body.printing-revenue .main-panel,
  body.printing-revenue .content,
  body.printing-revenue .page-content-wrapper,
  body.printing-revenue .page-content-wrapper-inner,
  body.printing-revenue .content-viewport,
  body.printing-revenue .tab-content,
  body.printing-revenue #revenueTab {
    display: block !important;
    position: static !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body.printing-revenue #priceTab,
  body.printing-revenue #productionTab,
  body.printing-revenue .page-hero,
  body.printing-revenue .price-summary,
  body.printing-revenue .price-guide,
  body.printing-revenue .service-cta,
  body.printing-revenue #priceChartCard,
  body.printing-revenue .custom-nav-tabs,
  body.printing-revenue .nav-tabs,
  body.printing-revenue .no-print {
    display: none !important;
  }

  body.printing-revenue .sidebar,
  body.printing-revenue nav,
  body.printing-revenue .navbar,
  body.printing-revenue footer,
  body.printing-revenue .loading-overlay,
  body.printing-revenue .mobile-nav,
  body.printing-revenue #chatbot-widget-root {
    display: none !important;
  }

  body.printing-revenue #revenueTab {
    padding: 20px !important;
    background: white !important;
  }

  body.printing-revenue #revenueChart,
  body.printing-revenue #gradeChart {
    width: 100% !important;
    height: 380px !important;
  }

  .printing-revenue #revenueTab .row.mb-4:has(.chart-container) {
    display: block !important;
  }

  .printing-revenue #revenueTab .row.mb-4:has(.chart-container)>div {
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 20px !important;
    page-break-inside: avoid !important;
  }

  .printing-revenue .print-title {
    display: block !important;
    text-align: center !important;
    margin: 20px 0 !important;
  }

  .printing-revenue #revenueTab .revenue-search .row {
    display: none !important;
  }

  .printing-revenue #revenueTab .revenue-search .card-body::before {
    content: "검색 조건 - " !important;
    font-weight: bold !important;
  }

  .printing-revenue #revenueTab .revenue-search .card-body::after {
    content: "농장: " attr(data-farm) " | 동: " attr(data-house) " | 기간: " attr(data-start-date) " ~ " attr(data-end-date) !important;
  }

  .printing-revenue #revenueTable {
    width: 100% !important;
    border-collapse: collapse !important;
    page-break-before: always !important;
  }

  .printing-revenue #revenueTable th,
  .printing-revenue #revenueTable td {
    padding: 8px !important;
    border: 1px solid #ddd !important;
    text-align: center !important;
  }

  .printing-revenue .dataTables_length,
  .printing-revenue .dataTables_filter,
  .printing-revenue .dataTables_paginate,
  .printing-revenue .dt-buttons {
    display: none !important;
  }

  @page {
    size: A4 portrait;
    margin: 1cm;
  }
}