/* ========================================================================== */
/* Market Tab                                                                 */
/* ========================================================================== */

.market-tab-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.market-tab {
  flex: 1;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--xbot-border);
  background: transparent;
  color: var(--xbot-text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.market-tab:hover {
  color: var(--xbot-text-primary);
  background: rgba(51, 65, 85, 0.4);
}

.market-tab.active {
  color: var(--xbot-text-primary);
  background: var(--xbot-bg-elevated);
  border-color: var(--xbot-border-light);
}

.market-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2px solid var(--xbot-border-light);
  border-top-color: var(--xbot-text-secondary);
  border-radius: 50%;
  animation: market-spin 0.6s linear infinite;
}

.market-entry-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.market-entry {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #1e293b;
  background: var(--xbot-bg-primary);
  transition: border-color 0.2s;
}

.market-entry:hover {
  border-color: var(--xbot-border);
}

.market-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.market-entry-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.market-entry-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--xbot-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.market-entry-author {
  font-size: 11px;
  color: var(--xbot-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.market-entry-desc {
  font-size: 12px;
  color: var(--xbot-text-secondary);
  margin-top: 4px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.market-install-btn {
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid var(--xbot-accent-blue);
  background: rgba(59, 130, 246, 0.15);
  color: var(--xbot-text-link);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.market-install-btn:hover {
  background: rgba(59, 130, 246, 0.3);
}

.market-uninstall-btn {
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid var(--xbot-border-danger);
  background: rgba(127, 29, 29, 0.2);
  color: var(--xbot-text-danger);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.market-uninstall-btn:hover {
  background: rgba(127, 29, 29, 0.4);
}

/* Sub tab bar */
.market-sub-tab-bar {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(100, 116, 139, 0.2);
  padding-bottom: 0;
}

.market-sub-tab {
  padding: 6px 16px;
  font-size: 12px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  border-radius: 0;
  border: none;
  background: transparent;
  transition: all 0.15s ease;
}

.market-sub-tab.active {
  border-bottom-color: var(--xbot-accent-blue);
  color: #93c5fd;
}

/* Entry status badges */
.market-entry-status {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 9999px;
}

.market-entry-status.published {
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.15);
}

.market-entry-status.unpublished {
  color: var(--xbot-text-secondary);
  background: rgba(100, 116, 139, 0.15);
}

/* Unpublish button */
.market-unpublish-btn {
  padding: 4px 12px;
  font-size: 12px;
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.market-unpublish-btn:hover {
  background: rgba(245, 158, 11, 0.3);
}

/* ---- Light theme overrides ---- */
[data-theme="light"] .market-tab {
  border-color: #cbd5e1;
  color: var(--xbot-text-muted);
}

[data-theme="light"] .market-tab:hover {
  color: #1e293b;
  background: rgba(226, 232, 240, 0.6);
}

[data-theme="light"] .market-tab.active {
  color: #1e293b;
  background: #e2e8f0;
  border-color: #cbd5e1;
}

[data-theme="light"] .market-spinner {
  border-color: #cbd5e1;
  border-top-color: var(--xbot-text-muted);
}

[data-theme="light"] .market-entry {
  border-color: var(--xbot-text-primary);
  background: #f8fafc;
}

[data-theme="light"] .market-entry:hover {
  border-color: #cbd5e1;
}

[data-theme="light"] .market-entry-name {
  color: #1e293b;
}

[data-theme="light"] .market-entry-desc {
  color: var(--xbot-text-muted);
}

[data-theme="light"] .market-install-btn {
  border-color: #93c5fd;
  background: rgba(59, 130, 246, 0.08);
  color: #007AFF;
}

[data-theme="light"] .market-install-btn:hover {
  background: rgba(59, 130, 246, 0.15);
}

[data-theme="light"] .market-uninstall-btn {
  border-color: var(--xbot-text-danger);
  background: rgba(254, 226, 226, 0.4);
  color: #dc2626;
}

[data-theme="light"] .market-uninstall-btn:hover {
  background: rgba(254, 202, 202, 0.6);
}

[data-theme="light"] .market-sub-tab {
  color: var(--xbot-text-muted);
  border-bottom-color: transparent;
}

[data-theme="light"] .market-sub-tab.active {
  border-bottom-color: var(--xbot-accent-blue);
  color: #1e293b;
}

[data-theme="light"] .market-entry-status.published {
  color: #059669;
  background: rgba(16, 185, 129, 0.1);
}

[data-theme="light"] .market-entry-status.unpublished {
  color: var(--xbot-text-secondary);
  background: rgba(100, 116, 139, 0.1);
}

[data-theme="light"] .market-unpublish-btn {
  border-color: #fcd34d;
  background: rgba(254, 243, 199, 0.5);
  color: #b45309;
}

[data-theme="light"] .market-unpublish-btn:hover {
  background: rgba(254, 243, 199, 0.8);
}
