/* ═══════════════════════════════════════
   Cat's Alley — Marketplace Styles
   Uses catsbe-common.css variables
   ═══════════════════════════════════════ */

/* ═══ LAYOUT ═══ */
.alley-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 12px;
}

/* ═══ HERO SECTION ═══ */
.alley-hero {
  position: relative;
  width: 100%;
  max-height: 320px;
  overflow: hidden;
  background: linear-gradient(135deg, #fce4ec 0%, #fff3e0 50%, #e8f5e9 100%);
}
.alley-hero-img {
  width: 100%;
  height: 100%;
  max-height: 320px;
  object-fit: cover;
  display: block;
}
.alley-hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 16px 20px 32px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.15) 60%, transparent 100%);
  text-align: center;
}
.alley-hero-title {
  font-family: var(--cb-font-serif);
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  margin: 0;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.alley-hero-sub {
  font-family: var(--cb-font-mono);
  font-size: 11px;
  color: rgba(255,255,255,0.9);
  letter-spacing: 2px;
  margin-top: 4px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

@media (max-width: 767px) {
  .alley-hero { max-height: 200px; }
  .alley-hero-img { max-height: 200px; }
  .alley-hero-title { font-size: 24px; }
  .alley-hero-overlay { padding: 12px 16px 24px; }
}

/* ═══ HEADER (legacy, hidden when hero present) ═══ */
.alley-header {
  padding: 20px 0 8px;
  text-align: center;
}
.alley-header-title {
  font-family: var(--cb-font-serif);
  font-size: 28px;
  font-weight: 700;
  color: var(--cb-text);
  line-height: 1.2;
  margin: 0;
}
.alley-header-sub {
  font-family: var(--cb-font-mono);
  font-size: 10px;
  color: var(--cb-accent);
  letter-spacing: 1.5px;
  margin-top: 4px;
}

/* ═══ FILTERS ═══ */
.alley-filters {
  position: sticky;
  top: 56px;
  z-index: 100;
  background: var(--cb-bg);
  padding: 0 4px;
  border-bottom: 1px solid var(--cb-border);
}
.alley-guide {
  text-align: center;
  font-family: var(--cb-font-sans);
  font-size: 12.5px;
  color: #7A3B0F;
  margin: 6px 0 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg,#FFF9EC 0%,#FFF5EC 100%);
  border: 1px solid #F4E1BB;
  border-radius: 12px;
  letter-spacing: 0;
  line-height: 1.65;
}
.alley-guide b { font-weight: 700; color: #5A4A1F }
.alley-guide small { color: #B0926B !important }

/* 옥션 ai-main 톤 통일 — 기본 가이드(4D 미선택) 전용 */
.alley-guide .ag-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 15px;
  font-weight: 700;
  color: #5A4A1F;
  margin-bottom: 4px;
  letter-spacing: 0.3px;
}
.alley-guide .ag-body {
  font-size: 12px;
  color: #7A5E42;
  line-height: 1.7;
}
.alley-guide .ag-sig {
  margin-top: 6px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 11.5px;
  font-style: italic;
  color: #B0926B;
  letter-spacing: 0.4px;
}
.alley-guide-br { display: none; }
@media (max-width: 768px) {
  .alley-guide-br { display: inline; }
}
.alley-tab-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 8px 0;
  align-items: center;
}
.alley-tab-row::-webkit-scrollbar { display: none; }
.alley-tab-row + .alley-tab-row {
  border-top: 1px solid var(--cb-border-light);
}

.alley-tab {
  flex-shrink: 0;
  font-family: var(--cb-font-mono);
  font-size: 11px;
  letter-spacing: 0.6px;
  padding: 5px 13px;
  border-radius: var(--cb-radius-pill);
  text-decoration: none !important;
  white-space: nowrap;
  background: var(--cb-surface);
  border: 1px solid var(--cb-border);
  color: var(--cb-text-sub);
  transition: all .15s;
  cursor: pointer;
}
.alley-tab:hover {
  background: var(--cb-surface-alt);
  border-color: var(--cb-border);
  color: var(--cb-text);
}
.alley-tab.active {
  background: var(--cb-text-muted);
  border-color: var(--cb-text-muted);
  color: #fff;
}
.alley-tab--label {
  font-weight: 600;
  background: var(--cb-surface-alt);
  border: 1px solid var(--cb-border);
  color: var(--cb-text);
}
.alley-tab--label.active {
  background: var(--cb-text-muted);
  border-color: var(--cb-text-muted);
  color: #fff;
}

/* ═══ TOOLBAR ═══ */
.alley-toolbar {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--cb-border-light);
  flex-wrap: wrap;
}
.alley-tb {
  flex-shrink: 0;
  font-family: var(--cb-font-mono);
  font-size: 11px;
  padding: 6px 14px;
  border-radius: var(--cb-radius-sm);
  background: var(--cb-surface);
  border: 1px solid var(--cb-border);
  color: var(--cb-text-sub);
  text-decoration: none !important;
  white-space: nowrap;
  transition: all .15s;
  cursor: pointer;
}
.alley-tb:hover {
  background: var(--cb-surface-alt);
  border-color: var(--cb-accent);
  color: var(--cb-text);
}
.alley-tb--primary {
  margin-left: auto;
  background: var(--cb-accent);
  border-color: var(--cb-accent);
  color: #fff;
  font-weight: 600;
}
.alley-tb--primary:hover {
  background: var(--cb-gold-dark);
  border-color: var(--cb-gold-dark);
  color: #fff;
}

/* ═══ PRODUCT GRID ═══ */
.alley-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 8px 0;
}

