@font-face {
  font-family: 'Noto Sans KR';
  src: url('/font/Noto_Sans_KR/NotoSansKR-VariableFont_wght.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* 기본 및 모바일 스타일 */
:root {
  --primary-color: #004225; /* 성주참외 Dark Green */
  --secondary-color: #FFC700; /* 성주참외 Yellow */
  --background-color: #fdfaf0; /* 기존 유지 */
  --card-background: #ffffff;
  --text-color: #333;
  --border-color: #e0e0e0;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Noto Sans KR', 'Pretendard', 'Malgun Gothic', sans-serif;
  background: var(--background-color);
  color: var(--text-color);
  box-sizing: border-box;
  line-height: 1.6;
  font-size: 1.05em; /* 추가: 전체 기본 글자 크기 확대 */
}

body.modal-open {
  overflow: hidden; /* ★★★ 모달 열렸을 때 배경 스크롤 방지 ★★★ */
}

*, *:before, *:after {
  box-sizing: inherit;
}

.app-container {
  max-width: 600px; /* 모바일 환경 고려, 데스크탑 최대 너비 제한 */
  margin: 0 auto;
  padding: 0 10px; /* 좌우 여백 */
  overflow-x: hidden; /* 가로 스크롤 방지 */
}


.fixed-header span {
  font-family: 'Noto Sans KR', sans-serif;
  font-weight: 700; /* Bold */
  font-size: 1.1em;
  color: var(--primary-color);
}

h1 {
  font-family: 'Noto Sans KR', sans-serif;
  font-weight: 900; /* Black */
  text-align: center;
  margin: 20px 0;
  color: var(--primary-color);
  font-size: 1.5em;
}

/* Swiper 스타일 */
.swiper {
  width: 100%;
  padding-bottom: 40px; /* 페이지네이션 공간 확보 */
}

.swiper-wrapper {
  align-items: stretch; /* 슬라이드 높이 동일하게 */
}

.swiper-slide {
  background: var(--card-background);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  height: auto; /* ★ 100% 삭제하고 auto로 변경 ★ */
  border: 1px solid var(--border-color);
  width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

.swiper-slide.loading-slide p {
    text-align: center;
    color: #888;
    width: 100%;
    padding: 50px 0;
}

/* 페이지네이션 (점) 스타일 */
.swiper-pagination {
    bottom: 10px !important; /* 위치 조정 */
}
.swiper-pagination-bullet {
    background: var(--secondary-color) !important;
    opacity: 0.6 !important;
}
.swiper-pagination-bullet-active {
    background: var(--primary-color) !important;
    opacity: 1 !important;
}

/* 날짜 표시 */
.date {
  font-weight: bold;
  font-size: 1.2em;
  margin-bottom: 15px;
  color: var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 8px;
  text-align: center;
}

/* 공판장 카드 스타일 */
.market-card {
  background: #f9f9f9;
  border-radius: 8px;
  padding: 12px 15px; /* 내부 콘텐츠 여백 */
  margin-bottom: 12px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
  border: 1px solid #eee;
  cursor: pointer; /* 클릭 가능 표시 */
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;

  /* ★★★ 추가: 카드 너비를 부모(슬라이드 패딩 영역)에 맞춤 ★★★ */
  width: 100%;
  box-sizing: border-box; /* 패딩과 테두리를 너비 계산에 포함 (이미 전역 설정되었을 수 있음) */
  font-family: inherit;
}

.market-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

.market-card .title {
  font-family: 'Noto Sans KR', sans-serif;
  font-weight: 700; /* Bold */
  margin-bottom: 8px;
  font-size: 1.2em;
  color: #34495e;
}

.market-card .value {
  font-size: 1.05em;
  margin: 5px 0;
  color: #555;
}

.market-card .value .icon {
  display: inline-block;
  margin-right: 6px;
  font-size: 1.1em; /* 아이콘 약간 크게 */
}

/* 하단 콘텐츠 영역 */
.bottom-content {
  padding: 15px 0;
  border-top: 1px solid var(--border-color);
  margin-top: 20px;
}

.kakao-channel-placeholder {
  /* background-color: #eee;  <- 기존 배경색 제거 */
  background-color: transparent; /* 또는 var(--background-color) 로 명시적 지정 */
  border-radius: 8px;
  /* padding: 15px; <- 패딩 제거 또는 필요시 조정 */
  text-align: center;
  /* color: #777; <- 제거 또는 필요시 유지 */
  margin-bottom: 15px;
  /* font-size: 0.9em; <- 제거 또는 필요시 유지 */
}

/* 카카오 채널 링크 (이미지를 감싸는) 스타일 */
.kakao-channel-placeholder a {
  display: inline-block; /* 이미지가 가운데 정렬되도록 */
  text-decoration: none; /* 링크 밑줄 제거 */
  border: none;          /* 링크 테두리 제거 */
  /* 기존 background-color, padding 등 제거되었는지 확인 */
}

/* 카카오 채널 이미지 자체 스타일 */
.kakao-channel-placeholder a img {
  display: block; /* display:block 이나 vertical-align: middle 추천 */
  /* ★★★ 이미지 크기 조절 ★★★ */
  /* width: 150px; */  /* 원하는 너비로 조절 (예: 150px) */
  max-width: 80%; /* 너비를 직접 지정할 경우 max-width는 보통 제거 */
  height: auto;   /* 가로세로 비율 유지 */
  margin: 0 auto; /* display:block 일 때 가운데 정렬 */
}


.ad-banner-placeholder {
  background-color: #f0f0f0;
  border-radius: 8px;
  padding: 15px;
  text-align: center;
  color: #777;
  margin-bottom: 15px;
  min-height: 90px; /* 일반적인 배너 높이 */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9em;
}

/* 푸터 스타일 */
.footer {
  text-align: center;
  font-size: 0.8em;
  padding: 15px 0;
  margin-top: 10px;
  color: #777;
}

/* 모달 스타일 */
.modal {
  display: none; /* 기본 숨김 */
  position: fixed; /* 화면 고정 */
  z-index: 1000; /* 다른 요소 위에 표시 */
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto; /* 내용 많을 시 스크롤 */
  background-color: rgba(0, 0, 0, 0.6); /* 반투명 배경 */
}

.modal-content {
  background-color: #fff;
  margin: 15% auto; /* 화면 중앙 (상하 여백) */
  padding: 25px;
  border: 1px solid #888;
  width: 85%; /* 모바일 화면 너비 */
  max-width: 450px; /* 최대 너비 */
  border-radius: 10px;
  position: relative;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.close-button {
  color: #aaa;
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close-button:hover,
.close-button:focus {
  color: black;
  text-decoration: none;
}

#modalTitle {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 700; /* Bold */
    margin-top: 0;
    color: var(--primary-color);
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
    text-align: left;
    font-size: 1.4em;
}

/* 추가된 모달 요약 스타일 */
.modal-summary {
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin-bottom: 20px;
}

.modal-summary div {
  text-align: center;
  font-size: 1.3em;
  font-weight: bold;
  color: var(--primary-color);
}

#modalBoxes,
#modalAvgPrice {
  font-size: 1.5em;
  font-weight: bold;
  color: var(--primary-color);
}

#modalBody p {
    margin: 8px 0;
    font-size: 1.05em;
}
#modalBody .icon {
    margin-right: 8px;
    font-size: 1.1em;
}
#modalBody hr {
    border: 0;
    border-top: 1px solid #eee;
    margin: 15px 0;
}

