/**
 * Stellar Reviews - Frontend Styles
 * Design inspiré iOS/Apple
 */

/* ==========================================================================
   Variables CSS
   ========================================================================== */
:root {
  /* Couleurs iOS */
  --stellar-blue: #007AFF;
  --stellar-green: #34C759;
  --stellar-orange: #FF9500;
  --stellar-red: #FF3B30;
  --stellar-yellow: #FFCC00;
  --stellar-star-color: #FFD700;
  --stellar-star-empty: #E0E0E0;

  /* Gris iOS */
  --stellar-gray: #8E8E93;
  --stellar-gray-2: #AEAEB2;
  --stellar-gray-3: #C7C7CC;
  --stellar-gray-4: #D1D1D6;
  --stellar-gray-5: #E5E5EA;
  --stellar-gray-6: #F2F2F7;

  /* Backgrounds */
  --stellar-bg-primary: #FFFFFF;
  --stellar-bg-secondary: #F2F2F7;

  /* Texte */
  --stellar-text-primary: #1C1C1E;
  --stellar-text-secondary: #3C3C43;
  --stellar-text-tertiary: #8E8E93;

  /* Espacements */
  --stellar-spacing-xs: 4px;
  --stellar-spacing-sm: 8px;
  --stellar-spacing-md: 16px;
  --stellar-spacing-lg: 24px;
  --stellar-spacing-xl: 32px;

  /* Bordures */
  --stellar-radius-sm: 8px;
  --stellar-radius-md: 12px;
  --stellar-radius-lg: 16px;
  --stellar-radius-xl: 24px;

  /* Ombres */
  --stellar-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --stellar-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
  --stellar-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.08);
  --stellar-shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.12);
}

/* ==========================================================================
   Base / Reset
   ========================================================================== */
.stellar-carousel,
.stellar-carousel * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.stellar-carousel {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--stellar-spacing-lg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Header / Compteur
   ========================================================================== */
.stellar-header {
  text-align: center;
  margin-bottom: var(--stellar-spacing-xl);
}

.stellar-average {
  display: inline-flex;
  align-items: center;
  gap: var(--stellar-spacing-sm);
  margin-bottom: var(--stellar-spacing-sm);
}

.stellar-average-text {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--stellar-text-primary);
}

.stellar-count {
  font-size: 1rem;
  color: var(--stellar-text-secondary);
}

.stellar-counter-number {
  font-weight: 700;
  color: var(--stellar-blue);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Étoiles
   ========================================================================== */
.stellar-stars-container {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.stellar-star {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.stellar-star svg {
  width: 18px;
  height: 18px;
  display: block;
}

.stellar-star-full svg {
  color: var(--stellar-star-color);
  fill: var(--stellar-star-color);
}

.stellar-star-empty svg {
  color: var(--stellar-star-empty);
  fill: var(--stellar-star-empty);
}

.stellar-star-half svg {
  color: var(--stellar-star-color);
}

/* ==========================================================================
   Carousel Wrapper
   ========================================================================== */
.stellar-carousel-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--stellar-spacing-md);
}

.stellar-carousel-viewport {
  flex: 1;
  overflow: hidden;
  border-radius: var(--stellar-radius-lg);
}

.stellar-carousel-track {
  display: flex;
  gap: var(--stellar-spacing-lg);
  transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

/* ==========================================================================
   Cartes d'avis
   ========================================================================== */
.stellar-card {
  flex: 0 0 calc(33.333% - 16px);
  min-width: 280px;
  background: var(--stellar-bg-primary);
  border-radius: var(--stellar-radius-lg);
  padding: var(--stellar-spacing-lg);
  box-shadow: var(--stellar-shadow-md);
  border: 1px solid rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: var(--stellar-spacing-md);
}

.stellar-card-header {
  display: flex;
  align-items: center;
  gap: var(--stellar-spacing-md);
}

/* Avatar */
.stellar-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--stellar-gray-5);
}

.stellar-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stellar-avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--stellar-blue), #5856D6);
  color: white;
  font-weight: 600;
  font-size: 1.25rem;
  text-transform: uppercase;
}

/* Infos auteur */
.stellar-author-info {
  flex: 1;
  min-width: 0;
}

.stellar-author-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--stellar-text-primary);
  margin: 0 0 2px 0;
  line-height: 1.3;
}

.stellar-author-title {
  font-size: 0.875rem;
  color: var(--stellar-text-tertiary);
  display: block;
}

/* Rating */
.stellar-rating {
  display: flex;
  align-items: center;
}

/* Contenu */
.stellar-content {
  flex: 1;
}

