.filter-btn {
  width: 100px;
  color: white;
  font-size: 20px;
  background-color: black;
  margin-top: 0; /* 기존 30px에서 0으로 변경 */
  margin-left: 0; /* 기존 20px에서 0으로 변경 */
  border: 1.5px solid white;
  border-radius: 21px;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.filter-btn:hover {
  background-color: white;
  color: black;
}

.filter-btn:active {
  background-color: rgb(189, 189, 189);
  color: white;
}

.main-content {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  padding: 20px 0;
}

.tool-card {
  border-style: solid;
  border-width: 1px;
  color: white;
  background-color: rgb(26, 26, 26);
  border-color: white;
  border-radius: 10px;
  margin: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start; /* 변경: space-between → flex-start */
  height: 100%; /* 카드 높이 균일하게 */
}

.upper-section {
  display: flex;
  padding: 15px 15px 15px 15px;
  gap: 15px;
}

.tag-section {
  padding: 0 15px 0 15px;
  display: flex;           /* flex로 변경 */
  flex-wrap: wrap;         /* 여러 줄 허용 */
  gap: 6px 8px;            /* 행간(세로) 6px, 열간(가로) 8px 간격 */
  align-items: center;
}

.lower-section {
  padding: 0 15px 15px 15px;
  flex: 1 1 auto;         /* 추가: 설명문 영역이 남는 공간을 채움 */
  display: flex;          /* 추가: 내부 정렬을 위해 flex 사용 */
  flex-direction: column; /* 추가: 세로 정렬 */
  justify-content: flex-end; /* 추가: 설명문과 버튼을 아래로 정렬 */
}

.tool-image {
  width: 75px;
  height: 75px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
}

.tool-name {
  font-size: 18px;
  align-self: center;
}

.region-i-tag {
  color: black;
  font-weight: 700;
  font-size: 12px;
  background-color: rgb(136, 204, 240);
  padding: 5px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  height: auto;
  min-height: 22px;
  line-height: 14px;
  vertical-align: middle;
  word-break: keep-all;
  white-space: pre-line;
  box-sizing: border-box;
}

.region-d-tag {
  color: black;
  font-weight: 700;
  font-size: 12px;
  background-color: rgb(255, 150, 150);
  padding: 5px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  height: auto;
  min-height: 22px;
  line-height: 14px;
  vertical-align: middle;
  word-break: keep-all;
  white-space: pre-line;
  box-sizing: border-box;
}

.region-i-d-tag {
  color: black;
  font-weight: 700;
  font-size: 12px;
  background-color: rgb(136, 204, 240);
  padding: 5px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  height: auto;
  min-height: 22px;
  line-height: 14px;
  vertical-align: middle;
  word-break: keep-all;
  white-space: pre-line;
  box-sizing: border-box;
}

.price-f-tag {
  color: black;
  font-weight: 700;
  font-size: 12px;
  background-color: rgb(79, 214, 79);
  padding: 5px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  height: auto;
  min-height: 22px;
  line-height: 14px;
  vertical-align: middle;
  word-break: keep-all;
  white-space: pre-line;
  box-sizing: border-box;
}

.price-p-tag {
  color: black;
  font-weight: 700;
  font-size: 12px;
  background-color: rgb(216, 206, 99);
  padding: 5px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  height: auto;
  min-height: 22px;
  line-height: 14px;
  vertical-align: middle;
  word-break: keep-all;
  white-space: pre-line;
  box-sizing: border-box;
}

.price-ft-tag {
  color: black;
  font-weight: 700;
  font-size: 12px;
  background-color: rgb(79, 214, 79);
  padding: 5px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  height: auto;
  min-height: 22px;
  line-height: 14px;
  vertical-align: middle;
  word-break: keep-all;
  white-space: pre-line;
  box-sizing: border-box;
}

.category-tag {
  color: black;
  font-weight: 700;
  font-size: 12px;
  background-color: rgb(148, 148, 148);
  padding: 5px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  height: auto;
  min-height: 22px;
  line-height: 14px;
  vertical-align: middle;
  word-break: keep-all;
  white-space: pre-line;
  box-sizing: border-box;
}

.description {
  font-size: 16px;
  word-break: keep-all;
  white-space: normal;
  margin-bottom: auto; /* 추가: 설명문 아래로 여백이 생기도록 */
}

.link-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 15px;
  background-color: rgb(190, 190, 190);
  color: black;
  font-size: 17px;
  width: 100%;
  height: 35px;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.15s;
  border: none;
  box-sizing: border-box;
  text-decoration: none;
  gap: 6px; /* 아이콘과 텍스트 간격 */
}

