/* ============================================
   CATEGORY SYSTEM - SHARED STYLES
   ============================================ */

/* === CSS Variables === */
:root {
  --mcat-top: calc(var(--shared-topbar-h, 74px) + 2px);
  --mcat-h: 76px;
  --cat-primary: #111;
  --cat-bg: #fff;
  --cat-radius: 18px;
  --cat-shadow: 0 10px 30px rgba(0,0,0,.06);
  --sidebar-w: 260px;
  --sidebar-top: calc(var(--shared-topbar-h, 74px) + 20px);
}

/* ============================================
   LAYOUT
   ============================================ */

.prd-shell {
  max-width: var(--page-max, 1080px);
  margin: 0 auto;
  padding: var(--content-top-gap, 10px) 16px 110px;
}

.prd-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.prd-layout > main {
  flex: 1;
  min-width: 0;
  margin-left: calc(var(--sidebar-w) + 16px);
}

@media (max-width: 980px) {
  .prd-layout > main {
    margin-left: 0;
  }
}

/* ============================================
   SIDEBAR (DESKTOP)
   ============================================ */

.prd-side {
  position: fixed;
  top: var(--sidebar-top);
  left: max(10px, calc((100vw - var(--page-max, 1080px)) / 2 + 10px));
  width: var(--sidebar-w);
  max-height: calc(100vh - var(--sidebar-top) - 20px);
  z-index: 100;
  overflow: visible;
}

.prd-side-inner {
  max-height: calc(100vh - var(--sidebar-top) - 20px);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.2) transparent;
}

.prd-side-inner::-webkit-scrollbar {
  width: 6px;
}

.prd-side-inner::-webkit-scrollbar-track {
  background: transparent;
}

.prd-side-inner::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.2);
  border-radius: 20px;
}

@media (max-width: 980px) {
  .prd-side {
    display: none;
  }
}

/* Category box */
.cat-box {
  background: var(--cat-bg);
  border-radius: var(--cat-radius);
  box-shadow: var(--cat-shadow);
  padding: 12px;
}

.cat-box * {
  box-sizing: border-box;
}

.cat-title {
  font-weight: 900;
  letter-spacing: .06em;
  font-size: 12px;
  color: rgba(0,0,0,.55);
  margin: 10px 6px 6px;
}

.cat-search {
  padding: 6px;
  position: sticky;
  top: 0;
  background: var(--cat-bg);
  z-index: 2;
  border-radius: 12px 12px 0 0;
}

.cat-search input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.12);
  outline: none;
  box-sizing: border-box;
  font-size: 14px;
}

.cat-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
}

.cat-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  text-decoration: none;
  color: #111;
  background: rgba(0,0,0,.03);
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.cat-link:hover {
  background: rgba(0,0,0,.06);
}

.cat-link.active {
  background: rgba(0,0,0,.10);
  font-weight: 800;
}

.cat-name {
  font-weight: 600;
  font-size: 14px;
}

.cat-pill {
  font-size: 12px;
  opacity: .7;
}

/* ============================================
   MOBILE BAR
   ============================================ */

.mcat-fixed {
  display: none;
}

#mcatSpacer {
  display: none;
}

@media (max-width: 980px) {
  #mcatSpacer {
    display: block;
    height: var(--mcat-h);
  }

  .mcat-fixed {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    top: var(--mcat-top) !important;
    z-index: 120;
    padding: 10px 12px;
    pointer-events: none;
  }

  .mcat-fixed .mcat-inner {
    pointer-events: auto;
    position: relative;
    max-width: var(--page-max, 1080px);
    margin: 0 auto;
    border-radius: var(--cat-radius);
    background: rgba(255,255,255,0.86);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0,0,0,0.05);
    border-bottom-color: rgba(0,0,0,0.06);
    box-shadow: 0 10px 28px rgba(0,0,0,0.10);
    padding: 10px 46px;
    overflow: hidden;
  }

  .mcat-fixed .mcat-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-snap-type: x mandatory;
  }

  .mcat-fixed .mcat-scroll::-webkit-scrollbar {
    display: none;
  }

  .mcat-fixed .mcatbtn {
    flex: 0 0 auto;
    scroll-snap-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.10);
    background: #fff;
    color: #111827;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s ease;
  }

  .mcat-fixed .mcatbtn.active {
    background: var(--cat-primary);
    color: #fff;
    border-color: var(--cat-primary);
  }

  .mcat-fixed .mcat-ok {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: none;
    background: rgba(255,255,255,0.96);
    box-shadow: 0 8px 22px rgba(0,0,0,0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    transition: opacity 0.2s ease;
  }

  .mcat-fixed .mcat-ok:disabled {
    opacity: 0.35;
    cursor: not-allowed;
  }

  .mcat-fixed .mcat-ok svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-width: 3;
    color: #111;
  }

  .mcat-fixed .mcat-ok.left {
    left: 6px;
  }

  .mcat-fixed .mcat-ok.right {
    right: 6px;
  }

  .mcat-fixed .fade-l,
  .mcat-fixed .fade-r {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 42px;
    pointer-events: none;
    z-index: 4;
    transition: opacity 0.2s ease;
  }

  .mcat-fixed .fade-l {
    left: 44px;
    background: linear-gradient(to right, rgba(255,255,255,0.86), rgba(255,255,255,0));
  }

  .mcat-fixed .fade-r {
    right: 44px;
    background: linear-gradient(to left, rgba(255,255,255,0.86), rgba(255,255,255,0));
  }
}

/* ============================================
   TOAST
   ============================================ */

#catToast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 78px;
  z-index: 9999;
  background: rgba(17,17,17,.94);
  color: #fff;
  padding: 10px 12px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

#catToast.show {
  opacity: 1;
}