.app {
  width: 100%;
  max-width: 1200px;
  display: grid;
  grid-template-columns: minmax(220px, 0.3fr) minmax(500px, 1fr);
  gap: 12px;
  padding: 12px;
  margin: 16px auto 24px;
  height: 80vh;
  min-height: 0;
}
/* 공통 패널 */
.panel {
  background: linear-gradient(135deg, #0b0e12, #101317);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.03);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.7);
  position: relative;
  overflow: hidden;
}
/* 사이드바 */
.sidebar {
  padding: 14px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-title {
  background: linear-gradient(90deg, #16a45f, #1fb38a);
  color: #04130b;
  font-weight: 700;
  font-size: 15px;
  text-align: center;
  padding: 8px 10px;
  border-radius: 999px;
  letter-spacing: 0.05em;
}

/* 검색 박스 */
.search-box {
  background: #05070c;
  border-radius: var(--radius-lg);
  padding: 8px 9px 9px;
  border: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-box-top {
  display: flex;
  gap: 6px;
  align-items: center;
}

.search-input {
  flex: 1;
  border-radius: 10px;
  padding: 4px 8px;
  border: 1px solid #272c37;
  background: #090b12;
  color: var(--text-main);
  font-size: 12px;
  outline: none;
}

.search-input::placeholder {
  color: var(--text-muted);
}

/* 아직 안쓰는 버튼 */
.search-btn {
  border-radius: 999px;
  border: 0;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  background: #171d26;
  color: var(--text-sub);
  white-space: nowrap;
}

/* 지역 탭 */
.region-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.region-tab {
  flex: 1;
  font-size: 12px;
  text-align: center;
  padding: 4px 0;
  border-radius: 10px;
  border: 0;
  cursor: pointer;
  background: transparent;
  color: var(--text-sub);
}

.region-tab.active {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}

/* 사이드바 리스트 */
.sidebar-list {
  margin-top: 6px;
  padding: 6px 4px 0;
  border-radius: var(--radius-lg);
  border: 1px solid #181d26;
  background: #05070c;
  flex: 1;
  overflow-y: auto;
  font-size: 12px;
}

/* 초성 그룹 */
.sidebar-group {
  display: grid;
  grid-template-columns: 16px 1fr;
  column-gap: 6px;
  margin-bottom: 8px;
}

.sidebar-group-initial {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  padding-top: 2px;
}

.sidebar-group-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* 리스트 아이템 */
.sidebar-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  border-radius: 6px;
  color: var(--text-sub);
  cursor: default;
}

.sidebar-list-item:nth-child(even) {
  background: #080b12;
}

.sidebar-list-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 메인 영역 */
.main {
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh);
  min-height: 0;
}

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.main-title {
  font-size: 18px;
  font-weight: 600;
}

.main-header-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* 티어 탭 */
.tier-tabs {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
  margin-left: auto;
  justify-content: flex-end;
}

.tier-tab {
  border: 1px solid var(--border-soft);
  background: var(--bg-panel);
  color: var(--text-sub);
  padding: 7px 18px;
  font-size: 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.15s;
  font-weight: 500;
  white-space: nowrap;
}

.tier-tab:hover {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.tier-tab.active {
  background: #149f7f;
  border-color: var(--accent);
  color: white;
  font-weight: 600;
  box-shadow: 0 0 0 2px rgba(31, 179, 138, 0.25);
}

/* 테이블 */
.table-wrapper {
  margin-top: 4px;
  flex: 1;
  background: #05070c;
  border-radius: var(--radius-lg);
  border: 1px solid #181d26;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.table-scroll {
  flex: 1;
  height: 100%;
  overflow-x: auto;
  overflow-y: auto;
  min-height: 0;
}

/* 가로 최소 너비 */
.table-inner {
  min-width: 1400px;
}

/* 헤더 & 로우 공통 */
.table-header,
.table-row {
  display: grid;
  grid-template-columns:
    60px /* 랭킹 */
    1.4fr /* 대학 */
    0.7fr /* 평균점수 */
    0.7fr /* 평균GPA */
    0.9fr /* 평균 SAT */
    0.7fr /* 경쟁률 */
    0.7fr /* 졸업률 */
    0.8fr /* 학비 */
    0.8fr /* 기숙사비 */
    0.9fr /* 평균장학금 */
    1fr /* 졸업생 평균 연봉 */
    0.8fr /* 도심지 여부 */
    0.9fr /* 교수당 학생수 */
    0.9fr /* 국제학생 비율 */
    40px; /* 화살표 */

  align-items: center;
  padding: 6px 10px;
  font-size: 12px;
  column-gap: 8px;
}

/* 헤더 */
.table-header {
  background: #10141d;
  font-size: 12px;
  color: var(--text-sub);
  border-bottom: 1px solid #1d222e;
  position: sticky;
  top: 0;
  z-index: 1;
}

/* 데이터 로우 */
.table-row {
  border-bottom: 1px solid #10141c;
  color: #cfd3e1;
  font-size: 12px;
}

.table-row:nth-child(even) {
  background: #070a13;
}

.table-row:hover {
  background: rgba(31, 179, 138, 0.08);
}

/* 랭킹 뱃지 */
.rank-pill {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid #262c38;
  font-size: 11px;
  justify-content: center;
  min-width: 38px;
  text-align: center;
  color: var(--text-sub);
}

.rank-pill.top3 {
  border-color: rgba(31, 179, 138, 0.8);
  color: var(--accent);
}

/* 태그 뱃지 */
.tag-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid #303848;
  font-size: 10px;
  color: var(--text-sub);
  background: rgba(255, 255, 255, 0.02);
}

.tag-badge.good {
  border-color: rgba(31, 179, 138, 0.7);
  color: var(--accent);
}

/* 행 끝 화살표 */
.view-arrow {
  text-align: center;
  font-size: 16px;
  opacity: 0.5;
  cursor: pointer;
}

.view-arrow:hover {
  opacity: 1;
}

/* 대학명 옆 국가 */
.pill-country {
  font-size: 10px;
  opacity: 0.7;
  margin-left: 4px;
}

/* 빈 상태 */
.empty-state {
  padding: 18px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ===== 스크롤바 커스텀 ===== */
.sidebar-list,
.table-scroll {
  scrollbar-width: thin;
  scrollbar-color: #2a303c #05070c;
}

.sidebar-list::-webkit-scrollbar,
.table-scroll::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.sidebar-list::-webkit-scrollbar-track,
.table-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-list::-webkit-scrollbar-thumb,
.table-scroll::-webkit-scrollbar-thumb {
  background: #2a303c;
  border-radius: 999px;
  border: 2px solid #05070c;
}

.sidebar-list::-webkit-scrollbar-thumb:hover,
.table-scroll::-webkit-scrollbar-thumb:hover {
  background: #3a4252;
}
/* 패널(사이드바/메인 카드) */
[data-theme='light'] .panel {
  background: linear-gradient(135deg, #ffffff, #f5f7ff);
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}
/* 검색 박스 */
[data-theme='light'] .search-box {
  background: var(--bg-panel);
  border-color: var(--border-soft);
}

[data-theme='light'] .search-input {
  background: #f9fafb;
  border-color: #d1d5e5;
  color: var(--text-main);
}

[data-theme='light'] .search-input::placeholder {
  color: var(--text-muted);
}
/* 사이드바 리스트 */
[data-theme='light'] .sidebar-list {
  background: var(--bg-panel-soft);
  border-color: var(--border-soft);
}

[data-theme='light'] .sidebar-list-item:nth-child(even) {
  background: rgba(15, 23, 42, 0.02);
}
/* 메인 헤더 라인 */
[data-theme='light'] .main-header {
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}
/* 국가 선택 탭 */
[data-theme='light'] .tier-tab {
  background: white;
  border-color: rgba(0, 0, 0, 0.08);
  color: var(--text-sub);
}

[data-theme='light'] .tier-tab:hover {
  background: var(--accent-soft);
  color: var(--accent-text);
}

[data-theme='light'] .tier-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
/* 테이블 전체 박스 */
[data-theme='light'] .table-wrapper {
  background: var(--bg-panel);
  border-color: var(--border-soft);
}

/* 테이블 헤더 */
[data-theme='light'] .table-header {
  background: #eef2ff;
  color: var(--text-sub);
  border-bottom: 1px solid #d1d5e5;
}

/* 테이블 로우 */
[data-theme='light'] .table-row {
  border-bottom: 1px solid #e5e7f5;
  color: var(--text-main);
}

[data-theme='light'] .table-row:nth-child(even) {
  background: rgba(15, 23, 42, 0.015);
}

[data-theme='light'] .table-row:hover {
  background: var(--accent-soft);
}

/* 랭킹 뱃지 */
[data-theme='light'] .rank-pill {
  border-color: #d1d5e5;
  color: var(--text-sub);
}

[data-theme='light'] .rank-pill.top3 {
  border-color: rgba(13, 159, 106, 0.9);
  color: var(--accent);
}

/* 사이드/테이블 스크롤바 */
[data-theme='light'] .sidebar-list,
[data-theme='light'] .table-scroll {
  scrollbar-color: #cbd5f5 transparent;
}

[data-theme='light'] .sidebar-list::-webkit-scrollbar-thumb,
[data-theme='light'] .table-scroll::-webkit-scrollbar-thumb {
  background: #cbd5f5;
  border-radius: 999px;
  border: 2px solid #f9fafb;
}
/* 모바일 페이지 */
@media (max-width: 992px) {
  .app {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    padding: 8px 10px;
    margin: 12px auto 20px;
    height: auto; /* 80vh 강제 높이 제거 */
  }

  /* 검색 패널을 위로 */
  .sidebar {
    order: 0;
    padding: 0;
    margin-bottom: 10px;
    background: transparent;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }

  /* 초록색 해외대학검색 배지, 사이드 리스트, 국가분류 탭 숨기기 */
  .sidebar-title,
  .sidebar-list,
  .region-tabs {
    display: none;
  }

  /* 검색 박스만 남기기 */
  .search-box {
    background: rgba(5, 7, 12, 0.85);
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    padding: 6px 10px;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
  }

  .search-box-top {
    display: flex;
    align-items: center;
  }

  .search-input {
    font-size: 13px;
    padding: 6px 10px;
  }

  /* 메인표 영역 */
  .main {
    order: 1;
    padding: 10px 10px 14px;
  }

  .table-wrapper {
    max-width: 100%;
  }

  .table-header,
  .table-row {
    padding-inline: 6px;
    column-gap: 6px;
  }
}

@media (max-width: 576px) {
  .panel {
    border-radius: 14px;
  }
}
/* 검색박스 정렬 */
.search-box-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 기존 인풋이 남은 공간 꽉 채우게 */
.search-input {
  flex: 1;
}

/* PC 아이콘 숨김 */
.mobile-search-icon {
  display: none;
}

/* 모바일 검색아이콘 */
@media (max-width: 768px) {
  .search-box-top {
    padding: 0 4px;
  }

  .mobile-search-icon {
    display: flex;
    width: 44px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    background: var(--bg-panel-soft);
    align-items: center;
    justify-content: center;
  }

  .mobile-search-icon svg {
    stroke: var(--text-sub);
  }
}