/* 광고 배너 컨테이너 */
.ad-banner-container {
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-bottom: 0;
  overflow: hidden;
  position: relative;
  display: inline-block; /* ★★★ 추가: text-align:center 효과 받도록 ★★★ */
  text-align: left;     /* ★★★ 추가: 배너 내부 내용은 왼쪽 정렬 ★★★ */
  /* 음수 마진은 제거된 상태 유지 */
}

/* 광고 Swiper 스타일 */
.ad-swiper {
  width: 100%;
  height: 100%; /* 부모 높이를 따르도록 설정 (위에서 .ad-banner-container 높이 설정 필요) */
}

.ad-swiper .swiper-slide {
  text-align: center;
  /* background: #fff; */        /* ★★★ 기존 흰색 배경 제거 또는 주석 처리 ★★★ */
  background: transparent;     /* ★★★ 배경을 투명하게 변경 ★★★ */
                               /* 또는 var(--background-color); 로 페이지 배경과 맞춤 */
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  padding: 0; /* ★★★ 혹시 모를 패딩 제거 ★★★ */
  border: none; /* ★★★ 혹시 모를 테두리 제거 ★★★ */
}

/* 광고 이미지/비디오 스타일 */
.ad-slide .ad-media {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover; /* ★★★ 비율 유지하며 꽉 채우는 속성 확인 ★★★ */
  padding: 0; /* ★★★ 혹시 모를 패딩 제거 ★★★ */
  border: none; /* ★★★ 혹시 모를 테두리 제거 ★★★ */
}

