/* history-card의 배경색 */
.history-card.korean-history {
  background-color: #e6f3ff;
} /* 한국사 (연한 파랑) */
.history-card.world-history {
  background-color: #fff3e0;
} /* 세계사 (연한 주황) */
.history-card.person-history {
  background-color: #e0ffe6;
} /* 인물 (연한 초록) */
.history-card.science-history {
  background-color: #ffeeff;
} /* 과학 (연한 보라) */
.history-card.default-history {
  background-color: #f8f8f8;
} /* 기본 (매칭되지 않을 경우) */

/* card-badge의 배경색 (카드 배경색보다 진하게) */
/* .card-info .card-badge 선택자가 아니라 .card-badge.xxx-badge 형태로 직접 적용됩니다. */
.card-badge.korean-history-badge {
  background-color: #4a90e2;
} /* 파랑 */
.card-badge.world-history-badge {
  background-color: #ff9800;
} /* 주황 */
.card-badge.person-history-badge {
  background-color: #4caf50;
} /* 초록 */
.card-badge.science-history-badge {
  background-color: #9c27b0;
} /* 보라 */
.card-badge.default-history-badge {
  background-color: #aaaaaa;
} /* 기본 뱃지 색상 */

/* ... (style.css의 다른 내용은 그대로 유지) ... */

/* 기본 스타일 초기화 */
body {
  margin: 0;
  padding: 0;
  font-family: "Noto Sans KR", sans-serif;
  background-color: #f0f2f5; /* 전체 배경색 */
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  box-sizing: border-box;
  -webkit-user-select: none; /* 텍스트 드래그 방지 */
  -moz-user-select: none; /* 텍스트 드래그 방지 */
  -ms-user-select: none; /* 텍스트 드래그 방지 */
  user-select: none; /* 텍스트 드래그 방지 */
}

.container {
  width: 100%;
  max-width: 480px; /* 모바일 앱 형태의 최대 너비 */
  height: 100vh; /* 뷰포트 높이 가득 채우기 */
  display: flex;
  flex-direction: column;
  background-color: #ffffff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  overflow: hidden; /* 카드 애니메이션을 위해 숨김 */
  position: relative;
}

/* 헤더 */
.header {
  background-color: #4a90e2; /* 상단 바 배경색 */
  color: white;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.2em;
  font-weight: 700;
  flex-shrink: 0; /* 높이 고정 */
}

.header-left .service-name {
  font-size: 1.4em;
  font-weight: bold;
}

.today-button {
  background: none;
  border: none;
  color: white;
  font-size: 1em;
  cursor: pointer;
  display: flex;
  align-items: center;

  background-color: rgba(255, 255, 255, 0.2); /* 흰색 배경에 투명도 적용 */
  border: 1px solid rgba(255, 255, 255, 0.4); /* 흰색 테두리에 투명도 적용 */
  padding: 8px 12px; /* 패딩으로 버튼 크기 조절 */
  border-radius: 20px; /* 둥근 모서리 */
  transition: background-color 0.2s, border-color 0.2s; /* 호버 효과를 위한 전환 */
}

.today-button i {
  margin-right: 5px;
}

/* 메인 콘텐츠 (카드 영역) */
.main-content {
  flex-grow: 1; /* 남은 공간 모두 차지 */
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow: hidden; /* 카드가 컨테이너 밖으로 넘어가지 않도록 */
  position: relative;
}

/* 카드 정사각형 및 크기 조정 */
.card-wrapper {
  position: relative; /* 자식 absolute 기준 */
  width: 100%;
  max-width: 400px; /* 카드의 최대 너비 */
  height: 0; /* 높이를 0으로 설정하여 padding-bottom이 높이를 결정하도록 함 */
  padding-bottom: 100%; /* 너비에 비례하여 높이 조정 (정사각형 유지) */
  background-color: transparent; /* 카드 래퍼 배경은 투명 */
  border-radius: 15px;
  overflow: visible; /* 그림자가 잘리지 않도록 visible로 변경 */
}

