/* marketplace.css */

.mkt-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  max-width: 1200px;
  margin: 0 auto;
  padding: 80px 24px 60px;
  min-height: 100vh;
  align-items: start;
}

/* ---- sidebar ---- */
.mkt-sidebar {
  padding: 24px 0;
  padding-right: 28px;
  position: sticky;
  top: 80px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.mkt-sidebar-section { display: flex; flex-direction: column; gap: 10px; }

.mkt-sidebar-label {
  font-size: 10px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text3);
  margin-bottom: 2px;
}

.mkt-tag-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mkt-tag-btn,
.mkt-status-btn {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 13px;
  font-family: var(--sans);
  color: var(--text3);
  cursor: pointer;
  transition: all 0.15s;
}
.mkt-tag-btn:hover,
.mkt-status-btn:hover { background: var(--bg3); color: var(--text2); }
.mkt-tag-btn.active,
.mkt-status-btn.active { background: var(--accent-dim); color: var(--text); font-weight: 500; }

.mkt-submit-box {
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.mkt-submit-desc {
  font-size: 12px;
  color: var(--text3);
  line-height: 1.6;
}

/* ---- main ---- */
.mkt-main {
  padding: 24px 0 24px 28px;
  border-left: 1px solid var(--border);
  min-width: 0;
}

/* header + search */
.mkt-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.mkt-header-text h1 {
  font-size: 28px;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.mkt-header-text p {
  font-size: 13px;
  color: var(--text3);
  font-family: var(--mono);
}

.mkt-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.mkt-search-icon {
  position: absolute;
  left: 11px;
  color: var(--text3);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.mkt-search {
  width: 260px;
  padding: 8px 34px 8px 34px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 13px;
  font-family: var(--sans);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}
.mkt-search:focus { border-color: var(--accent2); background: var(--bg3); }
.mkt-search::placeholder { color: var(--text3); }

.mkt-search-clear {
  position: absolute;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: var(--bg4);
  color: var(--text3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.mkt-search-clear:hover { background: var(--border2); color: var(--text); }

/* ---- grid ---- */
.mkt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.mkt-loading {
  color: var(--text3);
  font-size: 13px;
  font-family: var(--mono);
  padding: 40px 0;
}

.mkt-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mkt-card:hover {
  border-color: var(--border2);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--shadow);
}

.mkt-card-top {
  display: flex;
  align-items: center;
  gap: 11px;
}

.mkt-card-meta { flex: 1; min-width: 0; }

.mkt-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mkt-card-author {
  font-size: 11px;
  color: var(--text3);
  margin-top: 1px;
}

.mkt-card-desc {
  font-size: 13px;
  color: var(--text3);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.mkt-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.mkt-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.mkt-card-ver {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text3);
  white-space: nowrap;
  margin-left: 8px;
  flex-shrink: 0;
}

/* empty state */
.mkt-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--text3);
  text-align: center;
}
.mkt-empty svg { opacity: 0.3; }
.mkt-empty p { font-size: 14px; }
.mkt-reset-btn { margin-top: 4px; }

/* ---- addon icon (shared between card and popup) ---- */
/* FIX: constrain both img and svg children so nothing overflows the box */
.addon-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.addon-icon img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}
.addon-icon svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

/* ---- addon popup (reused from sections) ---- */
.addon-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.22s;
}
.addon-overlay.active { opacity: 1; pointer-events: auto; }
.addon-popup {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  transform: scale(0.96) translateY(10px);
  transition: transform 0.26s cubic-bezier(0.23,1,0.32,1);
  overflow: hidden;
}
.addon-overlay.active .addon-popup { transform: none; }

.addon-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 12px;
}
.addon-popup-id { display: flex; align-items: center; gap: 12px; }
.addon-popup-name { font-size: 16px; font-weight: 600; color: var(--text); }
.addon-popup-author { font-size: 12px; color: var(--text3); margin-top: 2px; }

.addon-popup-close {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text3);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.addon-popup-close:hover { background: var(--text); color: var(--bg); border-color: var(--text); }

