/* =============================================
   체험학습포털 — 공통 컴포넌트
   navbar, footer, mobile-tab, mobile-menu
   Soft Nature 테마
   ============================================= */

/* — Navigation: Glassmorphism — */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03);
  transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar.shrink { --nav-h: 60px; }

.navbar-inner {
  min-height: var(--nav-h, 72px);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: center;
  transition: min-height 200ms ease-out;
}

/* 로고: 심볼 + 텍스트 */
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  color: var(--primary);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.04em;
  transition: opacity 200ms ease;
}

.logo:hover { opacity: 0.85; }

.logo-icon { color: var(--accent); }

.navbar.shrink .logo { font-size: 19px; }
.navbar.shrink .logo-icon { width: 22px; height: 22px; }

/* 메뉴: 언더라인 애니메이션 */
.menu {
  display: flex;
  justify-content: center;
  gap: 32px;
  font-size: 15px;
  font-weight: 600;
}

.menu a {
  position: relative;
  padding: 8px 4px;
  color: #495057;
  border-bottom: none;
  transition: color 200ms ease;
}

.menu a:hover,
.menu a.active {
  color: var(--primary);
}

.menu a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 3px;
  background: var(--accent);
  border-radius: 3px;
  transform: translateX(-50%);
  transition: width 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.menu a:hover::after,
.menu a.active::after {
  width: 100%;
}

/* 우측 영역 */
.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* 검색바: 알약형 + 돋보기 아이콘 내장 */
.nav-search {
  width: 240px;
  height: 44px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(0, 0, 0, 0.08);
  background-color: rgba(248, 249, 250, 0.8);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23868e96' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 16px center;
  padding: 0 20px 0 44px;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  transition: all 300ms ease;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.02);
}

.nav-search::placeholder { color: #adb5bd; }

.nav-search:hover {
  background-color: #fff;
  border-color: rgba(26, 26, 26, 0.18);
}

.nav-search:focus {
  outline: none;
  background-color: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(26, 26, 26, 0.12);
}

/* 로그인 버튼: 채워진 CTA */
.login-btn {
  height: 44px;
  padding: 0 24px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 200ms ease;
  box-shadow: 0 2px 8px rgba(26, 26, 26, 0.18);
}

.login-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26, 26, 26, 0.25);
}

/* — Mobile Nav Icons — */
.nav-mobile-icons {
  display: none;
}

.nav-icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 150ms ease;
}

.nav-icon-btn:hover {
  background: rgba(26, 26, 26, 0.06);
}

.nav-icon-btn svg {
  width: 20px;
  height: 20px;
}

/* 네비 반응형 */
@media (max-width: 900px) {
  .menu { gap: 20px; font-size: 14px; }
  .nav-search { width: 180px; }
}

@media (max-width: 768px) {
  .logo { font-size: 20px; }
  .logo-icon { width: 24px; height: 24px; }
  .navbar-inner { min-height: 64px; }
}

/* — Mobile Search Bar — */
.mobile-search-bar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--bg);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  gap: var(--space-2);
  align-items: center;
}

.mobile-search-bar.open {
  display: flex;
}

.mobile-search-bar input {
  flex: 1;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--card);
  padding: 0 var(--space-3);
  font-size: 16px;
  color: var(--fg);
}

.mobile-search-bar input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.mobile-search-close {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  padding: 0;
}

/* — Mobile Menu Overlay — */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg);
  flex-direction: column;
  overflow-y: auto;
}

.mobile-menu-overlay.open {
  display: flex;
}

.mobile-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  min-height: 56px;
}

.mobile-menu-header .logo {
  font-family: var(--font-heading);
  color: var(--primary);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.mobile-menu-close {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  padding: 0;
  border-radius: var(--radius-btn);
  transition: background 150ms ease;
}

.mobile-menu-close:hover {
  background: var(--primary-light);
}

.mobile-menu-links {
  display: flex;
  flex-direction: column;
  padding: var(--space-4);
}

.mobile-menu-links a {
  display: flex;
  align-items: center;
  padding: var(--space-3) var(--space-2);
  font-size: 16px;
  font-weight: 500;
  color: var(--fg);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-btn);
  transition: color 150ms ease, background 150ms ease;
}

.mobile-menu-links a:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.mobile-menu-links a:last-child {
  border-bottom: none;
}

.mobile-menu-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: -0.01em;
  padding: var(--space-4) var(--space-2) var(--space-1);
  margin-top: var(--space-2);
}

/* — Mobile Tab: 플로팅 스타일 — */
.mobile-tab {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 12px;
  z-index: 35;
  width: min(420px, calc(100% - 32px));
  height: 56px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 0 4px;
}

.mobile-tab a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  padding: 6px 0;
  border-radius: var(--radius-full);
  transition: color 150ms ease, background 150ms ease;
}

.mobile-tab a.active {
  color: var(--primary);
  background: var(--primary-light);
}

.mobile-tab-icon {
  width: 20px;
  height: 20px;
}

/* — Footer — */
footer {
  margin-top: var(--space-16);
  padding-top: var(--space-8);
  border-top: 1px solid var(--border);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-8);
  margin-bottom: var(--space-8);
}

.footer-group-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-3);
}

.footer-group-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-group-links a {
  font-size: 13px;
  color: var(--muted);
  transition: color 200ms ease-out;
  line-height: 20px;
}

.footer-group-links a:hover { color: var(--primary); }

.footer-trust {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: var(--space-4);
}

.footer-trust a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-size: 13px;
  color: var(--muted);
  margin-bottom: var(--space-2);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.footer-links a:hover { color: var(--primary); }

.footer-copy {
  font-size: 12px;
  color: var(--muted);
  padding-bottom: var(--space-8);
  margin-top: var(--space-1);
}

/* — Animations — */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* — Responsive: Desktop — */
@media (min-width: 960px) {
  .mobile-tab { display: none; }
}

/* — Responsive: Mobile Common — */
@media (max-width: 639px) {
  .menu, .nav-search { display: none; }
  .navbar-inner { grid-template-columns: 1fr auto; }
  .nav-mobile-icons { display: flex; gap: 4px; }
  .login-btn { display: none; }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-6) var(--space-4);
  }

  footer {
    margin-top: var(--space-12);
    padding-top: var(--space-6);
  }
}
