/* 퀵메뉴 — PC 는 오른쪽 세로 목록, 휴대폰은 하단 5칸 바와 더보기 시트 */

.aside {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-family: 'Noto Sans KR', system-ui, sans-serif;
}

.qm-nav {
  width: min-content;
  min-width: 84px;
  box-sizing: border-box;
  padding: 8px 0;
  /* 화면 오른쪽 끝에 붙으므로 왼쪽만 둥글게, 오른쪽 테두리는 없앤다 */
  border-radius: 22px 0 0 22px;
  background: #fff;
  border: 1px solid #e7e5ee;
  border-right: 0;
  box-shadow: 0 12px 32px rgba(40, 30, 70, 0.10);
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.qm-cell { position: relative; padding: 0 8px; }
.qm-more { display: contents; }

.qm-cell--reserve {
  order: 0;
  padding: 4px 8px 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid #eeedf2;
}
.qm-cell--event { order: 1; }
.qm-cell--chat { order: 2; }
.qm-cell--phone { order: 3; }
.qm-more > .qm-cell { order: 4; }
.qm-more > .qm-cell--chat { order: 2; }
.qm-fold { order: 9; }

.qm-reserve {
  width: 100%;
  min-height: 72px;
  border: none;
  border-radius: 16px;
  background: #6b5992;
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.qm-reserve:hover { background: #4d3f72; }

.qm-item {
  min-height: 64px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #3a3d45;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  text-align: center;
}
.qm-item:hover, .qm-cell:hover .qm-item { background: #f4f2f8; color: #3a3d45; }

.qm-icon {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qm-icon img { width: 40px; height: 40px; }
/* 이벤트 svg 만 PNG 세트의 투명 여백(12.5%)이 없어 같은 여백을 준다 */
.qm-icon .qm-img--event { padding: 5px; box-sizing: border-box; }
.qm-reserve-icon { font-size: 24px; }

.qm-reserve:focus-visible, .qm-item:focus-visible, .qm-fold:focus-visible,
.qm-open:focus-visible, .btn-top:focus-visible, .qm-more-btn:focus-visible {
  outline: 2px solid #6b5992;
  outline-offset: -2px;
}

/* 마우스를 올리면 왼쪽에 설명 — 글자는 data-tip 에 두어 본문 글자로 세지 않는다 */
.qm-cell[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  white-space: nowrap;
  padding: 8px 12px;
  border-radius: 8px;
  background: #16181d;
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
  opacity: 0;
  transform: translate(6px, -50%);
  transition: opacity .18s, transform .18s;
  pointer-events: none;
}
.qm-cell[data-tip]:hover::after, .qm-cell[data-tip]:focus-within::after {
  opacity: 1;
  transform: translate(0, -50%);
}

.qm-fold {
  min-height: 44px;
  margin: 6px 8px 0;
  border: none;
  border-top: 1px solid #eeedf2;
  border-radius: 0 0 12px 12px;
  background: transparent;
  font-family: inherit;
  font-size: 11px;
  color: #6b707a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.qm-fold [aria-hidden] { font-size: 10px; }

.qm-open {
  display: none;
  width: 64px;
  height: 64px;
  border-radius: 22px 0 0 22px;
  border: none;
  background: #6b5992;
  color: #fff;
  box-shadow: 0 12px 32px rgba(40, 30, 70, 0.18);
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
/* 접기는 PC 에만 있다 — 휴대폰에서는 접힘 기억이 있어도 하단 바를 그대로 보인다 */
@media (min-width: 769px) {
  .aside.is-folded .qm-nav { display: none; }
  .aside.is-folded .qm-open { display: flex; }
}
/* 누를 때만 움직인다. 메뉴는 위아래가 가운데로 접히고 작은 단추는 가운데에서 펴진다. 잘라 내는 틀은 그림자까지 넉넉히 */
.aside.qm-animating .qm-nav { clip-path: inset(-48px); transition: clip-path .28s ease, opacity .28s ease; }
.aside.qm-animating .qm-open { transition: transform .28s ease, opacity .28s ease; }
.aside .qm-nav.is-off { clip-path: inset(50% -48px 50% -48px); opacity: 0; }
.aside .qm-open.is-off { transform: scaleY(0); opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .aside.qm-animating .qm-nav,
  .aside.qm-animating .qm-open { transition: none; }
}

.btn-top {
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
}
.btn-top img { width: 43px; height: 43px; }

.qm-more-btn, .qm-sheet-close, .qm-scrim { display: none; }

/* PC 전화 — 번호와 걸기 단추 */
.qm-phone-pop {
  position: absolute;
  right: calc(100% + 16px);
  top: 50%;
  transform: translateY(-50%);
  width: 300px;
  box-sizing: border-box;
  padding: 24px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid #e7e5ee;
  box-shadow: 0 20px 48px rgba(40, 30, 70, 0.16);
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: #16181d;
}
.qm-phone-pop[hidden] { display: none; }
.qm-phone-pop__head { display: flex; align-items: flex-start; justify-content: space-between; }
.qm-phone-pop__title { font-size: 13px; color: #555a64; }
.qm-phone-pop__close {
  width: 44px;
  height: 44px;
  margin: -12px -12px 0 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  color: #16181d;
}
.qm-phone-pop__num { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
.qm-phone-pop__call {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 12px;
  background: #6b5992;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

@media (max-width: 768px) {
  .aside {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    display: block;
  }
  .qm-nav {
    width: 100%;
    padding: 6px 6px calc(8px + env(safe-area-inset-bottom));
    border: none;
    border-top: 1px solid #eceef1;
    border-radius: 0;
    box-shadow: none;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: end;
  }
  .qm-cell, .qm-cell--reserve { padding: 0; margin: 0; border: none; }
  .qm-cell--chat { order: 1; }
  .qm-cell--phone { order: 2; }
  .qm-cell--reserve { order: 3; display: flex; justify-content: center; }
  .qm-cell--event { order: 4; }
  .qm-more-btn { order: 5; }
  .qm-cell[data-tip]::after { display: none; }

  .qm-item, .qm-more-btn {
    min-height: 60px;
    padding: 0 2px;
    gap: 3px;
    font-size: 11px;
    border-radius: 12px;
    word-break: keep-all;
    overflow-wrap: anywhere;
    hyphens: auto;
  }
  .qm-item:hover, .qm-cell:hover .qm-item { background: transparent; }
  .qm-icon, .qm-icon img { height: 36px; }
  .qm-icon img { width: 36px; }

  .qm-reserve {
    width: auto;
    min-width: 64px;
    max-width: 100%;
    height: 64px;
    min-height: 0;
    margin-bottom: -2px;
    padding: 0 4px;
    border-radius: 22px;
    border: 4px solid #fff;
    box-sizing: border-box;
    box-shadow: 0 8px 20px rgba(77, 63, 114, 0.30);
    font-size: 10.5px;
    gap: 2px;
    transform: translateY(-6px);
  }
  .qm-reserve-icon { font-size: 22px; }
  .qm-more-btn svg { margin: 7px 0; }

  .qm-more-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #3a3d45;
    font-family: inherit;
    line-height: 1.3;
    cursor: pointer;
  }

  /* 더보기 시트 — 열리기 전에는 숨긴다 */
  .qm-more {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    padding: 26px 20px calc(28px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
    background: #fff;
    flex-direction: column;
    gap: 8px;
  }
  .qm-more::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 50%;
    width: 40px;
    height: 4px;
    margin-left: -20px;
    border-radius: 4px;
    background: #dcdae3;
  }
  .aside.is-more-open .qm-more { display: flex; }
  .aside.is-more-open { z-index: 1000; }
  .qm-more .qm-item {
    min-height: 56px;
    padding: 0 16px;
    border-radius: 14px;
    background: #f7f7f9;
    flex-direction: row;
    justify-content: space-between;
    font-size: 15px;
    color: #16181d;
  }
  .qm-more .qm-item::after { content: "\203A"; color: #8a8f99; }
  .qm-more .qm-icon { display: none; }
  .qm-sheet-close {
    order: 9;
    display: block;
    margin-top: 8px;
    min-height: 48px;
    border-radius: 12px;
    border: 1px solid #dcdae3;
    background: #fff;
    font-family: inherit;
    font-size: 14px;
    color: #3a3d45;
    cursor: pointer;
  }
  .aside.is-more-open .qm-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1;
    background: rgba(22, 24, 29, 0.45);
  }

  .qm-fold, .qm-open, .qm-phone-pop { display: none !important; }

  .btn-top {
    position: fixed;
    right: 16px;
    bottom: calc(var(--quickmenu-height, 76px) + 20px);
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 6px 16px rgba(40, 30, 70, 0.10);
  }
  /* 첫 화면의 단추 · 입력칸을 덮지 않게 한 화면 넘게 내렸을 때만 띄운다 */
  .aside:not(.is-scrolled) .btn-top { display: none; }
  /* 맨 아래까지 내려도 마지막 링크 · 단추가 바와 맨 위로 단추에 덮이지 않게 그만큼 비운다 */
  body .footer { margin-bottom: calc(var(--quickmenu-height, 80px) + 64px); }
  /* 장바구니 · 코스 담기 띠가 같은 자리에 뜨는 화면에서는 비킨다 */
  body:has(.treatment-cart-show, .woman-treatment-cart-show, .pick-bar:not([hidden])) .btn-top { display: none; }
}
