/* ========== STORE PAGE ========== */

/* Tab switcher */
.store-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  width: fit-content;
  margin-bottom: 20px;
}
.store-tab {
  padding: 8px 24px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: none;
  font-family: inherit;
}
.store-tab:hover {
  color: var(--text);
  background: var(--surface2);
}
.store-tab.active {
  background: var(--primary-dim);
  color: var(--primary);
}

/* Search bar */
.store-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 16px;
  margin-bottom: 20px;
  transition: border-color 0.15s;
}
.store-search-bar:focus-within {
  border-color: var(--primary);
}
.store-search-icon {
  font-size: 16px;
  color: var(--text-dim);
}
.store-search-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-size: 14px;
  outline: none;
  font-family: inherit;
}
.store-search-input::placeholder {
  color: var(--text-dim);
}

/* Card grid */
.store-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* Cards */
.store-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.store-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.08);
  transform: translateY(-2px);
}
.store-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--primary);
  filter: blur(40px);
  opacity: 0.08;
}

/* Card header */
.store-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.store-card-icon {
  font-size: 28px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
  border-radius: 12px;
}
.store-card-badges {
  display: flex;
  gap: 6px;
}

/* Badges */
.store-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.store-badge-status.active {
  background: var(--success-dim);
  color: var(--success);
}
.store-badge-status.inactive {
  background: rgba(107, 114, 128, 0.2);
  color: var(--text-dim);
}

/* Tier badges */
.store-badge-tier.tier-s {
  background: rgba(255, 215, 0, 0.15);
  color: #ffd700;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.2);
}
.store-badge-tier.tier-a {
  background: rgba(0, 212, 255, 0.15);
  color: #00d4ff;
}
.store-badge-tier.tier-b {
  background: var(--success-dim);
  color: var(--success);
}
.store-badge-tier.tier-c {
  background: var(--warning-dim);
  color: var(--warning);
}
.store-badge-tier.tier-d {
  background: rgba(107, 114, 128, 0.2);
  color: var(--text-dim);
}
.store-badge-tier.tier-none {
  background: rgba(107, 114, 128, 0.15);
  color: var(--text-dim);
}

/* Category badge */
.store-badge-category {
  background: var(--accent-dim);
  color: var(--accent);
}

/* Card content */
.store-card-name {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.3;
}
.store-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.store-card-agent {
  font-size: 11px;
  color: var(--text-dim);
  padding-top: 10px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.store-agent-label {
  color: var(--text-dim);
  font-weight: 600;
}

/* Stats row */
.store-card-stats {
  display: flex;
  gap: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.store-stat {
  flex: 1;
}
.store-stat-val {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1;
}
.store-stat-label {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Loading & empty states */
.store-loading {
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
  padding: 40px 20px;
  grid-column: 1 / -1;
}
.store-empty {
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
  padding: 40px 20px;
  grid-column: 1 / -1;
}

/* Skill card tweaks */
.store-card-skill .store-card-desc {
  margin-bottom: 10px;
}

/* Detail Modal */
.store-detail-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } }
.store-detail-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  max-width: 480px;
  width: 100%;
  position: relative;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  max-height: 80vh;
  overflow-y: auto;
}
.store-detail-close {
  position: absolute;
  top: 14px; right: 14px;
  background: none; border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  transition: all 0.15s;
}
.store-detail-close:hover {
  background: var(--surface2);
  color: var(--text);
}
.store-detail-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.store-detail-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.store-detail-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 20px;
}
.store-detail-stats {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.store-detail-stat {
  flex: 1;
  text-align: center;
}
.store-detail-info {
  padding-top: 12px;
}
.detail-info-row {
  font-size: 13px;
  color: var(--text-muted);
  padding: 6px 0;
}
.detail-info-label {
  font-weight: 700;
  color: var(--text);
}
.detail-section {
  margin-top: 16px;
}
.detail-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.detail-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.detail-skill-tag {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--primary-dim);
  color: var(--primary);
  font-weight: 600;
}

