/* ==========================================
   텔레브리핑 브랜드 컬러 (다크모드 무시, 항상 밝은 테마)
   ========================================== */
:root {
  --brand-navy:     #1B3A6B;   /* 로고 진한 네이비 */
  --brand-blue:     #4A9FD5;   /* 로고 하늘색 */
  --brand-light:    #EBF4FB;   /* 연한 하늘 배경 */
  --brand-yellow:   #FFD600;   /* 전화번호부 배지 노랑 */

  --bg:             #F0F7FC;   /* 전체 배경 */
  --surface:        #FFFFFF;   /* 카드 배경 */
  --header-bg:      #FFFFFF;
  --text-primary:   #1B3A6B;   /* 메인 텍스트 - 네이비 */
  --text-secondary: #5A7A9A;   /* 보조 텍스트 */
  --text-hint:      #8BAABF;   /* 힌트 텍스트 */
  --border:         rgba(74, 159, 213, 0.15);
}

/* ==========================================
   기본 레이아웃
   ========================================== */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  /* 텔레그램 테마 변수 강제 무시 */
  background-color: var(--bg) !important;
  color: var(--text-primary) !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', sans-serif;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  font-size: 15px;
}

/* ==========================================
   헤더
   ========================================== */
.app-header {
  background-color: var(--header-bg) !important;
  border-bottom: 2px solid var(--brand-light);
  box-shadow: 0 2px 12px rgba(27, 58, 107, 0.08);
}

/* 로고 */
.header-logo {
  width: 54px;
  height: 54px;
  object-fit: contain;
  border-radius: 12px;
  flex-shrink: 0;
}

/* 헤더 타이틀 */
.header-title {
  color: var(--brand-navy) !important;
  font-size: 26px !important;
  font-weight: 800 !important;
  letter-spacing: -0.3px;
}

.header-sub {
  color: var(--brand-blue) !important;
  font-size: 14px !important;
  font-weight: 500;
}

/* ==========================================
   푸터
   ========================================== */
.app-footer {
  border-top: 1px solid var(--border);
  padding-bottom: 24px;
}

.footer-version {
  color: var(--text-hint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.footer-dev {
  color: var(--text-hint);
  font-size: 11px;
  margin-top: 2px;
  opacity: 0.7;
}

/* ==========================================
   안내 문구 배너
   ========================================== */
.info-banner {
  background-color: var(--brand-light);
  border: 1px solid rgba(74, 159, 213, 0.2);
}

.info-text {
  color: var(--brand-navy);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  margin: 0;
}

.info-text strong {
  color: var(--brand-blue);
  font-weight: 700;
}

.info-warn {
  color: #E8780C;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  margin: 2px 0 0;
}

/* ==========================================
   검색창
   ========================================== */
.search-input {
  background-color: var(--brand-light) !important;
  color: var(--brand-navy) !important;
  border: 1.5px solid transparent;
  font-size: 14px !important;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input::placeholder {
  color: var(--text-hint) !important;
}

.search-input:focus {
  border-color: var(--brand-blue) !important;
  box-shadow: 0 0 0 3px rgba(74, 159, 213, 0.15) !important;
  outline: none;
}

/* ==========================================
   카테고리 드롭다운
   ========================================== */
.category-select-wrap {
  position: relative;
}

.category-select {
  background-color: var(--brand-navy) !important;
  color: #ffffff !important;
  border: none;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: 0 3px 10px rgba(27, 58, 107, 0.25);
  transition: box-shadow 0.2s;
}

.category-select:focus {
  box-shadow: 0 0 0 3px rgba(74, 159, 213, 0.3), 0 3px 10px rgba(27, 58, 107, 0.2);
}

.category-select option {
  background-color: #1B3A6B;
  color: #ffffff;
}

.category-select-wrap span {
  color: rgba(255,255,255,0.8);
  font-size: 11px;
}

/* ==========================================
   결과 카운트
   ========================================== */
#resultCount {
  color: var(--text-hint) !important;
  font-size: 13px !important;
  font-weight: 500;
}

/* ==========================================
   연락처 카드
   ========================================== */
.contact-card {
  background-color: var(--surface) !important;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(27, 58, 107, 0.06);
  transition: transform 0.1s, box-shadow 0.1s;
}

.contact-card:active {
  transform: scale(0.98);
  box-shadow: 0 1px 4px rgba(27, 58, 107, 0.08);
}

/* 기관명 */
.contact-card .font-semibold {
  color: var(--brand-navy) !important;
  font-size: 15px !important;
  font-weight: 700 !important;
}

/* 설명 */
.contact-card [style*="hint-color"] {
  color: var(--text-secondary) !important;
  font-size: 13px !important;
}

/* 전화번호 (터치하여 복사) */
.phone-number-link {
  color: var(--brand-blue) !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 0;
  -webkit-user-select: none;
  user-select: none;
}

.phone-number-link:active {
  opacity: 0.5;
}

.copy-hint {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-hint);
  opacity: 0.8;
}

/* ==========================================
   바텀시트
   ========================================== */
.bs-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.bs-overlay.active {
  display: block;
  opacity: 1;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  border-radius: 20px 20px 0 0;
  padding: 12px 16px 32px;
  z-index: 1001;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -4px 30px rgba(27, 58, 107, 0.15);
}
.bottom-sheet.active {
  transform: translateY(0);
}

.bs-handle {
  width: 36px;
  height: 4px;
  background: #e0e0e0;
  border-radius: 2px;
  margin: 0 auto 16px;
}

.bs-info {
  text-align: center;
  padding: 0 8px 16px;
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 12px;
}

.bs-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--brand-navy);
  margin: 0 0 4px;
}