.link-btn:hover {
  background-color: rgb(150, 150, 150);
}

.link-btn:active {
  background-color: rgb(120, 120, 120);
}

.visit-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0; /* 아이콘 크기 고정 */
  display: block; /* 인라인 요소 문제 해결 */
}

.visit-text {
  font-size: 17px;
  font-weight: inherit;
  color: inherit;
  line-height: 1; /* 텍스트 높이 정규화 */
  display: flex;
  align-items: center; /* 텍스트 내부에서도 수직 정렬 */
  margin-top: 3px;
}

/* 검색창 스타일 추가 */
.search-bar-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 25px;
  gap: 0;
}

.search-input-wrapper {
  position: relative;
  width: 600px; /* 기존 320px → 420px */
}

.search-input {
  width: 100%;
  height: 54px; /* 기존 40px → 48px */
  border-radius: 28px; /* 높이에 맞춰 radius도 약간 증가 */
  border: 1.5px solid white;
  background: black;
  color: white;
  font-size: 22px; /* 높이에 맞춰 폰트도 약간 증가 */
  padding: 0 64px 0 26px; /* 오른쪽 패딩도 약간 증가 */
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.search-input::placeholder {
  color: #cccccc;
  font-size: 16px;
}

.search-input:focus {
  border-color: #0088d1;
}

.search-icon-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  height: 32px; /* 아이콘 버튼도 높이 증가 */
  width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-icon-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

/* 태블릿 */
@media (max-width: 900px) {
  .main-content {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 16px 0;
  }
  
  .filter-btn {
    margin-left: 10px;
    margin-top: 25px;
    font-size: 18px;
  }
  
  .tool-name {
    font-size: 22px;
  }
  
  .description {
    font-size: 16px;
  }
  
  .tool-image {
    width: 60px;
    height: 60px;
    border-radius: 10px;
  }
  
  .upper-section {
    padding: 12px;
    gap: 12px;
  }
  
  .lower-section {
    padding: 0 12px 12px 12px;
  }
  
  .search-input-wrapper {
    width: 350px;
  }
  .search-input {
    font-size: 18px;
    height: 44px;
    border-radius: 22px;
    padding: 0 48px 0 14px;
  }
  .search-icon-btn {
    height: 28px;
    width: 28px;
    right: 8px;
  }
  .search-icon-img {
    width: 22px;
    height: 22px;
  }
}

/* 작은 태블릿 */
@media (max-width: 700px) {
  .main-content {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .tool-image {
    width: 50px;
    height: 50px;
    border-radius: 9px;
  }
}

/* 모바일 */
@media (max-width: 500px) {
  .main-content {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px 0;
  }
  
  .filter-btn {
    margin-left: 5px;
    margin-top: 20px;
    font-size: 16px;
    width: 90px;
  }
  
  .tool-card {
    border-radius: 8px;
  }
  
  .upper-section {
    padding: 10px;
    gap: 10px;
  }
  
  .tool-image {
    width: 40px;
    height: 40px;
    border-radius: 7px;
  }
  
  .lower-section {
    padding: 0 10px 10px 10px;
  }
  
  .tool-info {
    margin-left: 0;
  }
  
  .tool-name {
    font-size: 18px;
    margin-bottom: 5px;
  }
  
  .description {
    font-size: 14px;
    margin-bottom: 5px;
  }
  
  .link-btn {
    height: 32px;
    font-size: 15px;
    margin-top: 10px;
  }
  
  .visit-icon {
    width: 12px;
    height: 12px;
  }
  
  .region, .region-k {
    font-size: 13px;
    padding: 3px;
  }
  
  .search-bar-container {
    flex-direction: column;
    margin-bottom: 10px;
  }
  .search-input-wrapper {
    width: 100%;
  }
  .search-input {
    width: 100%;
    font-size: 15px;
    height: 36px;
    border-radius: 16px;
    padding: 0 36px 0 10px;
  }
  .search-icon-btn {
    height: 20px;
    width: 20px;
    right: 6px;
  }
  .search-icon-img {
    width: 16px;
    height: 16px;
  }
}

/* 아주 작은 모바일 */
@media (max-width: 350px) {
  .tool-image {
    width: 30px;
    height: 30px;
    border-radius: 5px;
  }
  .search-input {
    font-size: 13px;
    height: 28px;
    border-radius: 10px;
    padding: 0 24px 0 6px;
  }
}

/* main.css에 추가 */
.category-btn.active {
  background-color: #fff;
  color: #000;
  font-weight: bold;
}
.filter-panel {
  margin-left: 20px;
  margin-top: 10px;
  display: flex;
  gap: 10px;
  cursor: pointer;
}
.filter-panel select {
  height: 32px;
  font-size: 16px;
  border-radius: 8px;
  padding: 0 10px;
  cursor: pointer;
}
.sort-btn {
  width: 100px;
  color: white;
  font-size: 20px;
  background-color: black;
  margin-top: 0;
  margin-right: 0;
  border: 1.5px solid white;
  border-radius: 21px;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.sort-btn:hover {
  background-color: white;
  color: black;
}
.sort-btn:active {
  background-color: rgb(189, 189, 189);
  color: white;
}

.sort-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background-color: black;
  border: 1.5px solid white;
  border-radius: 8px;
  z-index: 10;
  margin-top: 5px;
  width: 100px;
}

.sort-option {
  color: white;
  font-size: 16px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background-color 0.15s;
}

.sort-option:hover {
  background-color: white;
  color: black;
}

.sort-option:first-child {
  border-radius: 6px 6px 0 0;
}

.sort-option:last-child {
  border-radius: 0 0 6px 6px;
}

/* 가격 필터 버튼 스타일 */
.price-filter-btn {
  width: 140px; /* 지역 버튼과 동일한 너비로 변경 */
  color: white;
  font-size: 20px;
  background-color: black;
  margin-top: 0;
  margin-right: 0;
  border: 1.5px solid white;
  border-radius: 21px;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.price-filter-btn:hover {
  background-color: white;
  color: black;
}
.price-filter-btn:active {
  background-color: rgb(189, 189, 189);
  color: white;
}

/* 지역 필터 버튼 스타일 */
.region-filter-btn {
  width: 140px; /* 가격 버튼과 동일한 너비로 변경 */
  color: white;
  font-size: 20px;
  background-color: black;
  margin-top: 0;
  margin-right: 0;
  border: 1.5px solid white;
  border-radius: 21px;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.region-filter-btn:hover {
  background-color: white;
  color: black;
}
.region-filter-btn:active {
  background-color: rgb(189, 189, 189);
  color: white;
}

/* 가격 필터 드롭다운 */
.price-filter-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  background-color: black;
  border: 1.5px solid white;
  border-radius: 8px;
  z-index: 10;
  margin-top: 5px;
  width: 140px; /* 버튼과 동일한 너비 */
}

/* 지역 필터 드롭다운 */
.region-filter-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  background-color: black;
  border: 1.5px solid white;
  border-radius: 8px;
  z-index: 10;
  margin-top: 5px;
  width: 140px; /* 버튼과 동일한 너비 */
}

/* 필터 옵션 스타일 */
.filter-option {
  color: white;
  font-size: 16px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background-color 0.15s;
}

.filter-option:hover {
  background-color: white;
  color: black;
}

.filter-option:first-child {
  border-radius: 6px 6px 0 0;
}

.filter-option:last-child {
  border-radius: 0 0 6px 6px;
}

/* 기존 필터 관련 스타일 제거 */
.filter-btn {
  display: none !important;
}

.filter-panel {
  display: none !important;
}

/* 스킵 링크 추가 */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: black;
  color: white;
  padding: 8px;
  text-decoration: none;
  z-index: 1000;
}

.skip-link:focus {
  top: 6px;
}

/* 기존 카테고리 스타일 유지 */
.category {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  row-gap: 10px;
  justify-content: center;
  align-items: center;
  padding: 0 20px;
}

.category-btn {
  color: white;
  font-size: 18px;
  background-color: black;
  margin-right: 10px;
  border: 1.5px solid white;
  padding: 5px 10px;
  border-radius: 21px;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
  width: auto;
  min-width: 85px;
  height: 42px;
  text-align: center;
  box-sizing: border-box;
  white-space: nowrap;
}

.category-btn:hover {
  background-color: white;
  color: black;
}

.category-btn:active {
  background-color: rgb(189, 189, 189);
  color: white;
}

.category-btn.active {
  background-color: #fff;
  color: #000;
  font-weight: bold;
}

/* 모바일 카테고리 필터 스타일 */
.category-mobile {
  display: none;
  width: 100%;
  justify-content: center;
  margin-bottom: 15px;
}

.category-filter-btn {
  width: 200px;
  color: white;
  font-size: 18px;
  background-color: black;
  border: 1.5px solid white;
  border-radius: 21px;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
  padding: 10px 15px;
  text-align: center;
}

.category-filter-btn:hover {
  background-color: white;
  color: black;
}

.category-filter-btn:active {
  background-color: rgb(189, 189, 189);
  color: white;
}

.category-filter-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background-color: black;
  border: 1.5px solid white;
  border-radius: 8px;
  z-index: 20;
  margin-top: 5px;
  width: 200px;
  max-height: 300px;
  overflow-y: auto;
}