.addon-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  flex-shrink: 0;
}
.addon-tab {
  padding: 10px 0;
  margin-right: 20px;
  font-size: 13px;
  font-family: var(--sans);
  color: var(--text3);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.18s;
}
.addon-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.addon-tab:hover { color: var(--text2); }

.addon-popup-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
}
.addon-panel { display: none; }
.addon-panel.active { display: block; }

.addon-slideshow {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg3);
  height: 200px;
  margin-bottom: 16px;
  position: relative;
}
.feat-slide-img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.feat-slide-empty {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  color: var(--border2);
}
.feat-slide-close {
  position: absolute; top: 10px; right: 10px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  border: none; color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.2s;
}
.feat-slide-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.2s; z-index: 3;
}
.feat-slide-arrow:hover { background: rgba(0,0,0,0.8); }
.feat-slide-arrow.prev { left: 10px; }
.feat-slide-arrow.next { right: 10px; }
.feat-slide-dots {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 5px; z-index: 3;
}
.feat-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  cursor: pointer; transition: background 0.2s;
}
.feat-dot.active { background: #fff; }
.feat-counter {
  position: absolute; top: 8px; left: 10px;
  font-size: 11px; font-family: var(--mono);
  color: #fff; background: rgba(0,0,0,0.5);
  padding: 2px 7px; border-radius: 99px; z-index: 3;
}

.addon-desc-text { font-size: 14px; color: var(--text3); line-height: 1.8; margin-bottom: 16px; }
.addon-feat-title {
  font-size: 10px; font-family: var(--mono);
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text3); margin-bottom: 10px; margin-top: 16px;
}
.addon-feat-item {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 13px; color: var(--text2); padding: 4px 0;
}
.addon-feat-check { color: var(--accent2); flex-shrink: 0; margin-top: 1px; }

.addon-step { display: flex; gap: 12px; margin-bottom: 18px; }
.addon-step-num {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--btn-primary-text);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}
.addon-step-body { flex: 1; }
.addon-step-body h4 { font-size: 13px; margin-bottom: 6px; }

.addon-note {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 12px; color: var(--text3);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px; margin-top: 14px;
}

.addon-popup-btns {
  display: flex; gap: 9px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.addon-popup-btns .btn { flex: 1; justify-content: center; }

/* submit overlay */
.submit-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 2100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.22s;
}
.submit-overlay.active { opacity: 1; pointer-events: auto; }
.submit-popup {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 500px;
  transform: scale(0.96) translateY(10px);
  transition: transform 0.26s cubic-bezier(0.23,1,0.32,1);
  overflow: hidden;
}
.submit-overlay.active .submit-popup { transform: none; }

.submit-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.submit-popup-header h2 { font-size: 17px; }
.submit-close {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text3);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s;
}
.submit-close:hover { background: var(--text); color: var(--bg); border-color: var(--text); }

.submit-popup-body { padding: 20px; }

.submit-steps { display: flex; flex-direction: column; gap: 18px; }
.submit-step { display: flex; gap: 14px; align-items: flex-start; }
.submit-step-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--btn-primary-text);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 2px;
}
.submit-step-body h4 { font-size: 14px; margin-bottom: 4px; }
.submit-step-body p { font-size: 13px; color: var(--text3); }

.submit-popup-btns {
  display: flex; gap: 9px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}
.submit-popup-btns .btn { flex: 1; justify-content: center; }

/* ---- responsive ---- */
@media (max-width: 820px) {
  .mkt-layout {
    grid-template-columns: 1fr;
    padding-top: 74px;
  }
  .mkt-sidebar {
    position: static;
    padding-right: 0;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
  }
  .mkt-sidebar-section { min-width: 140px; }
  .mkt-tag-list { flex-direction: row; flex-wrap: wrap; }
  .mkt-tag-btn, .mkt-status-btn { width: auto; }
  .mkt-main {
    padding: 20px 0;
    border-left: none;
  }
  .mkt-submit-box { border-top: none; padding-top: 0; width: 100%; }
  .mkt-search { width: 200px; }
}
@media (max-width: 480px) {
  .mkt-header { flex-direction: column; }
  .mkt-search { width: 100%; }
  .mkt-search-wrap { width: 100%; }
  .mkt-grid { grid-template-columns: 1fr; }
}
