/**
 * 그룹 리스트 페이지 전용 스타일
 * 
 * @package Nexi_Native_App_Theme
 * @since 1.0.0
 */

/* 부모 테마 컨테이너 오버라이드 */
body.groups #content,
body.groups .container,
body.groups #main-content,
body.groups .site-content {
  max-width: 1300px !important;
  width: 100% !important;
  margin: 0 auto !important;
  padding: 0 !important;
}

/* 전체 컨테이너 */
.karrot-app-container {
  font-family: var(--native-font-family);
  background-color: #ffffff;
  min-height: 100vh;
  max-width: 1300px;
  width: 100%;
  margin: 0 auto;
  overflow-x: hidden;
}

/* 상단 헤더 */
.karrot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: #ffffff;
  border-bottom: 1px solid var(--native-gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
}

.karrot-header-left {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.karrot-location {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--native-gray-900);
  white-space: nowrap;
}

.karrot-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.karrot-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: none;
  border: none;
  color: var(--native-gray-700);
  cursor: pointer;
  transition: background-color 0.2s;
  text-decoration: none;
}

.karrot-icon-btn:hover {
  background-color: var(--native-gray-100);
  border-radius: 50%;
  text-decoration: none;
  color: inherit;
}

.karrot-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  background-color: #ff6f0f;
  border-radius: 9px;
  border: 2px solid #ffffff;
}

/* 검색 영역 */
.karrot-search-container {
  background-color: #ffffff;
  border-bottom: 1px solid var(--native-gray-200);
  padding: 12px 16px;
  animation: slideDown 0.3s ease-out;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.karrot-search-box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--native-gray-100);
  border-radius: 8px;
  padding: 10px 12px;
}

.karrot-search-box .search-icon {
  flex-shrink: 0;
  color: var(--native-gray-500);
}

.karrot-search-input {
  flex: 1;
  border: none;
  background: none;
  font-size: 15px;
  color: var(--native-gray-900);
  outline: none;
}

.karrot-search-input::placeholder {
  color: var(--native-gray-500);
}

.karrot-search-close {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: none;
  border: none;
  color: var(--native-gray-600);
  cursor: pointer;
  transition: color 0.2s;
}

.karrot-search-close:hover {
  color: var(--native-gray-900);
}

/* 카테고리 슬라이드 */
.karrot-categories {
  background-color: #ffffff;
  border-bottom: 1px solid var(--native-gray-200);
  overflow: hidden;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
}

.karrot-categories-scroll {
  display: flex;
  gap: 16px;
  padding: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  max-width: 100%;
}

.karrot-categories-scroll::-webkit-scrollbar {
  display: none;
}

.karrot-category-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--native-gray-900);
  flex-shrink: 0;
}

.karrot-category-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background-color: var(--native-gray-100);
  border-radius: 50%;
  color: var(--native-gray-600);
}

.karrot-category-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--native-gray-700);
  white-space: nowrap;
}

/* 탭 메뉴 */
.karrot-tabs-container {
  background-color: #ffffff;
  border-bottom: 1px solid var(--native-gray-200);
  position: sticky;
  top: 65px;
  z-index: 99;
}

.karrot-tabs-scroll {
  display: flex;
  gap: 4px;
  padding: 8px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.karrot-tabs-scroll::-webkit-scrollbar {
  display: none;
}

.karrot-tab {
  flex-shrink: 0;
  padding: 8px 16px;
  font-size: 15px;
  font-weight: 500;
  color: var(--native-gray-600);
  background: none;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.karrot-tab.active {
  color: var(--native-gray-900);
  background-color: var(--native-gray-100);
  font-weight: 700;
}

.karrot-tab:hover {
  background-color: var(--native-gray-50);
}

/* 섹션 헤더 */
.karrot-section-header {
  padding: 20px 16px 12px;
  background-color: #ffffff;
}

.karrot-section-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--native-gray-900);
}

/* 그룹 리스트 */
.karrot-groups-list-container {
  background-color: #ffffff;
}

.karrot-group-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--native-gray-200);
  transition: background-color 0.2s;
}