/* ═══ PRODUCT CARD (당근마켓 스타일) ═══ */
.al-card {
  display: flex;
  align-items: stretch;
  text-decoration: none !important;
  color: inherit;
  background: var(--cb-surface);
  border-bottom: 1px solid var(--cb-border);
  padding: 14px 0;
  transition: background .15s;
}
.al-card:hover {
  color: inherit;
  background: #FAFAF8;
}

.al-card-thumb {
  position: relative;
  width: 110px;
  height: 110px;
  flex-shrink: 0;
  background: var(--cb-surface-alt);
  overflow: hidden;
  border-radius: 10px;
}
.al-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.al-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--cb-text-faint);
  background: var(--cb-surface-alt);
}

/* Badges */
.al-badge {
  position: absolute;
  top: 5px;
  left: 5px;
  font-family: var(--cb-font-mono);
  font-size: 8px;
  letter-spacing: 0.5px;
  padding: 2px 5px;
  border-radius: 3px;
  color: #fff;
  line-height: 1.3;
}
.al-badge--active {
  background: var(--cb-success);
}
.al-badge--sold {
  background: var(--cb-text-muted);
}
.al-badge--q {
  position: absolute;
  top: 5px;
  right: 5px;
  background: var(--cb-success);
  color: #fff;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
}

/* Card body (가로 레이아웃) */
.al-card-body {
  flex: 1;
  padding: 4px 12px 4px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}
.al-card-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--cb-text);
  line-height: 1.4;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: keep-all;
}
.al-card-cat {
  font-family: var(--cb-font-mono);
  font-size: 10px;
  color: var(--cb-success);
  margin-bottom: 4px;
}
.al-card-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--cb-accent);
  line-height: 1.2;
}
.al-card-stock {
  font-family: var(--cb-font-mono);
  font-size: 10px;
  color: var(--cb-text-muted);
  margin-top: 3px;
}
.al-card-shipping {
  font-family: var(--cb-font-mono);
  font-size: 10px;
  color: var(--cb-text-faint);
  margin-top: 2px;
}
.al-card-region {
  font-size: 11px;
  color: #3D7A42;
  margin-top: 4px;
  font-weight: 500;
}

/* ═══ DETAIL PAGE ═══ */
.ald-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 12px;
}
.ald-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding-top: 16px;
}

/* ── Gallery (swipe) ── */
.ald-gallery {
  position: relative;
  background: #0f0e0c;
  border-radius: var(--cb-radius);
  overflow: hidden;
}
.ald-gallery-inner {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.ald-gallery-inner::-webkit-scrollbar { display: none; }
.ald-gallery-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  aspect-ratio: 1 / 1;
  max-height: 480px;
}
.ald-gallery-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ald-gallery-empty {
  flex: 0 0 100%;
  aspect-ratio: 1 / 1;
  max-height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cb-text-faint);
  font-size: 36px;
  background: var(--cb-surface-alt);
}
.ald-gallery-dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}
.ald-gallery-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  transition: background .2s, width .2s;
}
.ald-gallery-dot.active {
  background: #fff;
  width: 18px;
  border-radius: 3px;
}
/* 갤러리 좌우 화살표 (데스크탑) */
.ad-gallery-arrow {
  display: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.7);
  color: #1A1714;
  font-size: 18px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  transition: background 0.2s;
}
.ad-gallery-arrow:hover { background: rgba(255,255,255,0.95); }
.ad-gallery-arrow--prev { left: 10px; }
.ad-gallery-arrow--next { right: 10px; }
@media (min-width: 768px) {
  .ad-gallery-arrow { display: flex; }
}