.history-card {
  position: absolute; /* 부모(card-wrapper) 기준으로 위치 설정 */
  top: 0;
  left: 0;
  width: 100%; /* 부모의 100% 너비 */
  height: 100%; /* 부모의 100% 높이 (padding-bottom으로 결정된 높이) */
  padding: 15px; /* 모바일 최적화를 위해 20px에서 15px로 줄임 */
  border-radius: 15px;
  display: flex;
  flex-direction: column; /* 자식 요소들을 수직으로 정렬 */
  /* 입체감을 위한 box-shadow 조정 */
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2),
    /* 더 깊은 그림자 */ 0 3px 6px rgba(0, 0, 0, 0.1); /* 미묘한 그림자 추가 */
  box-sizing: border-box; /* 패딩이 너비/높이에 포함되도록 */
  transition: transform 0.3s ease-out, background-color 0.3s ease-out,
    box-shadow 0.3s ease-out, opacity 0.3s ease-out; /* 그림자, 투명도도 전환 효과 추가 */
  color: #333;
}

/* 카드 애니메이션 */
.history-card.fade-out {
  opacity: 0;
}
.history-card.fade-in {
  opacity: 1;
  transform: translateX(0);
}

/* 호버 시 약간 떠오르는 효과 (선택 사항) */
.history-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3), 0 5px 10px rgba(0, 0, 0, 0.15);
}

/* 카드 내부 요소 */
.card-header {
  display: flex;
  justify-content: space-between; /* 날짜와 페이지 번호 양 끝 정렬 */
  align-items: center; /* 세로 중앙 정렬 */
  margin-bottom: 10px;
  flex-wrap: wrap; /* 요소들이 한 줄에 다 안 들어갈 경우 줄바꿈 허용 */
  flex-shrink: 0; /* 헤더는 고정 높이 */
}

.card-date {
  font-size: 2.2em; /* 날짜 크기 크게 */
  font-weight: bold;
  color: #4a90e2; /* 눈에 띄는 색깔 (파란색 계열) */
  margin-right: 15px; /* 페이지 번호와의 간격 (필요시 조정) */
  flex-shrink: 0; /* 크기 줄어들지 않도록 */
}

/* 페이지 번호 스타일 */
.card-count-box {
  background-color: #4a90e2; /* 배경 더 짙게 (날짜와 동일한 색상) */
  color: white; /* 글자 흰색 */
  padding: 7px 14px; /* 좌우 패딩 약간 늘려 공간 여유있게 */
  border-radius: 18px; /* 둥근 직사각형 (패딩 늘어난 만큼 곡률 조정) */
  font-size: 1.1em; /* 좀 더 크게 */
  font-weight: bold;
  flex-shrink: 0;
  line-height: 1; /* 텍스트 세로 중앙 정렬을 위해 */
  letter-spacing: 0.05em; /* 글자 간격 약간 넓히기 */
}

/* 뱃지 스타일 (card-info 안으로 이동) */
.card-info {
  font-size: 0.85em;
  color: #777;
  margin-bottom: 8px; /* 간격 줄임 */
  display: flex; /* Flexbox 활성화 */
  align-items: center; /* 세로 중앙 정렬 */
  flex-wrap: wrap; /* 요소들이 한 줄에 다 안 들어갈 경우 줄바꿈 허용 */
  flex-shrink: 0; /* 정보 섹션도 고정 높이 */
}

/* 뱃지 자체의 기본 스타일 */
.card-info .card-badge {
  /* .card-info 내부의 .card-badge에 적용 */
  padding: 4px 8px; /* 크기 약간 조절 */
  border-radius: 12px; /* 둥근 모양 */
  font-size: 0.75em; /* 글자 크기 조절 */
  font-weight: bold;
  color: white;
  margin-right: 8px; /* 국가 정보와의 간격 */
  flex-shrink: 0;
}

.card-info span {
  margin-right: 4px; /* 각 요소 뒤에 작은 간격 추가 */
}

