/**
 * ZABIS 공통 CSS (common.css)
 *
 * 모든 페이지의 통일된 스타일:
 *  - 헤더 · 사이드바 · 하단탭 공통 룩앤필 (강제 통일)
 *  - 로딩 스켈레톤
 *  - 모바일 사이드바 오버레이 토글
 */

/* ── [v1.1] 헤더 공통 스타일 (페이지별 CSS 충돌 방지용 #yt-header 스코프) ── */
#yt-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height, 56px);
  background: rgba(10,10,11,0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
}
#yt-header .hamburger {
  background: none;
  border: none;
  color: var(--text, #fff);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.15s;
}
#yt-header .hamburger:hover { background: rgba(255,255,255,0.08); }
#yt-header .header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}
#yt-header .header-search {
  flex: 1;
  display: flex;
  align-items: center;
  max-width: 600px;
  margin: 0 auto;
}
#yt-header .header-search input {
  flex: 1;
  height: 40px;
  padding: 0 16px;
  background: var(--surface, #1a1a1a);
  border: 1px solid var(--border, #2d2d2d);
  border-right: none;
  border-radius: 20px 0 0 20px;
  color: var(--text, #fff);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
#yt-header .header-search input:focus { border-color: #1b6ef3; }
#yt-header .header-search button {
  height: 40px;
  width: 64px;
  background: var(--surface-2, #212121);
  border: 1px solid var(--border, #2d2d2d);
  border-radius: 0 20px 20px 0;
  color: var(--text, #fff);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
#yt-header .header-search button:hover { background: var(--surface-3, #2d2d2d); }
#yt-header .header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── [v1.1] 사이드바 섹션 구분선 더 선명하게 ── */
#yt-sidebar .sidebar-section {
  border-bottom: 1px solid rgba(255,255,255,0.09) !important;
}
#yt-sidebar .sidebar-section:last-child {
  border-bottom: none !important;
}

/* ── 로딩 스켈레톤 ── */
@keyframes zabis-skeleton-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.3; }
}

/* 헤더 로드 전 */
#yt-header:empty {
  background: rgba(10,10,11,0.95);
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
#yt-header:empty::before {
  content: '';
  display: block;
  width: 120px;
  height: 36px;
  margin-left: 24px;
  background: rgba(255,255,255,0.06);
  border-radius: 6px;
  animation: zabis-skeleton-pulse 1.2s ease-in-out infinite;
}

/* 사이드바 로드 전 */
#yt-sidebar:empty {
  padding: 12px 8px;
}
#yt-sidebar:empty::before {
  content: '';
  display: block;
  height: 40px;
  margin: 4px 0;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  box-shadow:
    0 48px 0 0 rgba(255,255,255,0.04),
    0 96px 0 0 rgba(255,255,255,0.04),
    0 144px 0 0 rgba(255,255,255,0.04),
    0 192px 0 0 rgba(255,255,255,0.04),
    0 240px 0 0 rgba(255,255,255,0.04);
  animation: zabis-skeleton-pulse 1.2s ease-in-out infinite;
}

/* 하단탭 로드 전 */
#bottom-nav:empty {
  display: none;
}

/* ── 모바일 사이드바 오버레이 ── */
@media (max-width: 768px) {
  #yt-sidebar {
    position: fixed !important;
    top: var(--header-height, 56px) !important;
    left: -240px !important;
    width: 240px !important;
    height: calc(100vh - var(--header-height, 56px)) !important;
    background: var(--bg, #0a0a0b) !important;
    z-index: 100 !important;
    transition: left 0.25s ease !important;
    display: block !important;
    box-shadow: 2px 0 20px rgba(0,0,0,0.5);
  }
  #yt-sidebar.sidebar-open {
    left: 0 !important;
  }
  #yt-header .header-search { max-width: 280px; }
}

/* ── 하단탭 공통 기본 스타일 ── */
#bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 80;
  background: rgba(10,10,11,0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255,255,255,0.07);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px));
  justify-content: space-around;
}
#bottom-nav .bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  text-decoration: none;
  color: rgba(255,255,255,0.55);
  font-size: 11px;
  font-weight: 500;
  transition: color 0.15s;
  flex: 1;
  min-width: 0;
}
#bottom-nav .bottom-nav-item svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}
#bottom-nav .bottom-nav-item.active {
  color: #fff;
  font-weight: 700;
}
@media (max-width: 768px) {
  #bottom-nav { display: flex; }
}