/* Detail Modal — Action Buttons (22.3) */
.store-detail-last-active {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}
.store-detail-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.store-action-btn {
  flex: 1;
  min-width: 130px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  border: none;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.store-action-primary {
  background: var(--primary);
  color: #000;
}
.store-action-primary:hover {
  background: var(--primary-bright, #00eeff);
  transform: translateY(-1px);
}
.store-action-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.store-action-secondary:hover {
  background: var(--surface3, var(--surface));
  border-color: var(--primary);
  color: var(--primary);
}
.store-action-install {
  background: rgba(0, 200, 100, 0.12);
  color: var(--success);
  border: 1px solid rgba(0, 200, 100, 0.4);
}
.store-action-install:hover {
  background: rgba(0, 200, 100, 0.22);
  border-color: var(--success);
  transform: translateY(-1px);
}
.store-action-install:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ========== GENIUS COUNCIL ========== */

/* Genius grid */
.genius-council-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

/* Genius card */
.genius-card {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.06), rgba(255, 165, 0, 0.04));
  border: 1px solid rgba(255, 215, 0, 0.25);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.genius-card:hover {
  border-color: rgba(255, 215, 0, 0.6);
  box-shadow: 0 0 24px rgba(255, 215, 0, 0.12);
  transform: translateY(-2px);
}
.genius-card::after {
  content: '';
  position: absolute;
  top: -20px;
  right: -20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #ffd700;
  filter: blur(30px);
  opacity: 0.1;
}
.genius-icon {
  font-size: 36px;
  margin-bottom: 8px;
}
.genius-name {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.genius-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}
.genius-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(255, 215, 0, 0.15);
  color: #ffd700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Genius in agent grid */
.store-card-genius {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.05), rgba(255, 165, 0, 0.03));
  border-color: rgba(255, 215, 0, 0.2);
}
.store-card-genius:hover {
  border-color: rgba(255, 215, 0, 0.5);
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.1);
}

/* Genius badge in cards */
.store-badge-genius {
  background: rgba(255, 215, 0, 0.15);
  color: #ffd700;
  box-shadow: 0 0 6px rgba(255, 215, 0, 0.15);
}

/* Genius detail modal */
.genius-modal {
  border-color: rgba(255, 215, 0, 0.3);
}
.genius-prompt-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.genius-prompt-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #ffd700;
  margin-bottom: 8px;
}
.genius-prompt-text {
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(255, 215, 0, 0.04);
  border: 1px solid rgba(255, 215, 0, 0.1);
  border-radius: 10px;
  padding: 14px;
  line-height: 1.6;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'JetBrains Mono', monospace;
}
.genius-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.genius-tag {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(255, 215, 0, 0.1);
  color: #ffd700;
  font-weight: 600;
}

/* Genius action button */
.store-action-genius {
  background: rgba(255, 215, 0, 0.12);
  color: #ffd700;
  border: 1px solid rgba(255, 215, 0, 0.4);
}
.store-action-genius:hover {
  background: rgba(255, 215, 0, 0.22);
  border-color: #ffd700;
  transform: translateY(-1px);
}

