/**
 * Marketplace Portal - Components
 */

/* ========================================
   BASE STYLES & TYPOGRAPHY
   ======================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--font-weight-regular);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
  color: var(--text-primary);
}

h1 {
  font-size: var(--text-4xl);
  font-weight: var(--font-weight-extrabold);
}

h2 {
  font-size: var(--text-3xl);
  font-weight: var(--font-weight-bold);
}

h3 {
  font-size: var(--text-2xl);
  font-weight: var(--font-weight-semibold);
}

h4 {
  font-size: var(--text-xl);
  font-weight: var(--font-weight-semibold);
}

p {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}

a {
  color: var(--accent-text);
  text-decoration: none;
  transition: color var(--duration-fast);
}

a:hover {
  color: var(--accent-hover);
}

code, pre, kbd, samp {
  font-family: var(--font-mono);
}

code {
  font-size: 0.9em;
  background: var(--bg-code-inline);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-xs);
}

/* ========================================
   LAYOUT
   ======================================== */

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container-narrow {
  max-width: var(--container-narrow);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

/* ========================================
   NAVIGATION
   ======================================== */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-overlay);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 1000;
  display: flex;
  align-items: center;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--text-primary);
}

.nav-logo svg {
  width: 36px;
  height: 36px;
}

.nav-badge {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-primary);
  background: var(--accent-subtle);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}

.nav-search {
  flex: 1;
  max-width: 400px;
  margin: 0 var(--space-8);
}

.search-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  padding-left: var(--space-10);
  font-size: var(--text-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  transition: all var(--duration-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

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

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  list-style: none;
}

.nav-links a {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--duration-fast);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-gentle);
}

.btn-primary {
  background: var(--accent-primary);
  color: var(--text-inverse);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
}

/* ========================================
   HERO
   ======================================== */

.hero {
  padding: calc(var(--header-height) + var(--space-20)) 0 var(--space-16);
  text-align: center;
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

.hero-eyebrow {
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-primary);
  margin-bottom: var(--space-4);
}

.hero h1 {
  font-size: clamp(var(--text-4xl), 6vw, var(--text-6xl));
  margin-bottom: var(--space-4);
}

.hero-subtitle {
  font-size: var(--text-xl);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto var(--space-8);
}

/* ========================================
   PERSONA CARDS
   ======================================== */

.persona-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--card-gap);
}

.persona-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-2xl);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: all var(--duration-slow) var(--ease-out);
  cursor: pointer;
}

.persona-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
}

.persona-header {
  position: relative;
  padding: var(--space-6);
  background: linear-gradient(
    135deg,
    var(--persona-color, var(--accent-primary)) 0%,
    var(--persona-secondary, var(--accent-hover)) 100%
  );
}

.persona-avatar {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-2xl);
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-3xl);
  margin-bottom: var(--space-4);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.persona-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-2xl);
}

.persona-initial {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 800;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.persona-name {
  font-size: var(--text-xl);
  font-weight: 700;
  color: white;
  margin-bottom: var(--space-1);
}

.persona-tagline {
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.85);
}

.persona-body {
  padding: var(--space-5);
}

.persona-description {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-4);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.persona-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.persona-tag {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
}

.persona-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

