/* ==========================================================================
   Marketplace Page Styles
   Extends main.css with marketplace-specific components
   ========================================================================== */

/* Ensure proper body and page alignment */
body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
}

/* ==========================================================================
   Hero Slider Section
   ========================================================================== */

.market-hero {
  padding-top: calc(var(--nav-height) + 64px);
  padding-bottom: var(--space-md);
  position: relative;
  overflow: visible;
  width: 100%;
}

.market-hero .hero-glow {
  position: absolute;
  width: 80%;
  aspect-ratio: 1;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--gradient-atmosphere);
  filter: blur(140px);
  opacity: 0.25;
  animation: glow-rotate 120s linear infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes glow-rotate {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.market-hero .container {
  width: 100%;
  max-width: var(--container-wide);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
  position: relative;
  z-index: 1;
}

.market-hero-header {
  text-align: center;
  margin-bottom: var(--space-lg);
  width: 100%;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  z-index: 2;
  opacity: 1 !important;
  visibility: visible !important;
}

.market-hero-header .hero-headline {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 var(--space-sm) 0;
  color: var(--text-primary);
  opacity: 1 !important;
}

.market-hero-header .hero-headline .gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.market-hero-header .hero-sub {
  font-size: var(--body-lg);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  max-width: 700px;
  margin: 0 auto;
  opacity: 1 !important;
}

.hero-line1 {
  display: inline;
  font-weight: 400;
}

.market-hero-slider {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: 360px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xl), 0 0 80px rgba(212, 197, 171, 0.1);
  margin: 0 auto;
  z-index: 1;
  isolation: isolate;
  /* Subtle default for touch devices (no mousemove) */
  --mouse-x: 50%;
  --mouse-y: 50%;
  --gradient-opacity: 0.12;
}

/* Marketplace hero: gradient light outline (matches .feature-card effect) */
.market-hero-slider::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(
    600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(168, 85, 247, 0.85),
    rgba(59, 130, 246, 0.65),
    rgba(16, 185, 129, 0.45),
    transparent 50%
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: var(--gradient-opacity, 0);
  transition: opacity 0.2s ease;
  pointer-events: none;
  z-index: 5;
}

@media (max-width: 768px) {
  .market-hero-slider {
    height: 280px;
  }
}

.hero-slider-track {
  display: flex;
  height: 100%;
  transition: transform 700ms cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.hero-slide {
  min-width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
  background: var(--bg-surface);
}

.hero-slide-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.hero-slide-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: right center;
  transition: transform 8s ease-out;
  display: block;
  max-width: none;
}

/* No hover scale on hero slider images - keeps carousel static on mouse-over */

.hero-slide-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to right,
    rgba(10, 10, 10, 0.95) 0%,
    rgba(10, 10, 10, 0.75) 30%,
    rgba(10, 10, 10, 0.4) 50%,
    transparent 70%
  );
  z-index: 1;
}

@media (max-width: 768px) {
  .hero-slide-gradient {
    background: linear-gradient(
      to top,
      rgba(10, 10, 10, 0.95) 0%,
      rgba(10, 10, 10, 0.75) 40%,
      transparent 100%
    );
  }
}

.hero-slide-content {
  position: relative;
  z-index: 10;
  padding: 28px 40px;
  max-width: 550px;
}

@media (max-width: 768px) {
  .hero-slide-content {
    padding: 20px 24px;
    max-width: 100%;
  }
}

.hero-slide-badge {
  display: none;
}

.hero-slide-title {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 600;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  margin-bottom: 12px;
  color: var(--text-primary);
}

.hero-slide-description {
  font-size: var(--body-base);
  color: var(--text-secondary);
  line-height: var(--leading-normal);
  margin-bottom: 20px;
  max-width: 540px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-slide-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-slide-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--accent);
  color: var(--bg-deep);
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: 0 4px 16px rgba(212, 197, 171, 0.25);
}

.hero-slide-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(212, 197, 171, 0.35);
}

.hero-slide-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.hero-slide-meta-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-tertiary);
}

/* Slider Controls */
.hero-slider-controls {
  position: absolute;
  bottom: 32px;
  right: 32px;
  display: flex;
  gap: 12px;
  z-index: 20;
}

@media (max-width: 768px) {
  .hero-slider-controls {
    bottom: 16px;
    right: 16px;
    gap: 8px;
  }
}

.hero-slider-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 10, 0.8);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-visible);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.hero-slider-btn:hover {
  background: rgba(212, 197, 171, 0.15);
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.05);
}