.card-event {
  font-size: 1.3em;
  font-weight: bold;
  margin-top: 0;
  margin-bottom: 8px;
  line-height: 1.3;
  flex-shrink: 0; /* 이벤트 제목도 고정 높이 */
}

.card-details {
  font-size: 0.95em;
  line-height: 1.5;
  color: #444;
  overflow-y: auto; /* 데스크톱에서 스크롤을 유지하기 위함 */
  padding-right: 5px; /* 스크롤바 공간 */
  scrollbar-width: thin; /* Firefox 스크롤바 스타일 */
  scrollbar-color: #888 transparent; /* Firefox 스크롤바 색상 */
  flex-grow: 1; /* 남은 모든 공간을 차지하도록 설정 (매우 중요) */
  /* 데스크톱에서 max-height를 지정하지 않아, card-content가 flex-grow 1로 채우도록 함 */
}

.card-details::-webkit-scrollbar {
  width: 5px;
}

.card-details::-webkit-scrollbar-track {
  background: transparent;
}

.card-details::-webkit-scrollbar-thumb {
  background-color: #888;
  border-radius: 5px;
}

/* 카드 액션 버튼 영역 */
.card-actions {
  display: flex; /* Flexbox 활성화 */
  justify-content: space-around; /* 요소들 사이에 균등한 공간 배분 */
  padding-top: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.05); /* 카드 액션 영역 상단 구분선 */
  flex-shrink: 0; /* 중요: 이 버튼 컨테이너는 절대 줄어들지 않도록 함 */
  margin-top: auto; /* 남은 공간을 밀어내어 하단에 붙게 함 (필요시) */
}

.action-button {
  background: none;
  border: none; /* 기존 border를 초기화 */
  color: #4a90e2;
  font-size: 0.8em;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 5px;
  transition: color 0.2s;
  flex-grow: 1; /* 남은 공간을 균등하게 차지하여 폭을 동일하게 만듦 */
  flex-basis: 0; /* flex-grow와 함께 사용하여 균등 분배를 확실히 함 */
}

/* 첫 번째 버튼을 제외한 나머지 버튼에 왼쪽 테두리 추가 (세로 구분선) */
.action-button + .action-button {
  border-left: 1px solid rgba(0, 0, 0, 0.05); /* 세로 구분선 */
}

.action-button:hover {
  color: #357abd;
}

.action-button i {
  font-size: 1.1em;
  margin-bottom: 5px;
}

/* 기본 버튼 아이콘 크기 */
.google-search-button i,
.scrap-button i,
.share-button i {
  font-size: 1.7em; /* 기본 아이콘 크기 설정 (원하는 크기로 조절) */
}

/* 모바일 화면에서 아이콘 크기 조절 (예: 768px 이하) */
@media (max-width: 768px) {
  .google-search-button i,
  .scrap-button i,
  .share-button i {
    font-size: 1.5em; /* 모바일에서 아이콘 크기 (원하는 크기로 조절) */
  }
}

/* 더 작은 모바일 화면에서 아이콘 크기 조절 (예: 480px 이하) */
@media (max-width: 480px) {
  .google-search-button i,
  .scrap-button i,
  .share-button i {
    font-size: 1.3em; /* 더 작은 모바일에서 아이콘 크기 (원하는 크기로 조절) */
  }
}

/* PC 호버 시 나타나는 화살표 */
.nav-arrow {
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
  cursor: pointer;
  z-index: 10; /* 카드보다 위에 오도록 */
}

.history-card:hover .nav-arrow {
  opacity: 0.5; /* 호버 시 나타나도록 */
}

