@charset "UTF-8";

/* 멤버십 토글 */
#membership-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem auto;
  margin-bottom: 1rem; /* 검색창과의 간격 조정 */
  padding: 1rem;
  font-size: 0.95rem;
  color: var(--text-color);
  font-weight: bold;
  max-width: 1000px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 20px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--button-bg);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.label-text {
  font-family: 'mabinogi_classic';
  color: var(--text-color);
}

/* 검색 섹션 */
#search-section {
  margin-bottom: 2rem;
}

#search-input {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  margin-bottom: 0.5rem;
  background: var(--input-bg);
  color: var(--input-text);
}

#search-results {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--section-border);
  border-radius: 6px;
  background: var(--container-bg);
}

.search-result {
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: background 0.2s;
  color: var(--text-color);
}

.search-result:hover {
  background: var(--section-bg);
}

/* 아이템 선택 섹션 */
#item-selector {
  margin-bottom: 2rem;
}

.category {
  margin-bottom: 1rem;
}

.category h3 {
  font-family: 'mabinogi_classic';
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  color: var(--text-color);
}

#item-selector ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

#item-selector li {
  padding: 0.25rem 0.5rem;
  background: var(--section-bg);
  border: 1px solid var(--section-border);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
  color: var(--text-color);
}

#item-selector li:hover {
  background: var(--button-hover-bg);
  color: var(--button-text);
}

/* 제작 인벤토리 */
#craft-inventory {
  max-width: 800px;
  margin: 0 auto;
  padding: 1rem;
  background: var(--container-bg);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  margin-top: 0; /* 검색칸 바로 아래 위치 */
}

.craft-card {
  background: var(--container-bg);
  border: 1px solid var(--section-border);
  border-radius: 8px;
  margin-bottom: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.card-header {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  background: var(--section-bg);
  border-bottom: 1px solid var(--section-border);
  border-radius: 8px 8px 0 0;
}

.card-icon {
  margin-right: 0.5rem;
  color: var(--text-color);
}

.card-title {
  flex: 1;
  font-family: 'mabinogi_classic';
  font-weight: bold;
  color: var(--text-color);
}

.quantity-input {
  width: 60px;
  margin-right: 0.5rem;
  padding: 0.25rem;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  background: var(--input-bg);
  color: var(--input-text);
}

.toggle-btn, .toggle-sub-btn, .remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-color);
  padding: 0 0.25rem; /* 버튼 크기 조정 */
  margin-left: 0.25rem; /* 버튼 간격 조정 */
}

.card-content {
  padding: 0.75rem;
  display: block; /* 1뎁스 재료는 기본적으로 펼침 */
}

.material-list {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column; /* 수직으로 배치 */
}

.material-item {
  display: flex;
  flex-wrap: wrap;
  flex-direction: row;
  padding: 0.5rem 0; /* 재료 간 여백 */
  border-bottom: 1px solid var(--section-border); /* 재료 간 경계선 */
}

.material-header {
  display: flex;
  align-items: center;
  width: 100%; /* 헤더 전체 너비 */
  gap: 0.5rem; /* 요소 간 간격 */
}

.material-icon {
  margin-right: 0.5rem;
  color: var(--text-color);
}

.material-name {
  color: var(--text-color);
}

.material-quantity {
  margin-right: 0.5rem;
  color: var(--text-color);
}

.toggle-sub-btn {
  width: auto; /* 버튼 크기 자동 조정 */
  min-width: 20px; /* 최소 너비 설정 */
  text-align: center;
}

.sub-materials {
  margin-top: 0.25rem; /* 하위 재료는 아래로 열림 */
  padding-left: 1.5rem; /* 계층 구분을 위한 들여쓰기 */
  display: none; /* 하위 재료는 기본적으로 접힘 */
  width: 100%; /* 수직으로 열리도록 너비 조정 */
  padding: 0.25rem 0; /* 하위 재료 여백 */
  border-left: 2px solid var(--input-border); /* 테두리로 계층 구분 */
}

/* 계층 깊이에 따라 들여쓰기 증가 */
.sub-materials .sub-materials {
  padding-left: 2rem; /* 더 깊은 계층은 들여쓰기 증가 */
}

.sub-materials .sub-materials .sub-materials {
  padding-left: 2.5rem; /* 더 깊은 계층은 들여쓰기 증가 */
}

.sub-materials[style*="display: block"] {
  display: block; /* JavaScript에서 설정된 display: block 유지 */
}

.time-display, .total-summary {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-color);
}

/* 다크 모드 조정 */
body.dark-mode #search-input,
body.dark-mode .quantity-input {
  background: var(--input-bg);
  color: var(--input-text);
  border-color: var(--input-border);
}

body.dark-mode #search-results,
body.dark-mode .craft-card,
body.dark-mode #craft-inventory {
  background: var(--container-bg);
  border-color: var(--section-border);
}

body.dark-mode .card-header {
  background: var(--section-bg);
  border-color: var(--section-border);
}

body.dark-mode .search-result:hover {
  background: var(--section-bg);
}

body.dark-mode .sub-materials {
  border-color: var(--input-border); /* 다크 모드에서 테두리 색상 유지 */
}
.empty-message {
  text-align: center;
  padding: 1rem;
  color: var(--text-color);
  font-size: 1rem;
  font-style: italic;
  display: block;
}

/* 다크 모드 조정 */
body.dark-mode .empty-message {
  color: var(--text-color);
}

/* 반응형 디자인 */
@media (max-width: 600px) {
  #craft-inventory {
    padding: 0.5rem;
  }

  .craft-card {
    margin-bottom: 0.5rem;
  }

  .card-header, .card-content {
    padding: 0.5rem;
  }

  .quantity-input {
    width: 50px;
  }

  .material-item {
    font-size: 0.9rem;
  }

  .time-display, .total-summary {
    font-size: 0.8rem;
  }

  #membership-toggle {
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    font-size: 0.9rem;
  }
}