/* Slider Indicators */
.hero-slider-indicators {
  position: absolute;
  bottom: 32px;
  left: 48px;
  display: flex;
  gap: 8px;
  z-index: 20;
}

@media (max-width: 768px) {
  .hero-slider-indicators {
    bottom: 16px;
    left: 24px;
    gap: 6px;
  }
}

.hero-indicator {
  height: 3px;
  width: 24px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.hero-indicator.active {
  width: 48px;
  background: var(--accent);
}

.hero-indicator:hover:not(.active) {
  background: rgba(255, 255, 255, 0.5);
}

/* ==========================================================================
   Marketplace Grid Section
   ========================================================================== */

.market-section {
  padding-top: var(--space-md);
  padding-bottom: var(--space-2xl);
  width: 100%;
}

.market-section .container-wide {
  width: 100%;
  max-width: var(--container-wide);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

.market-layout {
  display: flex;
  flex-direction: column;
  gap: 32px;
  width: 100%;
}

@media (max-width: 1024px) {
  .market-layout {
    gap: 24px;
  }
}

/* ==========================================================================
   Horizontal Filter Bar (instead of sidebar)
   ========================================================================== */

.market-sidebar {
  position: relative;
  top: 0;
  background: var(--surface-card-bg);
  border: 1px solid var(--surface-card-border);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: visible;
}

@media (max-width: 1024px) {
  .market-sidebar {
    flex-wrap: wrap;
    gap: 12px;
    overflow-x: visible;
  }
}

@media (max-width: 640px) {
  .market-sidebar {
    padding: 14px 16px;
    gap: 10px;
    flex-direction: column;
    align-items: stretch;
  }
}

.sidebar-section {
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sidebar-section:first-child {
  flex: 0 0 260px;
}

.sidebar-section:nth-child(2) {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
}

.sidebar-section:last-child {
  flex: 0 0 180px;
}

@media (max-width: 1024px) {
  .sidebar-section:first-child {
    flex: 1 1 100%;
  }
  
  .sidebar-section:nth-child(2) {
    flex: 1 1 100%;
  }
  
  .sidebar-section:last-child {
    flex: 0 0 180px;
  }
}

@media (max-width: 640px) {
  .sidebar-section:first-child,
  .sidebar-section:nth-child(2),
  .sidebar-section:last-child {
    flex: 1 1 100%;
  }
}

.sidebar-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0;
  white-space: nowrap;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .sidebar-title {
    display: none;
  }
}

/* Search Input */
.market-search {
  position: relative;
  flex: 1;
  min-width: 0;
}

.market-search-input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  transition: all var(--transition-fast);
}

.market-search-input::placeholder {
  color: var(--text-muted);
}

.market-search-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px rgba(212, 197, 171, 0.1);
}

.market-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  width: 16px;
  height: 16px;
}

/* Category Filters - Horizontal Pills */
.sidebar-categories {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.sidebar-categories::-webkit-scrollbar {
  display: none;
}

.category-filter {
  padding: 6px 12px;
  text-align: center;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  line-height: 1;
  flex-shrink: 0;
}

.category-filter:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-visible);
  color: var(--text-primary);
}

.category-filter.active {
  background: rgba(212, 197, 171, 0.12);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* Sort Select */
.market-select {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.market-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212, 197, 171, 0.1);
}

/* ==========================================================================
   Market Content Area
   ========================================================================== */

.market-content {
  min-height: 600px;
}

.market-content-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-lg);
  gap: 24px;
}

@media (max-width: 640px) {
  .market-content-header {
    flex-direction: column;
  }
}

.content-title {
  font-size: var(--heading-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.content-subtitle {
  font-size: var(--body-sm);
  color: var(--text-tertiary);
}

.market-view-toggle {
  display: flex;
  gap: 8px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px;
  background: var(--bg-surface);
}

.view-toggle-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  transition: all var(--transition-fast);
}

.view-toggle-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.view-toggle-btn.active {
  background: var(--accent);
  color: var(--bg-deep);
}

/* ==========================================================================
   Market Grid - Vertical Cards (Image on top, content below)
   ========================================================================== */

.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  width: 100%;
}

@media (max-width: 1280px) {
  .market-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }
}

@media (max-width: 900px) {
  .market-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
  }
}

@media (max-width: 640px) {
  .market-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }
}

/* Loading State */
.market-loading {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 80px 24px;
  color: var(--text-tertiary);
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-visible);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Empty State */
.market-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 80px 24px;
  text-align: center;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.02);
}

