/* =========================================
   mainnav.css - 모바일 드로어
========================================= */

.mobile-nav {
  position: fixed;
  inset: 0;
  z-index: 9999;
  visibility: hidden;
  pointer-events: none;
}

.mobile-nav.is-open {
  visibility: visible;
  pointer-events: auto;
}

/* 오버레이 */
.mobile-nav__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.mobile-nav.is-open .mobile-nav__overlay {
  opacity: 1;
}

/* 패널 */
.mobile-nav__panel {
  position: absolute;
  top: 0;
  left: 0;

  width: min(320px, 84vw);
  height: 100%;
  background: #fff;

  transform: translateX(-100%);
  transition: transform 0.25s ease;

  overflow-y: auto;
  -webkit-overflow-scrolling: touch;

  padding: 1.6rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
}

.mobile-nav.is-open .mobile-nav__panel {
  transform: translateX(0);
}

/* ==============================
   ✅ 상단 헤더 공통(여백 줄여서 아래 라인 위로 올림)
============================== */
.mobile-nav__header {
  display: flex;
  flex-direction: column;

  gap: 0.4rem;              /* ✅ 기존보다 줄임 */
  padding-bottom: 0.9rem;    /* ✅ 기존보다 줄임 */
  border-bottom: 1px solid #eee;
}

/* ========= 로그인 상태 헤더 (로고 가운데 + X 오른쪽 / 아래줄 위로) ========= */
.mobile-nav__header-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;

  padding: 0.2rem 0;        /* ✅ 위아래 여백 축소 */
}

.mobile-nav__top-spacer { justify-self: start; }

.mobile-nav__brand {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

/* ✅ 로고 크기 조절 (원하면 4.5rem~6rem 사이 추천) */
.mobile-nav__logo {
  height: 6.6rem;
  width: auto;
  display: block;
}

.mobile-nav__close {
  justify-self: end;
  width: 3.6rem;
  height: 3.6rem;
  border-radius: 0.8rem;
  border: 1px solid #e5e7eb;
  background: #fff;
  font-size: 2.6rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.mobile-nav__close:hover { background: #f3f4f6; }

.mobile-nav__header-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  min-width: 0;

  padding-top: 0.1rem;      /* ✅ 살짝만 */
}

.mobile-nav__user-name {
  flex: 1;
  min-width: 0;
  max-width: 18rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  color: #333;
  font-size: 1.3rem;
  font-weight: 600;
  text-decoration: none;
}
.mobile-nav__user-name:hover {
  color: #2563eb;
  text-decoration: underline;
}

.mobile-nav__header-actions {
  display: flex;
  align-items: center;
  gap: 1.0rem;
  flex-wrap: nowrap;
}

.mobile-nav__cart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.cart-icon {
  width: 22px;
  height: 22px;
  vertical-align: middle;
}

/* 로그아웃/로그인 버튼 */
.mobile-nav__logout {
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  background-color: #f5f5f5;
  color: #333;
  border: 1px solid #ddd;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.mobile-nav__logout:hover {
  background-color: #e8e8e8;
  border-color: #bbb;
}

.mobile-nav__login {
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #f8f9fa;
  font-size: 1.3rem;
  color: #111;
  text-decoration: none;
  white-space: nowrap;
}
.mobile-nav__login:hover { background: #eef1f4; }

/* ========= 비로그인 상태 헤더 (로고 왼쪽 + 로그인 오른쪽 + X 맨오른쪽) ========= */
.mobile-nav__header-guest {
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 0.2rem 0 0.6rem; /* ✅ 아래 공간 과하지 않게 */
}

.mobile-nav__brand-guest {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

/* 비로그인 로고는 살짝만 작게(원하면 동일하게 둬도 됨) */
.mobile-nav__logo--guest {
  height: 6.6rem;
}

.mobile-nav__guest-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
}

/* ====== 메뉴 리스트 ====== */
.mobile-nav__list {
  margin-top: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;

  list-style: none;
  padding-left: 0;
}

.mobile-nav__item {
  border: 1px solid #eef0f3;
  border-radius: 1.2rem;
  overflow: hidden;
  background: #fff;
}

/* 강의목록 */
.mobile-course-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  width:100%;
  padding: 1.2rem 1.6rem;
  background:#fff;
}

.mobile-course-link{
  flex:1;
  font-weight:700;
  color:#111;
  text-decoration:none;
  white-space: nowrap;
}

.mobile-course-toggle{
  border:none;
  background:transparent;
  padding: 0.4rem;
  display:flex;
  align-items:center;
  justify-content:center;
}

.mobile-submenu-icon{
  width:18px;
  height:18px;
  object-fit:contain;
  opacity:.7;
}

/* 카테고리 */
.mobile-submenu {
  display: none;
  padding: 0 1.2rem 1.2rem;
}
.mobile-submenu.is-open { display:block; }

.mobile-submenu a {
  display:block;
  padding: 0.9rem 0;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
  text-decoration:none;
  color:#111;
}

/* 퀴즈/커뮤니티 */
.mobile-nav__link{
  display:block;
  width:100%;
  padding: 1.2rem 1.6rem;
  background:#fff;
  color:#111;
  font-weight:700;
  text-decoration:none;
  white-space: nowrap;
}

/* PC에서는 숨김 */
@media (min-width: 769px) {
  .mobile-nav { display: none; }
}
