/* 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;
}

.mkt-submit-full {
  width: 100%;
  justify-content: center;
  margin-top: 10px;
}

/* ---- 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); }

/* source badge */
.mkt-source-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text3);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 12px;
  margin-bottom: 16px;
}
.mkt-source-badge a {
  color: var(--accent2);
  text-decoration: underline;
  margin-left: auto;
}

/* skeleton */
.mkt-skeleton {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  height: 160px;
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}
@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ---- 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;
}

/* ---- cards ---- */
.mkt-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, box-shadow 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 ---- */
.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 overlay ---- */
.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: 620px;
  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; }

/* slideshow */
.addon-popup-slideshow {
  position: relative;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.addon-slide-img {
  width: 100%;
  height: 190px;
  object-fit: cover;
  display: block;
}

/* header */
.addon-popup-header {
  padding: 18px 20px 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.addon-popup-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.addon-popup-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  color: var(--text3);
}
.addon-popup-icon img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}
.addon-popup-icon svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.addon-popup-name-block {
  flex: 1;
  min-width: 0;
}
.addon-popup-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.addon-popup-byline {
  font-size: 12px;
  color: var(--text3);
  margin-top: 3px;
}
.addon-popup-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

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

/* action buttons row */
.addon-popup-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.btn-sm {
  padding: 7px 14px;
  font-size: 12px;
}

/* tab bar */
.addon-popup-tab-bar {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin: 0 -20px;
  padding: 0 20px;
}

.addon-popup-tab {
  padding: 8px 14px;
  border-radius: 7px 7px 0 0;
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text3);
  font-family: var(--sans);
  transition: color 0.15s;
  position: relative;
  bottom: -1px;
  border-bottom: 2px solid transparent;
}
.addon-popup-tab:hover { color: var(--text); }
.addon-popup-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  background: transparent;
}

/* scrollable body */
.addon-popup-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 20px;
  box-sizing: border-box;
}

/* panels */
.addon-popup-panel { display: none; }
.addon-popup-panel.active { display: block; }

/* overview content */
.addon-desc-text {
  font-size: 14px;
  color: var(--text3);
  line-height: 1.8;
  margin-bottom: 18px;
}

.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(--green);
  flex-shrink: 0;
  margin-top: 1px;
}

/* install steps */
.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;
  line-height: 1.6;
}

/* giscus */
.mp-giscus-wrap {
  min-height: 200px;
}

.mp-giscus-wrap .giscus,
.mp-giscus-wrap .giscus-frame {
  width: 100% !important;
}

/* ---- submit overlay ---- */
.submit-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 2300;
  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);
  max-width: 520px;
  width: 100%;
  transform: scale(0.96) translateY(12px);
  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;
  justify-content: space-between;
  align-items: center;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
}
.submit-popup-header h2 { font-size: 17px; }

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

/* ---- mobile ---- */
@media (max-width: 768px) {
  .mkt-layout {
    grid-template-columns: 1fr;
    padding: 70px 16px 40px;
  }

  .mkt-sidebar {
    position: static;
    padding-right: 0;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    border-right: none;
  }

  .mkt-main {
    padding: 20px 0 0;
    border-left: none;
  }

  .mkt-tag-list {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .mkt-tag-btn,
  .mkt-status-btn {
    width: auto;
  }

  .mkt-submit-box { display: none; }

  .mkt-header {
    flex-direction: column;
    gap: 12px;
  }

  .mkt-search { width: 100%; }
  .mkt-search-wrap { width: 100%; }

  .mkt-grid {
    grid-template-columns: 1fr;
  }

  .addon-popup {
    max-height: 92vh;
  }

  .addon-popup-actions {
    flex-wrap: wrap;
  }

  .addon-popup-top {
    flex-wrap: nowrap;
  }
}

@media (max-width: 400px) {
  .addon-popup-actions { flex-direction: column; }
  .addon-popup-actions .btn { width: 100%; justify-content: center; }
}