.top-arrow {
  border-width: 0 15px 20px 15px;
  border-color: transparent transparent rgba(0, 0, 0, 0.5) transparent;
  top: -30px; /* 카드 위쪽 */
  left: 50%;
  transform: translateX(-50%);
}
.bottom-arrow {
  border-width: 20px 15px 0 15px;
  border-color: rgba(0, 0, 0, 0.5) transparent transparent transparent;
  bottom: -30px; /* 카드 아래쪽 */
  left: 50%;
  transform: translateX(-50%);
}
.left-arrow {
  border-width: 15px 20px 15px 0;
  border-color: transparent rgba(0, 0, 0, 0.5) transparent transparent;
  left: -30px; /* 카드 왼쪽 */
  top: 50%;
  transform: translateY(-50%);
}
.right-arrow {
  border-width: 15px 0 15px 20px;
  border-color: transparent transparent transparent rgba(0, 0, 0, 0.5);
  right: -30px; /* 카드 오른쪽 */
  top: 50%;
  transform: translateY(-50%);
}

/* 하단 메뉴 */
.footer {
  background-color: #ffffff;
  border-top: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-around;
  padding: 10px 0;
  flex-shrink: 0; /* 높이 고정 */
}

.footer-item {
  background: none;
  border: none;
  color: #777;
  font-size: 0.8em;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5px 10px;
  transition: color 0.2s;
  flex-grow: 1; /* 이 줄을 추가합니다.*/
  flex-basis: 0; /* 이 줄을 추가합니다.*/
}

.footer-item:hover,
.footer-item.active {
  color: #4a90e2;
}

.footer-item i {
  font-size: 1.3em;
  margin-bottom: 5px;
}

/* 첫 번째 버튼을 제외한 나머지 버튼에 왼쪽 테두리 추가 (세로 구분선) */
.footer-item + .footer-item {
  border-left: 1px solid rgba(0, 0, 0, 0.15); /* 0.05에서 0.15로 변경하여 더 진하게 */
}

/* 모달 (캘린더) */
.modal {
  display: none; /* 기본은 숨김 */
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.35);
  justify-content: center; /* 중앙 정렬 */
  align-items: center; /* 중앙 정렬 */
}

.modal-content {
  background: #fff;
  border-radius: 12px;
  max-width: 400px;
  width: 90%;
  margin: 0 auto;
  padding: 24px 18px 18px 18px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
  position: relative;
  /* 필요시 transform 제거 */
}

.close-button {
  color: white; /* 기본 색상을 흰색으로 변경 */
  position: absolute;
  /* 모달 콘텐츠 상단에서 위쪽 바깥으로 더 높이 이동, 약간 더 오른쪽으로 */
  top: -40px; /* 모달 콘텐츠 상단에서 위로 50px 이동 (더 높이) */
  right: 4px; /* 오른쪽에서 안쪽으로 5px 이동 (오른쪽으로 더 이동) */
  font-size: 28px; /* 글자 크기 유지 */
  font-weight: 900; /* 최대한 굵게 (일부 폰트는 900이 적용되지 않을 수 있음) */
  cursor: pointer;
  background-color: transparent; /* 배경색 제거 */
  border-radius: 0; /* 둥근 테두리 제거 */
  width: auto; /* 너비 자동 */
  height: auto; /* 높이 자동 */
  padding: 0; /* 패딩 제거 */
  box-shadow: none; /* 그림자 제거 */
  text-shadow: 0 0 5px rgba(0, 0, 0, 0.5); /* 어두운 배경에서 흰색이 잘 보이도록 그림자 추가 */
  transition: color 0.2s, text-shadow 0.2s; /* 호버 효과 */
}

.close-button:hover,
.close-button:focus {
  color: #eee; /* 호버 시 색상을 약간 어둡게 유지 */
  text-decoration: none;
  cursor: pointer;
  background-color: transparent; /* 호버 시에도 배경색 없음 */
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.7); /* 호버 시 그림자 강조 유지 */
}

/* 캘린더 헤더 스타일 */
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding: 0 10px;
}

.calendar-header h3 {
  margin: 0;
  font-size: 1.4em;
  color: #333;
}

.calendar-header .nav-btn {
  background: none;
  border: none;
  font-size: 1.2em;
  color: #4a90e2;
  cursor: pointer;
  padding: 5px 10px;
  transition: color 0.2s;
}

.calendar-header .nav-btn:hover {
  color: #357abd;
}

/* 캘린더 요일 표시 스타일 */
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-weight: bold;
  color: #555;
  margin-bottom: 10px;
}