.ald-gallery-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  font-family: var(--cb-font-mono);
  font-size: 10px;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 4px;
  color: #fff;
}
.ald-gallery-badge--live { background: var(--cb-success); }
.ald-gallery-badge--sold { background: rgba(0,0,0,0.5); }

/* ── Info ── */
.ald-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ald-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--cb-text);
  margin: 0;
  line-height: 1.3;
}
.ald-cat {
  font-family: var(--cb-font-mono);
  font-size: 11px;
  color: var(--cb-success);
}
.ald-price {
  font-size: 28px;
  font-weight: 700;
  color: var(--cb-accent);
}
.ald-stock {
  font-size: 14px;
  color: var(--cb-text-sub);
}
.ald-stock strong {
  color: var(--cb-text);
}
.ald-shipping {
  font-size: 13px;
  color: var(--cb-text-muted);
  padding: 8px 12px;
  background: var(--cb-surface-alt);
  border-radius: var(--cb-radius-sm);
  border: 1px solid var(--cb-border-light);
}
/* 수량 선택 */
.ald-qty-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px 0;
}
.ald-qty-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--cb-text-muted);
  min-width: 32px;
}
.ald-qty-ctrl {
  display: flex;
  align-items: center;
  border: 1px solid var(--cb-border-light);
  border-radius: 8px;
  overflow: hidden;
}
.ald-qty-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: #f3f4f6;
  font-size: 18px;
  font-weight: 700;
  color: #374151;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .1s;
}
.ald-qty-btn:hover {
  background: #e5e7eb;
}
.ald-qty-input {
  width: 44px;
  height: 36px;
  text-align: center;
  border: none;
  border-left: 1px solid var(--cb-border-light);
  border-right: 1px solid var(--cb-border-light);
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  background: #fff;
  -moz-appearance: textfield;
}
.ald-qty-input::-webkit-inner-spin-button,
.ald-qty-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.ald-qty-total {
  font-size: 15px;
  font-weight: 700;
  color: var(--cb-accent);
  margin-left: auto;
}

.ald-buy-btn {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--cb-radius);
  background: var(--cb-accent);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: background .15s;
  text-decoration: none !important;
}
.ald-buy-btn:hover {
  background: var(--cb-gold-dark);
  color: #fff;
}
.ald-buy-btn:disabled,
.ald-buy-btn--sold {
  background: var(--cb-text-faint) !important;
  cursor: not-allowed;
  color: #fff;
}
.ald-seller {
  font-size: 12px;
  color: var(--cb-text-muted);
}
.ald-views {
  font-family: var(--cb-font-mono);
  font-size: 10px;
  color: var(--cb-text-faint);
}

/* Description */
.ald-desc {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--cb-border);
}
.ald-desc h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--cb-text);
  margin-bottom: 12px;
}
.ald-desc-body {
  font-size: 15px;
  line-height: 1.85;
  color: var(--cb-text-sub);
  word-break: keep-all;
  overflow-wrap: break-word;
}
.ald-desc-body p {
  margin: 0 0 0.8em;
}
.ald-desc-body p:last-child {
  margin-bottom: 0;
}
.ald-desc-body h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--cb-text);
  margin: 1.4em 0 0.5em;
  line-height: 1.4;
}
.ald-desc-body h2:first-child {
  margin-top: 0;
}
.ald-desc-body strong, .ald-desc-body b {
  font-weight: 600;
  color: var(--cb-text);
}
.ald-desc-body ul, .ald-desc-body ol {
  padding-left: 1.4em;
  margin: 0.6em 0;
}
.ald-desc-body li {
  margin-bottom: 0.3em;
}
.ald-desc-body img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1em auto;
}
.ald-desc-body hr {
  border: none;
  border-top: 1px solid var(--cb-border-light);
  margin: 1.2em 0;
}
.ald-desc-body a {
  color: var(--cb-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.ald-desc-body a:hover {
  color: var(--cb-gold-dark);
}
.ald-desc-body mark {
  background: #FFF3CD;
  padding: 1px 3px;
  border-radius: 2px;
}

/* ═══ ALLEY EDITOR (등록/수정 폼) ═══ */
.alley-editor-wrap {
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-radius, 10px);
  background: #fff;
  overflow: hidden;
}
.alley-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  background: var(--cb-surface-alt, #f8f5f0);
  border-bottom: 1px solid var(--cb-border);
}
.alley-editor-toolbar button {
  min-width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: var(--cb-text-sub);
  transition: background .15s;
}
.alley-editor-toolbar button:hover,
.alley-editor-toolbar button.active {
  background: var(--cb-border-light, #ede8e0);
}
.alley-editor-toolbar .tb-sep {
  width: 1px;
  height: 20px;
  background: var(--cb-border);
  margin: 0 4px;
}
.alley-editor-toolbar .tb-photo {
  font-size: 16px;
}
.alley-editor-wrap #tiptap-editor {
  min-height: 200px;
}
.alley-editor-wrap #tiptap-editor .ProseMirror {
  min-height: 180px;
  padding: 14px 12px;
  outline: none;
  white-space: pre-wrap;
  word-break: keep-all;
  overflow-wrap: break-word;
  font-size: 15px;
  line-height: 1.8;
  color: var(--cb-text-sub);
}
.alley-editor-wrap #tiptap-editor .ProseMirror p.is-editor-empty:first-child::before {
  content: "상품 상태, 구성품, 특이사항 등을 적어주세요.";
  color: #bbb;
  float: left;
  height: 0;
  pointer-events: none;
}
.alley-editor-wrap #tiptap-editor .ProseMirror img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 0.8em auto;
}
.alley-editor-wrap #tiptap-editor .ProseMirror h2 {
  font-size: 17px;
  font-weight: 700;
  margin: 1em 0 0.4em;
}
@media (max-width: 767px) {
  .alley-editor-wrap #tiptap-editor {
    min-height: 160px;
  }
  .alley-editor-wrap #tiptap-editor .ProseMirror {
    min-height: 140px;
    padding: 12px 10px;
    font-size: 14px;
  }
  .alley-editor-toolbar button {
    min-width: 30px;
    height: 30px;
    font-size: 13px;
  }
}

