/* ==============================================================
   CampusShelf — Shared app shell (sidebar nav + polished topbar)
   Loaded on every logged-in app page (home, profile, cart,
   view-details). Desktop gets a persistent left sidebar like a
   real marketplace; mobile keeps the existing bottom nav.
   ============================================================== */

/* ---------- SIDEBAR (desktop only) ---------- */
.cs-sidebar { display: none; }

@media (min-width: 1025px) {
  .cs-sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 252px;
    background: #fff;
    border-right: 1px solid var(--line);
    padding: 22px 16px;
    z-index: 500;
  }

  .cs-side-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 17px;
    color: var(--ink);
    padding: 6px 10px 26px;
  }
  .cs-side-logo .logo-mark {
    width: 30px; height: 30px; border-radius: 9px;
    background: linear-gradient(135deg, var(--blue), var(--green));
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
  }

  .cs-side-cta {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    background: var(--ink); color: #fff !important;
    border-radius: 10px; padding: 12px 14px; font-weight: 700; font-size: 14px;
    margin-bottom: 18px; transition: background .15s ease;
  }
  .cs-side-cta:hover { background: var(--blue); }

  .cs-side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

  .cs-side-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 9px;
    font-size: 14px; font-weight: 600; color: var(--ink-soft);
    transition: background .15s ease, color .15s ease;
  }
  .cs-side-link svg { width: 19px; height: 19px; flex-shrink: 0; color: currentColor; }
  .cs-side-link:hover { background: var(--bg-soft); color: var(--ink); }
  .cs-side-link.active { background: rgba(37,99,235,0.08); color: var(--blue); }

  .cs-side-badge {
    margin-left: auto; background: var(--green); color: #fff;
    font-size: 10.5px; font-weight: 800; min-width: 18px; height: 18px;
    border-radius: 99px; align-items: center; justify-content: center;
    padding: 0 5px; flex-shrink: 0;
  }

  .cs-side-divider { height: 1px; background: var(--line); margin: 12px 4px; }

  .cs-side-profile {
    display: flex; align-items: center; gap: 10px;
    padding: 10px; border-radius: 10px; margin-top: 10px;
    border-top: 1px solid var(--line); padding-top: 16px;
  }
  .cs-side-profile:hover { background: var(--bg-soft); }
  .cs-side-avatar {
    width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, var(--blue), var(--green));
    color: #fff; font-weight: 800; font-family: var(--font-display);
    display: flex; align-items: center; justify-content: center; font-size: 14px;
    overflow: hidden;
  }
  .cs-side-avatar img { width: 100%; height: 100%; object-fit: cover; }
  .cs-side-avatar.is-guest { background: #E5E7EB; color: #8A8F98; }
  .cs-side-avatar.is-guest svg { width: 60%; height: 60%; }
  .cs-side-profile-name { font-size: 13.5px; font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cs-side-profile-sub { font-size: 11.5px; color: var(--ink-soft); }

  /* Push existing page chrome right of the sidebar */
  body.cs-has-sidebar .hm-topbar,
  body.cs-has-sidebar .app-topbar { margin-left: 252px; }
  body.cs-has-sidebar .hm-topbar { padding-left: 32px; padding-right: 32px; }
  body.cs-has-sidebar .hm-main,
  body.cs-has-sidebar .app-main { margin-left: 252px; max-width: none; padding-left: 32px; padding-right: 32px; }
  body.cs-has-sidebar .hm-main { padding-left: 32px; padding-right: 32px; }
  body.cs-has-sidebar #similarSection { margin-left: 252px; max-width: none !important; padding-left: 50px; padding-right: 32px; box-sizing: border-box; }
  body.cs-has-sidebar .hm-bottom-nav,
  body.cs-has-sidebar .fab-sell { display: none !important; }

  /* `.app-main` above drops max-width entirely so wide grid pages (Home)
     can use the extra desktop space — but a product detail page doing the
     same thing pins every element to the far-right edge of the screen
     instead of reading as a normal, bounded page. Give it its own
     dedicated shell with a sane constrained width. */
  body.cs-has-sidebar .vd-shell { max-width: 1120px; margin-left: 252px; }
}

@media (min-width: 1025px) and (max-width: 1280px) {
  .cs-sidebar { width: 220px; }
  body.cs-has-sidebar .hm-main,
  body.cs-has-sidebar .app-main,
  body.cs-has-sidebar .hm-topbar,
  body.cs-has-sidebar .app-topbar,
  body.cs-has-sidebar #similarSection { margin-left: 220px; }
  body.cs-has-sidebar .vd-shell { margin-left: 220px; }
}

/* Sell page uses its own centered wizard shell — just make room on the left
   instead of the generic .app-main push above. */
@media (min-width: 1025px) {
  body.cs-has-sidebar.sell-body .ob-logo-fixed { left: 280px; }
  body.cs-has-sidebar.sell-body .ob-progress { padding-left: 252px; }
  body.cs-has-sidebar.sell-body { padding-left: 252px; }
}

/* ---------- TOPBAR icon buttons (replace emoji with clean svg) ---------- */
.hm-icon-btn svg { width: 19px; height: 19px; color: var(--ink); }

/* ---------- HORIZONTAL SCROLL ROWS: visible affordance + arrows ---------- */
.hm-scroll-row { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.hm-scroll-row::-webkit-scrollbar { height: 6px; }
.hm-scroll-row::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }
.hm-scroll-row::-webkit-scrollbar-thumb:hover { background: #C7CBD3; }

.cs-row-wrap { position: relative; }
.cs-row-arrow {
  display: none;
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border-radius: 50%;
  background: #fff; border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  align-items: center; justify-content: center;
  z-index: 5; color: var(--ink); transition: transform .15s ease, box-shadow .15s ease;
}
.cs-row-arrow:hover { box-shadow: var(--shadow-lg); }
.cs-row-arrow.left { left: 4px; }
.cs-row-arrow.right { right: 4px; }
.cs-row-arrow svg { width: 16px; height: 16px; }

@media (min-width: 1025px) {
  .cs-row-wrap:hover .cs-row-arrow { display: flex; }
}

/* ---------- Professional visual polish (less "app-cute", more marketplace) ---------- */
:root {
  --radius: 16px;
  --radius-sm: 12px;
}
.hm-card, .book-card { border-radius: 14px; }
.hm-card-cover { height: 132px; }
.hm-cond-badge, .condition-badge {
  font-weight: 700; letter-spacing: .01em;
}
.hm-section-head h2 { font-size: 16.5px; font-weight: 700; letter-spacing: -0.005em; }
.hm-greeting-hi { font-weight: 700; }