.calendar-weekdays span {
  padding: 5px 0;
  font-size: 0.9em;
}

/* 주말 색상 */
.calendar-weekdays span:first-child {
  color: #d9534f; /* 일요일 빨간색 */
}
.calendar-weekdays span:last-child {
  color: #4a90e2; /* 토요일 파란색 */
}

/* 캘린더 날짜 그리드 스타일 */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr); /* 7일 */
  gap: 5px;
  text-align: center;
}

.calendar-day {
  padding: 10px 5px; /* 세로 패딩 약간 줄이고 좌우 패딩 유지 */
  border-radius: 5px;
  background-color: #f0f0f0;
  cursor: pointer;
  position: relative;
  font-size: 0.9em;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 40px; /* 최소 높이 지정하여 셀 크기 일관성 유지 */
  box-sizing: border-box; /* 패딩이 너비에 포함되도록 */
  transition: background-color 0.2s, color 0.2s;
}

.calendar-day:hover {
  background-color: #e0e0e0;
}

/* 특정 이벤트가 있는 날짜 표시 */
.calendar-day.has-event {
  font-weight: bold; /* 이벤트 있는 날짜는 볼드체 */
}
.calendar-day.has-event::after {
  content: "";
  position: absolute;
  bottom: 5px;
  width: 5px;
  height: 5px;
  background-color: #4a90e2; /* 이벤트 점 색상 */
  border-radius: 50%;
}

/* 오늘 날짜 스타일 */
.calendar-day.current-date {
  font-weight: bold;
  background-color: #4a90e2;
  color: white;
}
.calendar-day.current-date.has-event::after {
  background-color: white; /* 오늘 날짜에 이벤트가 있으면 점도 흰색 */
}

/* 이전/다음 달 날짜 (회색 처리) */
.calendar-day.other-month {
  color: #bbb;
  background-color: #f8f8f8;
  cursor: default;
}
.calendar-day.other-month:hover {
  background-color: #f8f8f8; /* 호버 효과 제거 */
}
.calendar-day.other-month.has-event::after {
  background-color: #bbb; /* 다른 달 이벤트 점도 회색 */
}

/* 모바일 뷰포트 고려 */
@media (max-width: 480px) {
  .container {
    height: 100vh;
    width: 100vw;
  }
  .card-wrapper {
    max-width: 95%; /* 모바일에서 카드 너비 조정 */
    padding-bottom: 95%; /* 모바일에서도 정사각형 유지 */
  }
  .nav-arrow {
    /* 모바일에서는 화살표 숨김 (스와이프 사용) */
    display: none;
  }

  /* 카드 내 요소 모바일 최적화 */
  .card-header {
    margin-bottom: 8px; /* 헤더 하단 마진 줄임*/
  }

  .card-date {
    font-size: 1.8em; /* 날짜 폰트 크기 줄임*/
  }

  .card-count-box {
    padding: 5px 10px; /* 카운트 박스 패딩 줄임*/
    font-size: 1em; /* 카운트 박스 폰트 크기 줄임*/
  }

  .card-info {
    font-size: 0.8em; /* 정보 섹션 폰트 크기 줄임*/
    margin-bottom: 5px; /* 정보 섹션 하단 마진 줄임*/
  }

  .card-info .card-badge {
    padding: 3px 6px; /* 뱃지 패딩 줄임*/
    font-size: 0.7em; /* 뱃지 폰트 크기 줄임*/
    margin-right: 6px; /* 뱃지 오른쪽 마진 줄임*/
  }

  .card-event {
    font-size: 1.1em; /* 이벤트 제목 폰트 크기 줄임*/
    margin-bottom: 5px; /* 이벤트 제목 하단 마진 줄임*/
    flex-shrink: 0; /* 모바일에서도 줄어들지 않도록 명시 */
  }

  .card-details {
    font-size: 0.9em; /* 본문 내용 폰트 크기 줄임*/
    line-height: 1.4; /* 줄 간격 약간 줄임*/
    overflow-y: hidden; /* 모바일에서 스크롤바 숨김 */
    /* 이 max-height가 중요합니다. 이 값을 조정하여 details 내용의 최대 높이를 고정하세요. */
    /* 이 높이를 초과하는 내용은 잘려서 보이지 않습니다. */
    max-height: 120px; /* 모바일에서 details의 최대 높이를 제한합니다. (이 값은 조절 필요) */
    padding-right: 0; /* 스크롤바가 없으므로 패딩 제거 */
    margin-bottom: 5px; /* 하단 버튼과의 간격 조절 */
  }

  .card-actions {
    /* flex-shrink: 0;는 이미 전역에서 적용되므로 모바일에서는 필요 없습니다. */
    /* 하지만, 혹시 모르니 모바일에서만 특정 마진을 조절할 수 있습니다. */
    padding-top: 8px; /* 모바일에서 버튼 상단 패딩 조절 */
  }

  .action-button {
    font-size: 0.75em; /* 액션 버튼 폰트 크기 줄임*/
    padding: 3px; /* 모바일 버튼 패딩 줄임 */
  }
  .action-button i {
    font-size: 1em; /* 액션 버튼 아이콘 크기 줄임*/
  }
  .footer-item {
    font-size: 0.7em;
  }
  .footer-item i {
    font-size: 1.3em;
  }
}