.empty-icon {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-tertiary);
}

.empty-title {
  font-size: var(--heading-md);
  color: var(--text-primary);
  margin: 0;
}

.empty-description {
  font-size: var(--body-base);
  color: var(--text-tertiary);
  max-width: 400px;
}

/* ==========================================================================
   Agent Card - Vertical (Image on top, content below)
   ========================================================================== */

.agent-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface-card-bg);
  border: 1px solid var(--surface-card-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-medium);
  box-shadow: var(--shadow-sm);
  isolation: isolate;
  /* Subtle default for touch devices (no mousemove) */
  --mouse-x: 50%;
  --mouse-y: 50%;
  --gradient-opacity: 0.12;
}

.agent-card:hover {
  transform: translateY(-4px);
  border-color: var(--surface-card-border-hover);
  box-shadow: var(--shadow-lg);
}

/* Agent cards: gradient light outline (matches .feature-card effect) */
.agent-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(
    520px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(168, 85, 247, 0.8),
    rgba(59, 130, 246, 0.6),
    rgba(16, 185, 129, 0.4),
    transparent 50%
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: var(--gradient-opacity, 0);
  transition: opacity 0.2s ease;
  pointer-events: none;
  z-index: 5;
}

.agent-card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 1.5 / 1;
  background: var(--bg-elevated);
  overflow: hidden;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
}

.agent-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform var(--transition-medium);
  display: block;
}

.agent-card:hover .agent-card-img {
  transform: scale(1.05);
}

.agent-card-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--bg-surface) 100%);
  font-size: 48px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
}

.agent-card-badges {
  display: none;
}

.agent-badge {
  display: none;
}

.agent-badge.featured {
  display: none;
}

.agent-card-price {
  position: absolute;
  bottom: 10px;
  right: 10px;
  padding: 5px 10px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  z-index: 10;
}

.agent-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

@media (max-width: 640px) {
  .agent-card-body {
    padding: 12px;
    gap: 8px;
  }
}

.agent-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 0;
}

.agent-avatar {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 640px) {
  .agent-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
  }
}

.agent-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.agent-card-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.agent-card-category {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 3px;
}

.agent-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}

@media (max-width: 640px) {
  .agent-card-title {
    font-size: 14px;
  }
}

.agent-card:hover .agent-card-title {
  color: var(--accent);
}

.agent-card-role {
  font-size: 12px;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}

@media (max-width: 640px) {
  .agent-card-role {
    font-size: 11px;
  }
}

.agent-card-description {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}

@media (max-width: 640px) {
  .agent-card-description {
    font-size: 12px;
    -webkit-line-clamp: 2;
  }
}

.agent-card-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.agent-card-stats {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-tertiary);
}

.agent-card-arrow {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--accent);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.agent-card:hover .agent-card-arrow {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-deep);
  transform: translateX(2px);
}

/* ==========================================================================
   Agent Detail Modal
   ========================================================================== */

.agent-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.agent-modal.active {
  display: flex;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-container {
  position: relative;
  width: 100%;
  max-width: 1100px;
  max-height: 90vh;
  background: var(--bg-elevated);
  border: 1px solid var(--border-visible);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: var(--text-primary);
  cursor: pointer;
  z-index: 50;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.05);
}

.modal-content {
  overflow-y: auto;
  flex: 1;
}

/* Modal Header with Hero Image */
.modal-header {
  position: relative;
  height: 120px;
  overflow: hidden;
}

@media (max-width: 768px) {
  .modal-header {
    height: 110px;
  }
}

.modal-header-bg {
  position: absolute;
  inset: 0;
}

.modal-header-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.4;
  filter: blur(20px);
  transform: scale(1.1);
  display: block;
}

.modal-header-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(10, 10, 10, 0.7) 60%,
    var(--bg-elevated) 100%
  );
}

.modal-header-content {
  position: relative;
  z-index: 10;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 16px 24px;
  gap: 14px;
}

@media (max-width: 768px) {
  .modal-header-content {
    padding: 14px 20px;
    gap: 12px;
  }
}

.modal-agent-avatar {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--border-visible);
  background: var(--bg-surface);
  flex-shrink: 0;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 768px) {
  .modal-agent-avatar {
    width: 56px;
    height: 56px;
    border-radius: 10px;
  }
}

.modal-agent-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.modal-header-info {
  flex: 1;
  min-width: 0;
}

.modal-agent-badges {
  display: none;
}

.modal-badge {
  display: none;
}

.modal-badge.free {
  display: none;
}