/* 비디오 썸네일 상태일 때 슬라이드 */
.ad-slide.ad-video-thumbnail {
  cursor: pointer; /* 클릭 가능 표시 */
  position: relative; /* 내부 절대 위치 요소 기준 */
}

/* 재생 버튼 오버레이 스타일 */
.ad-slide .play-button-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px; /* 버튼 크기 조절 */
  height: 50px;
  background-color: rgba(0, 0, 0, 0.6); /* 반투명 배경 */
  color: white;
  border-radius: 50%; /* 원형 버튼 */
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px; /* 아이콘 크기 */
  pointer-events: none; /* 버튼 자체가 클릭 이벤트 방해 않도록 */
  z-index: 1;
}

/* 외부 링크 버튼 스타일 (예시) */
.ad-slide .ad-external-link-button {
  position: absolute;
  bottom: 10px; /* 하단 배치 */
  right: 10px; /* 우측 배치 */
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 5px 10px;
  border-radius: 3px;
  font-size: 12px;
  text-decoration: none;
  z-index: 2; /* 재생 버튼보다 위에 오도록 (필요시) */
  transition: background-color 0.2s;
}

.ad-slide .ad-external-link-button:hover {
  background-color: rgba(0, 0, 0, 0.9);
}
/* ===== 커스텀 내비게이션 스타일 ===== */
.custom-navigation {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 20px;
  gap: 16px; /* 버튼과 텍스트 사이 간격 */
}

.custom-navigation button {
  font-size: 22px;
  padding: 6px 12px;
  background: none;
  border: 2px solid var(--primary-color);
  border-radius: 6px;
  color: var(--primary-color);
  cursor: pointer;
  transition: background-color 0.3s, color 0.3s;
}

.custom-navigation button:hover {
  background-color: var(--primary-color);
  color: white;
}

#currentDateText {
  font-size: 1.1em;
  font-weight: bold;
  color: var(--primary-color);
}

#modalCloseButton {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 24px;
  background: none;
  border: none;
  cursor: pointer;
  color: #333;
}

#modalCloseButton:hover {
  color: red;
}

/* ===== fade-up 애니메이션 ===== */
.fade-up {
  opacity: 0;
  transform: translateY(40px);
  transition: all 0.6s ease-out;
}

.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* 날짜 입력 숨은 input 플래시 방지 */
input[type="date"] {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  -webkit-tap-highlight-color: transparent;
}
input[type="date"]:focus {
  outline: none !important;
}
/* 최저가, 최고가 숫자 컬러 스타일 */
.min-price-number {
  color: blue;
}
.max-price-number {
  color: red;
}

/* 모달 내 등급별 테이블 스타일 개선 */
.modal-content table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}
.modal-content th,
.modal-content td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--border-color);
}
.modal-content thead th {
  background-color: var(--primary-color);
  color: white;
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: center;
}
.modal-content tbody tr:nth-child(odd) {
  background-color: #fafafa;
}
.modal-content td {
  text-align: right;
}
.modal-content td:first-child {
  text-align: center;
  font-weight: bold;
}
.modal-details-wrapper {
  overflow-x: auto;
  margin-top: 12px;
}
.modal-details-wrapper::-webkit-scrollbar {
  height: 6px;
}
.modal-details-wrapper::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.2);
  border-radius: 3px;
}
/* Responsive grid for value-row pairs with fixed columns */
.value-row {
  display: grid;
  grid-template-columns: max-content auto max-content auto; /* label, value, label, value */
  gap: 8px 16px;       /* 8px row gap, 16px column gap */
  align-items: center; /* vertically center items */
}
.value-row > div {
  white-space: nowrap;  /* Prevent breaking inside a label or value */
}
.value-row > .right {
  text-align: right;    /* Right-align the value columns */
}

/* Market summary table styling */
.market-summary {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 4px;
  table-layout: fixed; /* ensure columns span the full card width */
}
.market-summary td {
  width: 50%;           /* each cell takes half the card width */
  border: none;         /* remove cell borders */
  padding: 6px 8px;    /* more horizontal padding for wider cells */
  font-size: 1.1em;     /* larger font for readability */
}
.market-summary td.total,
.market-summary td.min {
  text-align: left;
}
.market-summary td.avg {
  text-align: right;
  color: var(--primary-color); /* 다크 그린 */
}
.market-summary td.max {
  text-align: right;
  color: red;                 /* 최고가 빨강 */
}
.market-summary td.min {
  color: blue;                /* 최저가 파랑 */
}