.bs-phone {
  font-size: 22px;
  font-weight: 700;
  color: var(--brand-blue);
  letter-spacing: 0.5px;
  margin: 0;
}

.bs-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.bs-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 8px;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.15s;
}
.bs-btn:active {
  opacity: 0.7;
  transform: scale(0.97);
}

.bs-icon {
  font-size: 26px;
  line-height: 1;
}

.bs-sub {
  display: block;
  font-size: 10px;
  font-weight: 500;
  opacity: 0.7;
  margin-top: 2px;
}

.bs-call {
  background: rgba(52, 199, 89, 0.12);
  color: #1a7a35;
}

.bs-copy {
  background: rgba(27, 58, 107, 0.08);
  color: var(--brand-navy);
}

.bs-cancel {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: none;
  background: #f4f4f5;
  color: #666;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.bs-cancel:active {
  opacity: 0.7;
}

/* 복사 토스트 알림 */
.copy-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background-color: var(--brand-navy);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(27, 58, 107, 0.4);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 9999;
  pointer-events: none;
}

.copy-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 카테고리 배지 */
.cat-badge {
  background-color: var(--brand-light) !important;
  color: var(--brand-blue) !important;
  font-size: 11px !important;
  font-weight: 600;
  border: 1px solid rgba(74, 159, 213, 0.3);
}

/* ==========================================
   액션 버튼
   ========================================== */
.action-btn {
  text-decoration: none;
  transition: transform 0.1s, opacity 0.1s;
  font-size: 18px !important;
}

.action-btn:active {
  transform: scale(0.85);
}

.call-btn {
  background-color: rgba(52, 199, 89, 0.12) !important;
  border: 1px solid rgba(52, 199, 89, 0.25);
}

.call-btn:hover {
  background-color: rgba(52, 199, 89, 0.22) !important;
}

.map-btn {
  background-color: rgba(74, 159, 213, 0.12) !important;
  border: 1px solid rgba(74, 159, 213, 0.25);
}

.map-btn:hover {
  background-color: rgba(74, 159, 213, 0.22) !important;
}

/* ==========================================
   로딩 스피너
   ========================================== */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--brand-light);
  border-top-color: var(--brand-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================
   빈 상태 / 오류
   ========================================== */
#emptyState p:first-child,
#errorState p:first-child {
  font-size: 40px;
}

#emptyState p,
#errorState p {
  color: var(--text-primary) !important;
}

#emptyState p:last-child,
#errorState p:last-child {
  color: var(--text-hint) !important;
  font-size: 14px !important;
}

/* 다시 시도 버튼 */
.retry-btn {
  background-color: var(--brand-navy) !important;
  color: #ffffff !important;
  border: none;
  cursor: pointer;
  font-size: 14px !important;
  transition: opacity 0.2s;
}

.retry-btn:active {
  opacity: 0.8;
}

/* ==========================================
   기타
   ========================================== */
html {
  scroll-behavior: smooth;
}

main {
  padding-top: 4px;
}