.modal-header-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.modal-agent-name {
  font-size: clamp(1.125rem, 2vw, 1.5rem);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.2;
}

.modal-agent-role {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.3;
}

/* Modal Body */
.modal-body {
  padding: 40px 32px;
}

@media (max-width: 768px) {
  .modal-body {
    padding: 32px 24px;
  }
}

.modal-body-grid {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 40px;
}

@media (max-width: 1024px) {
  .modal-body-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

/* Modal Stats Bar */
.modal-stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-subtle);
}

@media (max-width: 768px) {
  .modal-stats-bar {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 20px;
    gap: 12px;
  }
}

.modal-stats {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.modal-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

.modal-stat svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.modal-actions {
  display: flex;
  gap: 12px;
}

@media (max-width: 768px) {
  .modal-actions {
    width: 100%;
  }
  
  .modal-actions .btn-primary,
  .modal-actions .btn-ghost {
    flex: 1;
  }
}

/* Left Column - Description */
.modal-left {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.modal-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-section-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-section-title svg {
  width: 16px;
  height: 16px;
}

.modal-section-content {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.modal-section-content p {
  margin-bottom: 16px;
}

.modal-section-content p:last-child {
  margin-bottom: 0;
}

.modal-section-content strong {
  color: var(--text-primary);
  font-weight: 600;
}

.modal-section-content em {
  font-style: italic;
  color: var(--text-secondary);
}

.modal-section-content ul {
  margin: 12px 0;
  padding-left: 0;
  list-style: none;
}

.modal-section-content li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 8px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.modal-section-content li:before {
  content: "•";
  position: absolute;
  left: 6px;
  color: var(--accent);
  font-weight: bold;
}

.modal-section-content li:last-child {
  margin-bottom: 0;
}

/* Skills Tags */
.modal-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-tag {
  padding: 6px 14px;
  background: rgba(212, 197, 171, 0.12);
  border: 1px solid rgba(212, 197, 171, 0.2);
  border-radius: 999px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.skill-tag:hover {
  background: rgba(212, 197, 171, 0.18);
  border-color: var(--accent);
}

/* Right Column - Details */
.modal-right {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.modal-panel {
  padding: 24px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.modal-panel-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-panel-title svg {
  width: 16px;
  height: 16px;
}

.modal-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-detail-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.modal-detail-label {
  font-size: 14px;
  color: var(--text-tertiary);
}

.modal-detail-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-command {
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-visible);
  border-radius: var(--radius-sm);
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: rgb(74, 222, 128);
  position: relative;
  overflow-x: auto;
}

.modal-command-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.copy-command-btn {
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.copy-command-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent);
  color: var(--accent);
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 1024px) {
  .market-hero {
    padding-top: calc(var(--nav-height) + 48px);
  }
}

@media (max-width: 640px) {
  .market-hero-header {
    text-align: left;
  }
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-elevated) 0%,
    rgba(255, 255, 255, 0.04) 50%,
    var(--bg-elevated) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ==========================================================================
   Agent Detail Page (when using URL params)
   ========================================================================== */

.agent-detail-page {
  padding-top: calc(var(--nav-height) + 64px);
  padding-bottom: var(--space-2xl);
}

.agent-detail-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  margin-bottom: 32px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.agent-detail-back:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateX(-2px);
}

.agent-detail-back svg {
  width: 16px;
  height: 16px;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.text-green {
  color: rgb(74, 222, 128);
}

.text-orange {
  color: rgb(251, 146, 60);
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Image Loading Optimization
   ========================================================================== */

/* Improve lazy loading performance with content-visibility */
.agent-card {
  content-visibility: auto;
  contain-intrinsic-size: auto 400px;
}

/* Add blur-up effect for images while loading */
.hero-slide-img,
.agent-card-img,
.modal-header-img {
  background: linear-gradient(135deg, rgba(212, 197, 171, 0.05) 0%, rgba(212, 197, 171, 0.02) 100%);
}

/* Optimize image rendering - preserve quality */
.hero-slide-img,
.modal-header-img,
.agent-avatar img,
.modal-agent-avatar img {
  image-rendering: auto;
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* High quality rendering for card images */
.agent-card-img {
  image-rendering: auto;
  -ms-interpolation-mode: bicubic;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Progressive image loading placeholder */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s ease-in;
}

img[loading="lazy"].loaded,
img[loading="lazy"]:not([src]) {
  opacity: 1;
}

/* Modal images should load immediately */
.modal-header-img,
.modal-agent-avatar img {
  opacity: 1 !important;
}
