/* =========================
   공통 조합법 스타일 (채광/재배/해양 공용)
========================= */

/* 콘텐츠 영역 너비 - 반응형 */
#tab-recipes .content-area,
#tab-cooking .content-area,
#tab-processing .content-area {
  max-width: 1160px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

/* 조합법 카드 헤더 */
.card-header {
  position: relative;
}

/* 토글 버튼 (기본 재료 가격) */
.toggle-materials-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  padding: 6px 12px;
  background-color: var(--color-bg-secondary, #f8f9fa);
  border: 1px solid var(--color-border, #e0e0e0);
  border-radius: 4px;
  font-size: 12px;
  color: var(--color-text-secondary, #666);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.toggle-materials-btn:hover {
  background-color: var(--color-bg-hover, #f0f2f5);
  border-color: var(--color-primary, #4a90e2);
  color: var(--color-primary, #4a90e2);
}

.toggle-icon {
  font-size: 10px;
  transition: transform 0.2s;
}

.toggle-icon.open {
  transform: rotate(180deg);
}

/* 기본 재료 가격 토글 영역 */
.basic-materials-toggle {
  padding: 12px 16px;
  background-color: var(--color-bg-secondary, #f8f9fa);
  border-top: 1px solid var(--color-border, #e0e0e0);
  border-bottom: 1px solid var(--color-border, #e0e0e0);
}

.basic-materials-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
}

.material-inline {
  color: var(--color-text-secondary, #666);
}

.material-inline strong {
  color: var(--color-primary, #4a90e2);
  font-weight: 600;
  margin-left: 4px;
}

/* 가격 표시 스타일 - 파란색 */
.price-value {
  color: var(--color-primary, #2563eb);
  font-weight: 600;
  white-space: nowrap;
}

/* 조합법 내부 탭 */
.recipe-tabs {
  display: flex;
  border-bottom: 2px solid var(--color-border, #e0e0e0);
  background-color: var(--color-bg-secondary, #f8f9fa);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.recipe-tabs::-webkit-scrollbar {
  display: none;
}

.recipe-tab {
  flex: 1;
  min-width: 70px;
  padding: 12px 16px;
  border: none;
  background: none;
  font-size: clamp(12px, 3vw, 14px);
  font-weight: 500;
  color: var(--color-text-secondary, #666);
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  text-align: center;
  white-space: nowrap;
}

.recipe-tab:hover {
  background-color: var(--color-bg-hover, #f0f2f5);
  color: var(--color-text-primary, #333);
}

.recipe-tab.active {
  color: var(--color-primary, #4a90e2);
  background-color: white;
  border-bottom-color: var(--color-primary, #4a90e2);
}

/* 조합법 콘텐츠 */
.recipe-content {
  display: none;
  min-height: auto;
}

.recipe-content.active {
  display: block;
}

.recipe-content-inner {
  padding: 16px;
}

/* 컴팩트 테이블 컨트롤 */
.table-controls-compact {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.search-input-compact {
  flex: 1;
  min-width: 150px;
  padding: 8px 12px;
  border: 1px solid var(--color-border, #e0e0e0);
  border-radius: 4px;
  font-size: 13px;
  transition: border-color 0.2s;
}

.search-input-compact:focus {
  outline: none;
  border-color: var(--color-primary, #4a90e2);
}

.sort-select-compact {
  padding: 8px 24px 8px 12px;
  border: 1px solid var(--color-border, #e0e0e0);
  border-radius: 4px;
  font-size: 13px;
  background-color: white;
  cursor: pointer;
  transition: border-color 0.2s;
  flex-shrink: 0;
}

.sort-select-compact:focus {
  outline: none;
  border-color: var(--color-primary, #4a90e2);
}

/* 컴팩트 테이블 래퍼 */
.table-wrapper-compact {
  overflow-x: auto;
  overflow-y: auto;
  border-radius: 6px;
  border: 1px solid var(--color-border, #e0e0e0);
  max-height: 500px;
  max-width: 100%;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}

/* 스크롤바 스타일링 */
.table-wrapper-compact::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.table-wrapper-compact::-webkit-scrollbar-track {
  background: var(--color-bg-secondary, #f8f9fa);
}

.table-wrapper-compact::-webkit-scrollbar-thumb {
  background: var(--color-border, #e0e0e0);
  border-radius: 4px;
}

.table-wrapper-compact::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* 조합법 테이블 - 컴팩트 */
.recipe-table-compact {
  width: 100%;
  border-collapse: collapse;
  font-size: clamp(11px, 2.5vw, 13px);
  table-layout: auto;
  min-width: 400px;
}

.recipe-table-compact thead {
  background-color: var(--color-bg-secondary, #f8f9fa);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 0 var(--color-border, #e0e0e0);
}

.recipe-table-compact th {
  padding: 10px 12px;
  text-align: center;
  font-weight: 600;
  color: var(--color-text-primary, #333);
  font-size: clamp(11px, 2.5vw, 12px);
  white-space: nowrap;
}

.recipe-table-compact th:first-child {
  min-width: 120px;
  text-align: left;
}

.recipe-table-compact th:nth-child(2) {
  text-align: left;
}

.recipe-table-compact th:nth-child(3),
.recipe-table-compact th:nth-child(4) {
  min-width: 80px;
  text-align: right;
}

.recipe-table-compact tbody tr {
  border-bottom: 1px solid var(--color-border-light, #f0f0f0);
  transition: background-color 0.15s;
}

.recipe-table-compact tbody tr:hover {
  background-color: var(--color-bg-hover, #f8f9fa);
}

.recipe-table-compact tbody tr:last-child {
  border-bottom: none;
}

.recipe-table-compact td {
  padding: 10px 12px;
  color: var(--color-text-secondary, #666);
  font-size: clamp(11px, 2.5vw, 13px);
  vertical-align: middle;
}

.recipe-table-compact td:first-child {
  text-align: left;
  font-weight: 500;
  color: var(--color-text-primary, #333);
}

.recipe-table-compact td:nth-child(2) {
  text-align: left;
  word-break: break-word;
}

.recipe-table-compact td:nth-child(3),
.recipe-table-compact td:nth-child(4) {
  text-align: right;
}

.recipe-table-compact td:nth-child(3) {
  color: #2563eb;
  font-weight: 600;
}

.recipe-table-compact td:nth-child(4) {
  color: #ef4444;
  font-weight: 600;
}

/* 요리 이름 + 아이콘을 한 줄로 */
.recipe-table-compact .recipe-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--color-text-primary, #333);
  white-space: nowrap;
}

.recipe-table-compact .recipe-name img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
}

.recipe-table-compact .recipe-name span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.recipe-table-compact .recipe-ingredients {
  font-size: clamp(10px, 2.5vw, 12px);
  line-height: 1.5;
  color: var(--color-text-secondary, #666);
}

/* 가격 스타일 - 파란색 (테이블 내부) */
.recipe-table-compact .price-value {
  color: var(--color-primary, #2563eb) !important;
  font-weight: 600;
  white-space: nowrap;
}

/* 가공 재료 테이블 - 컴팩트 */
.processing-table-compact {
  width: 100%;
  border-collapse: collapse;
  font-size: clamp(11px, 2.5vw, 13px);
  table-layout: auto;
  min-width: 400px;
}

.processing-table-compact thead {
  background-color: var(--color-bg-secondary, #f8f9fa);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 0 var(--color-border, #e0e0e0);
}

.processing-table-compact th {
  padding: 10px 12px;
  text-align: center;
  font-weight: 600;
  color: var(--color-text-primary, #333);
  font-size: clamp(11px, 2.5vw, 12px);
}

.processing-table-compact th:first-child {
  min-width: 120px;
  text-align: left;
}

.processing-table-compact th:nth-child(2) {
  text-align: left;
}

.processing-table-compact tbody tr {
  border-bottom: 1px solid var(--color-border-light, #f0f0f0);
  transition: background-color 0.15s;
}

.processing-table-compact tbody tr:hover {
  background-color: var(--color-bg-hover, #f8f9fa);
}

.processing-table-compact tbody tr:last-child {
  border-bottom: none;
}

.processing-table-compact td {
  padding: 10px 12px;
  color: var(--color-text-secondary, #666);
  font-size: clamp(11px, 2.5vw, 13px);
  vertical-align: middle;
}

.processing-table-compact td:first-child {
  text-align: left;
}

.processing-table-compact td:nth-child(2) {
  text-align: left;
  word-break: break-word;
}

.processing-table-compact .processing-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--color-text-primary, #333);
  white-space: nowrap;
}

.processing-table-compact .processing-name img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
}

.processing-table-compact .processing-name span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.processing-table-compact .processing-materials {
  font-size: clamp(10px, 2.5vw, 12px);
  color: var(--color-text-secondary, #666);
}

/* 빈 상태 */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-muted, #999);
}

.empty-state-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.empty-state-text {
  font-size: 14px;
}



/* 반응형 디자인 */
@media (max-width: 768px) {
  .recipe-tab {
    font-size: 12px;
    padding: 10px 12px;
    min-width: 60px;
  }

  .recipe-content-inner {
    padding: 12px;
  }

  .toggle-materials-btn {
    position: static;
    transform: none;
    margin-top: 8px;
    width: 100%;
    justify-content: center;
  }

  .basic-materials-inline {
    flex-direction: column;
    gap: 8px;
  }

  .table-wrapper-compact {
    max-height: 400px;
  }

  .recipe-table-compact,
  .processing-table-compact {
    min-width: 350px;
  }

  .recipe-table-compact th,
  .recipe-table-compact td,
  .processing-table-compact th,
  .processing-table-compact td {
    padding: 8px 10px;
  }

  .recipe-table-compact .recipe-name img,
  .processing-table-compact .processing-name img {
    width: 20px;
    height: 20px;
  }
}

@media (max-width: 480px) {
  .table-controls-compact {
    flex-direction: column;
  }

  .search-input-compact,
  .sort-select-compact {
    width: 100%;
  }

  .recipe-content-inner {
    padding: 10px;
  }

  .table-wrapper-compact {
    max-height: 350px;
  }

  .recipe-table-compact,
  .processing-table-compact {
    min-width: 300px;
  }

  .recipe-table-compact th,
  .recipe-table-compact td,
  .processing-table-compact th,
  .processing-table-compact td {
    padding: 6px 8px;
  }
}

/* 추가 유틸리티 */
.text-muted {
  color: var(--color-text-muted, #999);
}

.text-small {
  font-size: 12px;
}