.stellar-content p {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--stellar-text-secondary);
  margin: 0;
}

/* Footer */
.stellar-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--stellar-spacing-md);
  border-top: 1px solid var(--stellar-gray-5);
  font-size: 0.8125rem;
  color: var(--stellar-text-tertiary);
}

.stellar-source {
  display: inline-flex;
  align-items: center;
  gap: var(--stellar-spacing-xs);
}

.stellar-source-icon {
  width: 14px;
  height: 14px;
}

.stellar-date {
  color: var(--stellar-gray);
}

/* ==========================================================================
   Navigation
   ========================================================================== */
.stellar-nav {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--stellar-bg-primary);
  box-shadow: var(--stellar-shadow-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
  color: var(--stellar-text-primary);
}

.stellar-nav:hover {
  background: var(--stellar-gray-6);
  transform: scale(1.05);
}

.stellar-nav:active {
  transform: scale(0.95);
}

.stellar-nav:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.stellar-nav svg {
  width: 20px;
  height: 20px;
}

/* ==========================================================================
   Pagination (Dots)
   ========================================================================== */
.stellar-pagination {
  display: flex;
  justify-content: center;
  gap: var(--stellar-spacing-sm);
  margin-top: var(--stellar-spacing-lg);
}

.stellar-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  background: var(--stellar-gray-4);
  cursor: pointer;
  padding: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.stellar-dot.active {
  background: var(--stellar-blue);
  transform: scale(1.25);
}

.stellar-dot:hover:not(.active) {
  background: var(--stellar-gray-2);
}

/* ==========================================================================
   Widget Compteur
   ========================================================================== */
.stellar-counter-widget {
  text-align: center;
  padding: var(--stellar-spacing-lg);
}

.stellar-counter-main {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: var(--stellar-spacing-sm);
  flex-wrap: wrap;
}

.stellar-counter-widget .stellar-counter-number {
  font-size: 2.5rem;
  font-weight: 700;
}

.stellar-counter-before,
.stellar-counter-after {
  font-size: 1.25rem;
  color: var(--stellar-text-secondary);
}

.stellar-counter-average {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--stellar-spacing-sm);
  margin-top: var(--stellar-spacing-md);
}

.stellar-average-value {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--stellar-text-primary);
}

/* ==========================================================================
   Glassmorphism
   ========================================================================== */
.stellar-card.glassmorphism {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.stellar-card.glassmorphism-dark {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
}

.stellar-card.glassmorphism-dark .stellar-author-name,
.stellar-card.glassmorphism-dark .stellar-content p {
  color: white;
}

.stellar-card.glassmorphism-dark .stellar-author-title,
.stellar-card.glassmorphism-dark .stellar-card-footer {
  color: rgba(255, 255, 255, 0.7);
}

/* ==========================================================================
   Hover Effects
   ========================================================================== */
.stellar-hover-elevation .stellar-card {
  transition:
    transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    box-shadow 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.stellar-hover-elevation .stellar-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.08),
    0 8px 16px rgba(0, 0, 0, 0.06);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1400px) {
  .stellar-card {
    flex: 0 0 calc(33.333% - 16px);
  }
}

@media (max-width: 1024px) {
  .stellar-card {
    flex: 0 0 calc(50% - 12px);
  }

  .stellar-carousel {
    padding: var(--stellar-spacing-md);
  }
}

@media (max-width: 768px) {
  .stellar-carousel-wrapper {
    flex-direction: column;
  }

  .stellar-nav {
    display: none;
  }

  .stellar-card {
    flex: 0 0 calc(100% - 40px);
    min-width: 260px;
  }

  .stellar-carousel-viewport {
    width: 100%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .stellar-carousel-viewport::-webkit-scrollbar {
    display: none;
  }

  .stellar-carousel-track {
    scroll-snap-align: start;
  }

  .stellar-card {
    scroll-snap-align: center;
  }

  .stellar-dot {
    width: 10px;
    height: 10px;
  }

  .stellar-card {
    padding: var(--stellar-spacing-md);
  }

  .stellar-counter-widget .stellar-counter-number {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  .stellar-card {
    flex: 0 0 100%;
    min-width: auto;
  }

  .stellar-header {
    margin-bottom: var(--stellar-spacing-lg);
  }

  .stellar-content p {
    font-size: 0.875rem;
  }
}

/* ==========================================================================
   Accessibilité
   ========================================================================== */
.stellar-nav:focus-visible,
.stellar-dot:focus-visible {
  outline: 2px solid var(--stellar-blue);
  outline-offset: 2px;
}

/* Screen reader only */
.stellar-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