.persona-rating {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.persona-stars {
  color: var(--warning);
  font-size: var(--text-sm);
}

.persona-rating-count {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.persona-price {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.persona-price.free {
  color: var(--success);
}

/* ========================================
   CATEGORY CHIPS
   ======================================== */

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: center;
  margin-bottom: var(--space-12);
}

.category-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.category-chip:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.category-chip.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.category-chip-icon {
  font-size: var(--text-lg);
}

/* ========================================
   FEATURED CAROUSEL
   ======================================== */

.featured-section {
  margin-bottom: var(--space-16);
}

.featured-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}

.featured-title {
  font-size: var(--text-2xl);
  font-weight: 700;
}

.featured-nav {
  display: flex;
  gap: var(--space-2);
}

.featured-nav button {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.featured-nav button:hover {
  background: var(--bg-secondary);
  border-color: var(--border-medium);
}

.featured-carousel {
  display: flex;
  gap: var(--space-6);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: var(--space-4);
}

.featured-carousel::-webkit-scrollbar {
  display: none;
}

.featured-card {
  flex: 0 0 400px;
  scroll-snap-align: start;
}

/* ========================================
   PERSONA DETAIL PAGE
   ======================================== */

.persona-detail-hero {
  position: relative;
  padding: calc(var(--header-height) + var(--space-12)) 0 var(--space-16);
  background: linear-gradient(135deg, var(--persona-color) 0%, var(--persona-secondary) 100%);
  color: white;
}

.persona-detail-content {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-8);
  align-items: start;
}

.persona-detail-avatar {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-3xl);
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.persona-detail-info h1 {
  font-size: var(--text-4xl);
  margin-bottom: var(--space-2);
  color: white;
}

.persona-detail-tagline {
  font-size: var(--text-xl);
  opacity: 0.9;
  margin-bottom: var(--space-4);
}

.persona-detail-meta {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  font-size: var(--text-sm);
  opacity: 0.85;
}

.persona-detail-actions {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-6);
}

.btn-add-team {
  background: white;
  color: var(--persona-color, var(--accent-primary));
  font-weight: 700;
}

.btn-add-team:hover {
  background: rgba(255, 255, 255, 0.9);
}

.btn-preview-voice {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  backdrop-filter: blur(10px);
}

.btn-preview-voice:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ========================================
   VOICE PLAYER
   ======================================== */

.voice-player {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--bg-elevated);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
}

.voice-play-btn {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--accent-primary);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast);
}

.voice-play-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

.voice-waveform {
  flex: 1;
  height: 40px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.voice-duration {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ========================================
   TRAIT RADAR
   ======================================== */

.trait-radar {
  background: var(--bg-elevated);
  border-radius: var(--radius-2xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-card);
}

.trait-radar-title {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-4);
}

.trait-radar-chart {
  aspect-ratio: 1;
  max-width: 300px;
  margin: 0 auto;
}

.trait-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  margin-top: var(--space-6);
}

.trait-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.trait-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--accent-primary);
}

.trait-name {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.trait-value {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-left: auto;
}

/* ========================================
   REVIEWS
   ======================================== */

.reviews-section {
  margin-top: var(--space-12);
}

.reviews-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}

.reviews-summary {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.reviews-rating-big {
  font-size: var(--text-4xl);
  font-weight: 800;
  color: var(--text-primary);
}

.reviews-rating-info {
  display: flex;
  flex-direction: column;
}

.reviews-stars {
  color: var(--warning);
  font-size: var(--text-lg);
}

.reviews-count {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.review-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.review-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.review-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
}

.review-author {
  font-weight: 600;
  color: var(--text-primary);
}

.review-date {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.review-stars {
  margin-left: auto;
  color: var(--warning);
  font-size: var(--text-sm);
}

.review-content {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

/* ========================================
   SECTIONS
   ======================================== */

.section {
  padding: var(--space-20) 0;
}

.section-header {
  text-align: center;
  max-width: 600px;
  margin: 0 auto var(--space-12);
}

.section-header h2 {
  margin-bottom: var(--space-4);
}

.section-header p {
  color: var(--text-secondary);
  font-size: var(--text-lg);
}

.section-alt {
  background: var(--bg-secondary);
}

/* ========================================
   FOOTER
   ======================================== */

.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-16) 0 var(--space-8);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: var(--space-12);
  margin-bottom: var(--space-12);
}

.footer-brand p {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin-top: var(--space-4);
  max-width: 280px;
}

.footer-column h4 {
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-4);
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: var(--space-2);
}

.footer-links a {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.footer-links a:hover {
  color: var(--text-primary);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-8);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .footer-bottom {
    flex-direction: column;
    gap: var(--space-4);
    text-align: center;
  }

  .persona-detail-content {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .persona-detail-avatar {
    margin: 0 auto;
  }

  .persona-detail-meta {
    justify-content: center;
  }

  .persona-detail-actions {
    justify-content: center;
  }
}