/* ========== GENIUS CHAT MODAL ========== */
.genius-chat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.genius-chat-modal {
  width: 95%;
  max-width: 640px;
  height: 80vh;
  max-height: 600px;
  background: var(--surface, #1a1a2e);
  border: 1px solid rgba(255, 215, 0, 0.35);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(255, 215, 0, 0.1);
}
.genius-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255, 215, 0, 0.2);
  background: rgba(255, 215, 0, 0.04);
}
.genius-chat-title {
  font-size: 16px;
  font-weight: 700;
  color: #ffd700;
}
.genius-chat-close {
  background: none;
  border: none;
  color: var(--text-muted, #888);
  font-size: 24px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.genius-chat-close:hover {
  color: #fff;
}
.genius-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.genius-chat-welcome {
  text-align: center;
  color: var(--text-muted, #888);
  font-size: 13px;
  padding: 20px 0;
  font-style: italic;
}
.genius-msg {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  max-width: 90%;
  word-break: break-word;
}
.genius-msg-user {
  background: rgba(79, 140, 255, 0.12);
  border: 1px solid rgba(79, 140, 255, 0.2);
  align-self: flex-end;
  color: var(--text, #e0e0e0);
}
.genius-msg-ai {
  background: rgba(255, 215, 0, 0.06);
  border: 1px solid rgba(255, 215, 0, 0.15);
  align-self: flex-start;
  color: var(--text, #e0e0e0);
}
.genius-msg-loading {
  color: #ffd700;
  font-style: italic;
  font-size: 13px;
  align-self: flex-start;
  animation: genius-pulse 1.2s ease-in-out infinite;
}
@keyframes genius-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
.genius-msg-error {
  background: rgba(255, 60, 60, 0.1);
  border: 1px solid rgba(255, 60, 60, 0.3);
  color: #ff6b6b;
  font-size: 13px;
  align-self: flex-start;
}
.genius-msg-meta {
  font-size: 11px;
  color: var(--text-muted, #666);
  align-self: flex-start;
  padding: 0 4px;
}
.genius-chat-input-area {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 215, 0, 0.2);
  background: rgba(0, 0, 0, 0.15);
}
.genius-chat-input {
  flex: 1;
  background: var(--surface, #1a1a2e);
  border: 1px solid var(--border, #333);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text, #e0e0e0);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
}
.genius-chat-input:focus {
  border-color: rgba(255, 215, 0, 0.5);
}
.genius-chat-send {
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid rgba(255, 215, 0, 0.4);
  color: #ffd700;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.genius-chat-send:hover {
  background: rgba(255, 215, 0, 0.25);
  border-color: #ffd700;
}
.genius-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========== CATEGORY FILTERS ========== */
.store-category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.store-filter-btn {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.store-filter-btn:hover {
  color: var(--text);
  border-color: var(--primary);
  background: var(--surface2);
}
.store-filter-btn.active {
  background: var(--primary-dim);
  color: var(--primary);
  border-color: var(--primary);
}
.store-filter-genius {
  border-color: rgba(255, 215, 0, 0.3);
}
.store-filter-genius:hover {
  border-color: rgba(255, 215, 0, 0.6);
  color: #ffd700;
}
.store-filter-genius.active {
  background: rgba(255, 215, 0, 0.1);
  color: #ffd700;
  border-color: rgba(255, 215, 0, 0.5);
}

/* Gold KPI card */
.kpi-card.gold { border-left-color: #ffd700; }
.kpi-icon.gold { background: rgba(255, 215, 0, 0.1); color: #ffd700; }

/* Responsive */
@media (max-width: 1200px) {
  .store-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 768px) {
  .store-grid {
    grid-template-columns: 1fr;
  }
  .store-tabs {
    width: 100%;
  }
  .store-tab {
    flex: 1;
    text-align: center;
    min-height: 44px;
  }
  .genius-council-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
  .store-category-filters {
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }
  .store-category-filters::-webkit-scrollbar { display: none; }
  .store-filter-btn {
    padding: 5px 10px;
    font-size: 11px;
    min-height: 44px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .store-card-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .store-card-desc {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .store-action-btn {
    min-height: 44px;
  }
  .store-search-input {
    font-size: 16px; /* prevent iOS zoom */
    min-height: 44px;
  }
  /* Store detail modal */
  .store-detail-overlay {
    padding: 12px;
  }
  .store-detail-panel {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 16px;
  }
  .store-detail-close {
    width: 44px;
    height: 44px;
  }
  /* Genius cards on mobile */
  .genius-card {
    min-height: 44px;
    padding: 12px;
  }
  .genius-name {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .genius-desc {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-size: 11px;
  }
}

/* ========== MARKETPLACE TAB ========== */
.store-card-marketplace {
  border-left: 3px solid var(--accent-green, #10b981);
}
.store-badge-type {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}
.store-badge-source {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
}
.store-badge-skill {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}
.store-badge-agent-type {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}
.store-source-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}
.store-source-link:hover {
  text-decoration: underline;
}
.store-pagination .store-filter-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ========== INSTALL BUTTON ON CARDS ========== */
.store-card-install {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
}
.store-install-btn {
  padding: 6px 18px;
  border-radius: 6px;
  border: 1px solid rgba(0, 200, 100, 0.4);
  background: rgba(0, 200, 100, 0.1);
  color: #10b981;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
}
.store-install-btn:hover {
  background: rgba(0, 200, 100, 0.22);
  border-color: #10b981;
  transform: translateY(-1px);
}
.store-install-btn:disabled {
  cursor: not-allowed;
  transform: none;
}
.store-install-btn-installed {
  background: rgba(0, 200, 100, 0.06);
  color: rgba(16, 185, 129, 0.6);
  border-color: rgba(0, 200, 100, 0.2);
  cursor: default;
}
.store-badge-installed {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #10b981 !important;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.store-action-installed {
  background: rgba(0, 200, 100, 0.08);
  color: rgba(16, 185, 129, 0.7);
  border: 1px solid rgba(0, 200, 100, 0.2);
  cursor: default;
}
.store-action-installed:hover {
  transform: none;
}
.store-install-btn-loading {
  position: relative;
  color: transparent !important;
}
.store-install-btn-loading::after {
  content: 'Installing...';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #10b981;
  animation: installPulse 1s ease-in-out infinite;
}
@keyframes installPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
.store-install-btn-success {
  animation: installSuccess 0.4s ease;
}
@keyframes installSuccess {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); box-shadow: 0 0 16px rgba(16, 185, 129, 0.4); }
  100% { transform: scale(1); }
}