/* SearchPost card */
.ald-sp-card {
  margin-top: 16px;
  padding: 16px;
  background: var(--cb-surface-alt);
  border-radius: var(--cb-radius);
  border: 1px solid var(--cb-border);
}
.ald-sp-card h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--cb-success);
  margin-bottom: 8px;
}
.ald-sp-card p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--cb-text-sub);
  margin: 0;
}

/* ═══ FORM PAGES ═══ */
.alley-form-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 12px;
}
.alley-form-wrap h1 {
  font-family: var(--cb-font-serif);
  font-size: 24px;
  font-weight: 700;
  color: var(--cb-text);
  margin-bottom: 20px;
}

/* ═══ MY SALES ═══ */
.alley-sales-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

/* ═══ EMPTY STATE ═══ */
.alley-empty {
  padding: 48px 0;
  text-align: center;
  color: var(--cb-text-faint);
  font-size: 14px;
}

/* ═══ RESPONSIVE ═══ */

/* 모바일 (기본 — 가로 카드) */
@media (max-width: 480px) {
  .al-card-thumb { width: 100px; height: 100px; }
  .al-card-title { font-size: 14px; }
  .al-card-price { font-size: 15px; }
}

/* 데스크탑 — 넓은 화면에서 썸네일 약간 키움 */
@media (min-width: 768px) {
  .al-card { padding: 16px 0; }
  .al-card-thumb { width: 130px; height: 130px; border-radius: 12px; }
  .al-card-title { font-size: 16px; }
  .al-card-price { font-size: 17px; }
  .al-card-body { padding-left: 18px; }
}

/* Mobile tweaks */
@media (max-width: 767px) {
  .alley-header-title { font-size: 22px; }

  .ald-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .ald-gallery { border-radius: 0; margin: 0 -12px; }
  .ald-title { font-size: 18px; }
  .ald-price { font-size: 26px; }
  .ald-stock { font-size: 14px; }
  .ald-shipping { font-size: 13px; }
  .ald-seller { font-size: 13px; }
  .ald-views { font-size: 11px; }
  .ald-desc-body {
    font-size: 15px;
    line-height: 1.8;
  }
  .ald-desc-body h2 {
    font-size: 16px;
  }
  .ald-desc-body img {
    border-radius: 6px;
    margin: 0.8em auto;
  }
}

/* Small mobile */
@media (max-width: 400px) {
  .al-card-thumb { width: 90px; height: 90px; }
  .al-card-title { font-size: 13px; }
  .al-card-price { font-size: 14px; }
}

/* ═══ 4D PORTAL STRIP ═══ */
.alley-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 8px 0;
}
.alley-strip::-webkit-scrollbar { display: none; }
.alley-strip .al-card {
  flex-shrink: 0;
  width: 140px;
  flex-direction: column;
  border-bottom: none;
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-radius);
  padding: 0;
}
.alley-strip .al-card-thumb {
  width: 100%;
  height: 100px;
  border-radius: var(--cb-radius) var(--cb-radius) 0 0;
}
.alley-strip .al-card-body {
  padding: 6px 8px 8px;
}
.alley-strip .al-card-title { font-size: 12px; }
.alley-strip .al-card-price { font-size: 13px; }