.category-filter-option {
  color: white;
  font-size: 16px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background-color 0.15s;
  border-bottom: 1px solid #333;
}

.category-filter-option:last-child {
  border-bottom: none;
}

.category-filter-option:hover {
  background-color: white;
  color: black;
}

.category-filter-option:first-child {
  border-radius: 6px 6px 0 0;
}

.category-filter-option:last-child {
  border-radius: 0 0 6px 6px;
}

/* 반응형 디스플레이 제어 */
.category-buttons-desktop {
  display: flex;
  flex-wrap: wrap;
  row-gap: 10px;
  justify-content: center;
  align-items: center;
  width: 100%;
}

/* 태블릿 */
@media (max-width: 900px) {
  .category {
    padding: 0 10px;
    row-gap: 8px;
  }
  
  .category-btn {
    font-size: 16px;
    margin-right: 8px;
    min-width: 75px;
    height: 38px;
  }
  
  .category-filter-btn {
    font-size: 16px;
    width: 180px;
  }
  
  .category-filter-dropdown {
    width: 180px;
  }
}

/* 모바일 - 카테고리 드롭다운으로 전환 */
@media (max-width: 600px) {
  .category-buttons-desktop {
    display: none;
  }
  
  .category-mobile {
    display: flex;
  }
  
  .category {
    padding: 0 5px;
    margin-bottom: 10px;
  }
  
  .category-filter-btn {
    font-size: 15px;
    width: 160px;
    padding: 8px 12px;
  }
  
  .category-filter-dropdown {
    width: 160px;
    max-height: 250px;
  }
  
  .category-filter-option {
    font-size: 14px;
    padding: 10px 12px;
  }
}

/* 아주 작은 모바일 */
@media (max-width: 400px) {
  .category-filter-btn {
    font-size: 14px;
    width: 140px;
  }
  
  .category-filter-dropdown {
    width: 140px;
  }
  
  .category-filter-option {
    font-size: 13px;
    padding: 8px 10px;
  }
}