/* The switch - the box around the slider */
.switch {
  position: relative;
  display: inline-block;
  width: 45px; /* 너비 감소 */
  height: 25px; /* 높이 감소 */
}

/* Hide default HTML checkbox */
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

/* The slider */
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  -webkit-transition: 0.4s;
  transition: 0.4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px; /* 크기 감소 */
  width: 18px; /* 크기 감소 */
  left: 4px;
  bottom: 3.5px;
  background-color: white;
  -webkit-transition: 0.4s;
  transition: 0.4s;
}

input:checked + .slider {
  background-color: #4a90e2;
}

input:focus + .slider {
  box-shadow: 0 0 1px #4a90e2;
}

input:checked + .slider:before {
  -webkit-transform: translateX(18px); /* 이동 거리 감소 */
  -ms-transform: translateX(18px); /* 이동 거리 감소 */
  transform: translateX(18px); /* 이동 거리 감소 */
}

/* Rounded sliders */
.slider.round {
  border-radius: 25px; /* 높이에 맞춰 둥글게 */
}

.slider.round:before {
  border-radius: 50%;
}

/* Dark mode styles */
body.dark-mode {
  background-color: #222;
  color: #eee;
}

body.dark-mode .container {
  background-color: #333;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

body.dark-mode .header {
  background-color: #1a1a1a;
}

body.dark-mode .today-button {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode .history-card {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5), 0 3px 6px rgba(0, 0, 0, 0.2);
}

/* Dark mode card backgrounds - lighter for contrast */
/* 카드 배경색 (Dark mode) */
body.dark-mode .history-card.korean-history {
  background-color: #36454f;
  color: #e0e0e0;
} /* Charcoal */
body.dark-mode .history-card.world-history {
  background-color: #483d8b;
  color: #e0e0e0;
} /* Dark Slate Blue */
body.dark-mode .history-card.person-history {
  background-color: #3cb371;
  color: #e0e0e0;
} /* Medium Sea Green */
body.dark-mode .history-card.science-history {
  background-color: #800080;
  color: #e0e0e0;
} /* Purple */
body.dark-mode .history-card.default-history {
  background-color: #333333;
  color: #e0e0e0;
} /* Dark Gray */

/* 다크 모드 뱃지 배경색 (Dark mode) */
body.dark-mode .card-badge.korean-history-badge {
  background-color: #5f9ea0;
} /* Cadet Blue */
body.dark-mode .card-badge.world-history-badge {
  background-color: #6a5acd;
} /* Slate Blue */
body.dark-mode .card-badge.person-history-badge {
  background-color: #2e8b57;
} /* Sea Green */
body.dark-mode .card-badge.science-history-badge {
  background-color: #ba55d3;
} /* Medium Orchid */
body.dark-mode .card-badge.default-history-badge {
  background-color: #555555;
} /* Medium Dark Gray */

body.dark-mode .card-date {
  color: #9de0ff; /* Light blue for date in dark mode */
}

body.dark-mode .card-count-box {
  background-color: #666;
  color: #eee;
}

body.dark-mode .card-info {
  color: #bbb;
}

body.dark-mode .card-event,
body.dark-mode .card-details {
  color: #eee;
}

body.dark-mode .card-actions {
  border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .action-button {
  color: #9de0ff;
}

body.dark-mode .action-button + .action-button {
  border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .footer {
  background-color: #1a1a1a;
  border-color: #444;
}

body.dark-mode .footer-item {
  color: #bbb;
}

body.dark-mode .footer-item:hover,
body.dark-mode .footer-item.active {
  color: #9de0ff;
}

body.dark-mode .modal-content {
  background-color: #444;
  color: #eee;
}

body.dark-mode .close-button {
  color: #eee;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
}

body.dark-mode .close-button:hover,
body.dark-mode .close-button:focus {
  color: #ccc;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

body.dark-mode .calendar-header h3 {
  color: #eee;
}

body.dark-mode .calendar-header .nav-btn {
  color: #9de0ff;
}

body.dark-mode .calendar-weekdays {
  color: #bbb;
}

body.dark-mode .calendar-weekdays span:first-child {
  color: #ff9999;
} /* Red for Sunday */
body.dark-mode .calendar-weekdays span:last-child {
  color: #9de0ff;
} /* Blue for Saturday */

body.dark-mode .calendar-day {
  background-color: #555;
  color: #eee;
}

body.dark-mode .calendar-day:hover {
  background-color: #666;
}

body.dark-mode .calendar-day.has-event::after {
  background-color: #9de0ff;
}

body.dark-mode .calendar-day.current-date {
  background-color: #9de0ff;
  color: #333;
}

body.dark-mode .calendar-day.current-date.has-event::after {
  background-color: #333;
}

body.dark-mode .calendar-day.other-month {
  color: #888;
  background-color: #444;
}

body.dark-mode .calendar-day.other-month:hover {
  background-color: #444;
}

body.dark-mode .calendar-day.other-month.has-event::after {
  background-color: #888;
}

.scrap-header {
  display: flex;
  align-items: center; /* 수직 중앙 정렬 */
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 2px;
}

.scrap-header h3 {
  margin: 0;
  font-size: 1.1em;
  font-weight: bold;
}

#scrapSortBox {
  display: flex;
  gap: 10px;
}

#scrapSortBox button {
  padding: 6px 14px;
  border: 1px solid #ccc;
  background: white;
  cursor: pointer;
  border-radius: 5px;
  font-size: 1em;
  height: 36px; /* h3 높이와 비슷하게 맞춤 */
  display: flex;
  align-items: center;
}

#scrapSortBox button:active,
#scrapSortBox button:focus {
  border-color: #4a90e2;
  color: #4a90e2;
}

/* 다크 모드 대응 */
body.dark-mode #scrapSortBox button {
  background: #333;
  color: #eee;
  border-color: #666;
}
body.dark-mode #scrapSortBox button:active,
body.dark-mode #scrapSortBox button:focus {
  border-color: #9de0ff;
  color: #9de0ff;
}

/* toast 스타일 */
.toast {
  visibility: hidden;
  min-width: 180px;
  background-color: #333;
  color: #fff;
  text-align: center;
  border-radius: 8px;
  padding: 14px 24px;
  position: fixed;
  left: 50%;
  bottom: 60px;
  transform: translateX(-50%);
  z-index: 2000;
  font-size: 1em;
  opacity: 0;
  transition: opacity 0.4s, visibility 0.4s;
}
.toast.show {
  visibility: visible;
  opacity: 1;
}
/* 다크 모드 대응 */
body.dark-mode .toast {
  background-color: #222;
  color: #9de0ff;
}