.karrot-group-item {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.karrot-group-item:hover {
  background-color: var(--native-gray-50);
}

/* 터치 효과 제거 */
/* .karrot-group-item:active {
  background-color: var(--native-gray-100);
} */

.karrot-group-link {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

/* 썸네일 */
.karrot-group-thumbnail {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  background-color: var(--native-gray-200);
  position: relative;
  /* LCP 최적화: contain 속성 추가 */
  contain: layout style paint;
}

.karrot-thumbnail-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  /* 이미지 로딩 중 배경색 */
  background-color: var(--native-gray-200);
}

.karrot-group-thumbnail img.karrot-thumbnail-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  /* 이미지 렌더링 최적화 */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* 그룹 컨텐츠 */
.karrot-group-content {
  flex: 1;
  min-width: 0;
  padding-right: 32px;
}

.karrot-group-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
  color: var(--native-gray-900);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.karrot-group-description {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--native-gray-700);
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.karrot-group-meta {
  font-size: 12px;
  color: var(--native-gray-500);
  line-height: 1.4;
}

.karrot-meta-highlight {
  color: #ff6f0f;
  font-weight: 600;
}

/* 찜하기 버튼 */
.karrot-favorite-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  transition: transform 0.2s;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

.karrot-favorite-btn:hover {
  transform: scale(1.1);
}

/* 터치 효과 제거 */
/* .karrot-favorite-btn:active {
  transform: scale(0.95);
} */

/* 페이지네이션 */
.karrot-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px 16px;
  background-color: #ffffff;
}

.karrot-pagination a,
.karrot-pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--native-gray-700);
  background-color: #ffffff;
  border: 1px solid var(--native-gray-300);
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.2s;
}

.karrot-pagination a:hover {
  background-color: var(--native-gray-50);
  border-color: #ff6f0f;
}

.karrot-pagination .current {
  color: #ffffff;
  background-color: #ff6f0f;
  border-color: #ff6f0f;
}

/* 빈 상태 */
.karrot-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
  background-color: #ffffff;
}

.karrot-empty-state .empty-icon {
  margin-bottom: 16px;
  color: var(--native-gray-400);
}

.karrot-empty-state h3 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--native-gray-900);
}

.karrot-empty-state p {
  margin: 0 0 24px;
  font-size: 14px;
  color: var(--native-gray-600);
}

.karrot-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  background-color: #ff6f0f;
  border: none;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s;
}

.karrot-btn-primary:hover {
  background-color: #e85d00;
}

/* 플로팅 액션 버튼 (그룹 만들기) */
.karrot-fab {
  position: fixed;
  bottom: 90px;
  right: 16px;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background-color: #ff6f0f;
  border: none;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(255, 111, 15, 0.4);
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

.karrot-fab:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(255, 111, 15, 0.5);
}

/* 터치 효과 제거 */
/* .karrot-fab:active {
  transform: scale(0.95);
} */

.karrot-fab svg {
  width: 24px;
  height: 24px;
  color: #ffffff;
}

/* 검색 결과 없음 메시지 */
.karrot-search-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--native-gray-500);
}

/* 모바일 최적화 */
@media (max-width: 768px) {
  body {
    overflow-x: hidden;
  }

  .karrot-app-container {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .karrot-header {
    padding: 10px 12px;
    width: 100%;
    max-width: 100vw;
  }

  .karrot-header-right {
    gap: 4px;
  }

  .karrot-icon-btn {
    width: 36px;
    height: 36px;
  }

  .karrot-location {
    font-size: 18px;
  }

  .karrot-group-item {
    padding: 12px;
  }

  .karrot-group-thumbnail {
    width: 72px;
    height: 72px;
  }

  .karrot-group-title {
    font-size: 15px;
  }

  .karrot-group-description {
    font-size: 13px;
  }

  .karrot-fab {
    bottom: 80px;
    right: 12px;
    width: 52px;
    height: 52px;
  }
}

/* 데스크톱 반응형 (max-width 제한) */
@media (min-width: 1300px) {
  .karrot-fab {
    right: calc((100vw - 1300px) / 2 + 16px);
  }
}

/* 하단 여백 (플로팅 버튼 공간) */
.karrot-groups-directory {
  padding-bottom: 80px;
  max-width: 1300px;
  width: 100%;
  margin: 0 auto;
}

/* BuddyPress 컨테이너 오버라이드 */
body.groups #buddypress,
body.groups .buddypress,
body.directory.groups #buddypress {
  max-width: 1300px !important;
  width: 100% !important;
  margin: 0 auto !important;
  padding: 0 !important;
}

/* 그룹 디렉토리 페이지 전용 */
body.directory.groups,
body.groups-directory {
  background-color: #ffffff;
}

body.directory.groups #content,
body.directory.groups .container,
body.groups-directory #content,
body.groups-directory .container {
  max-width: 1300px !important;
  width: 100% !important;
  margin: 0 auto !important;
  padding: 0 !important;
}
