/**
 * Page avis clients — styles calqués sur Société des Avis Garantis
 * (ag-design-system + ag-certificate), étoiles ★ comme le dépôt d'avis.
 */

:root {
  --ag-bg: #fafbfc;
  --ag-surface: #ffffff;
  --ag-border: #ececf0;
  --ag-border-strong: #d9d9e0;
  --ag-text: #111827;
  --ag-text-muted: #6b7280;
  --ag-text-soft: #9ca3af;
  --ag-accent: #175298;
  --ag-accent-soft: #eaf1fb;
  --ag-accent-strong: #103b70;
  --ag-success: #10b981;
  --ag-warning: #f59e0b;
  --ag-radius: 14px;
  --ag-radius-sm: 10px;
  --ag-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  --ag-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* Étoiles dépôt d'avis (caractère ★) — teinte proche SAG */
  --up-star: #f5c518;
  --up-star-empty: #d8d4cc;
}

body.up-standalone {
  margin: 0;
  min-height: 100vh;
  background: var(--ag-bg);
  color: var(--ag-text);
  font-family: var(--ag-font);
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

body.up-standalone *,
body.up-standalone *::before,
body.up-standalone *::after {
  box-sizing: border-box;
}

body.up-standalone a {
  color: var(--ag-accent);
}

body.up-standalone img {
  max-width: 100%;
  height: auto;
}

/* Shell */
.agc-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 16px 60px;
  background: var(--ag-bg);
}

.ag-dash {
  font-family: var(--ag-font);
  color: var(--ag-text);
  padding-top: 0;
  min-height: calc(100vh - 80px);
}

.ag-card {
  background: var(--ag-surface);
  border: 1px solid var(--ag-border);
  border-radius: var(--ag-radius);
  padding: 18px 24px 20px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-shadow: var(--ag-shadow);
}

.agc-col-main > .ag-card,
.agc-col-side > .ag-card {
  width: 100%;
}

/* Top brand bar (légère, hors SAG strict) */
.up-reviews-brandbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 12px 0 18px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--ag-border);
}
.up-reviews-brandbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 20px;
  color: var(--ag-accent);
  text-decoration: none;
}
.up-reviews-brandbar__brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}
.up-reviews-brandbar__logo {
  max-height: 40px;
  max-width: 150px;
  object-fit: contain;
}

/* Header */
.ag-header,
.agc-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 30px;
}

.agc-header .ag-header-title {
  flex: 1 1 auto;
}

.agc-header .ag-header-title h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0;
  color: var(--ag-text);
}

.up-reviews-brandbar .agc-header-brand-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex: 0 0 auto;
  margin-left: auto;
}

.agc-header-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ag-surface);
  border: 1px solid var(--ag-border);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ag-text-muted);
  white-space: nowrap;
}

.agc-header-brand__icon {
  color: var(--ag-success);
  font-size: 17px;
  line-height: 1;
}

.agc-header-brand__more {
  font-size: 12px;
  font-weight: 600;
  color: var(--ag-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.agc-header-brand__more:hover {
  color: var(--ag-accent-strong);
}

/* Colonnes */
.agc-cols {
  display: flex;
  align-items: flex-start;
  gap: 18px;
}

.agc-col-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.agc-col-side {
  flex: 0 0 340px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Synthèse */
.agc-summary {
  gap: 24px;
  padding: 24px;
}

.agc-summary-top {
  display: flex;
  align-items: stretch;
  gap: 36px;
}

.agc-score {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 12px;
  flex: 0 0 auto;
}

.agc-score-main {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.agc-score-num {
  font-size: 46px;
  font-weight: 700;
  letter-spacing: -1.2px;
  color: var(--ag-text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.agc-score-scale {
  font-size: 18px;
  font-weight: 500;
  color: var(--ag-text-muted);
}

.agc-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;
}

.agc-stars {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--up-star-empty);
  line-height: 1;
}

.agc-stars .up-star--full,
.agc-stars .up-star--half {
  color: var(--up-star);
}

.agc-stars-lg { font-size: 26px; }
.agc-stars-sm { font-size: 15px; }

.agc-count {
  font-size: 13px;
  color: var(--ag-text-muted);
}

.agc-ratingbars {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.agc-ratingbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 8px;
  border-radius: var(--ag-radius-sm);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.agc-ratingbar:hover {
  background: var(--ag-bg);
  text-decoration: none;
  color: inherit;
}

.agc-ratingbar.is-active {
  background: var(--ag-accent-soft);
}

.agc-ratingbar.is-active .agc-ratingbar-star,
.agc-ratingbar.is-active .agc-ratingbar-count {
  color: var(--ag-accent);
  font-weight: bold;
}

.agc-ratingbar-star {
  flex: 0 0 44px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ag-text-muted);
}

.agc-ratingbar-star .up-star {
  font-size: 11px;
  color: var(--up-star);
  line-height: 1;
}

.agc-ratingbar-track {
  flex: 1 1 auto;
  height: 8px;
  background: var(--ag-border);
  border-radius: 999px;
  overflow: hidden;
}

.agc-ratingbar-fill {
  display: block;
  height: 100%;
  background: var(--up-star);
  border-radius: 999px;
}

.agc-ratingbar-count {
  position: relative;
  flex: 0 0 48px;
  text-align: right;
  font-size: 12.5px;
  color: var(--ag-text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.agc-ratingbar-num,
.agc-ratingbar-pct {
  display: block;
  transition: opacity 0.25s ease;
}

.agc-ratingbar-pct {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.agc-ratingbars:hover .agc-ratingbar-num { opacity: 0; }
.agc-ratingbars:hover .agc-ratingbar-pct { opacity: 1; }

/* Identité */
.agc-identity {
  align-items: flex-start;
  position: relative;
}

.agc-identity > a:has(.agc-identity-logo) {
  display: block;
  width: 100%;
  text-align: center;
  margin-bottom: 14px;
}

.agc-identity-logo {
  display: block;
  max-width: 50% !important;
  width: auto;
  height: auto;
  max-height: 80px;
  object-fit: contain;
  margin: 0 auto 14px;
}

.agc-identity > a:has(.agc-identity-logo) .agc-identity-logo {
  margin-bottom: 0;
}

.agc-identity-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--ag-text);
  margin-bottom: 6px;
}

.agc-identity-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--ag-text-muted);
  padding: 6px 0;
  line-height: 1.4;
}

.agc-identity-row__icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-top: 0;
  color: var(--ag-accent);
  opacity: 0.9;
}

.agc-identity-row__icon svg {
  display: block;
}

.agc-identity-row a {
  color: var(--ag-accent);
  text-decoration: none;
  word-break: break-word;
}

.agc-identity-row a:hover {
  text-decoration: underline;
}

.agc-legal {
  color: #856404;
  background-color: #fff3cd;
  border-color: #ffeeba;
  font-size: 11px;
  margin: 0;
  text-align: justify;
  padding: 0.2rem 1.2rem;
}

.agc-card-heading {
  font-size: 14px;
  font-weight: 700;
  color: var(--ag-text);
  margin: 0 0 8px;
}

.agc-side-note {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ag-text-muted);
  margin: 0;
}

/* Liste avis */
.agc-reviews-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.agc-reviews-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ag-text);
  margin: 0;
}

.agc-reviews-reset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ag-text-muted);
  text-decoration: none;
  background: #fff;
  border: 1px solid var(--ag-border);
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.agc-reviews-reset:hover {
  color: var(--ag-accent);
  border-color: var(--ag-accent);
  text-decoration: none;
}

.agc-review-list {
  display: flex;
  flex-direction: column;
}

.agc-review {
  padding: 22px 0;
  border-top: 1px solid var(--ag-border);
}

.agc-review-list .agc-review:first-child {
  border-top: none;
  padding-top: 4px;
}

.agc-review-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.agc-review-ident {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
}

.agc-avatar {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--ag-accent-soft);
  color: var(--ag-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
}

.agc-review-id {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
}

.agc-review-author {
  font-size: 14px;
  font-weight: 600;
  color: var(--ag-text);
}

/* Badge « Avis vérifié » */
.agc-verified-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
}

.agc-verified-label__icon {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  display: block;
}

.agc-verified-label__text {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  color: #38875C;
  white-space: nowrap;
}

/* Desktop : sous « suite à un achat du » (colonne meta) */
.agc-verified-label--desktop {
  margin-top: 6px;
  justify-content: flex-end;
}

.agc-verified-label--mobile {
  display: none;
}

.agc-review-meta {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
  text-align: right;
}

.agc-review-date,
.agc-review-order {
  font-size: 12px;
  color: var(--ag-text-soft);
  white-space: nowrap;
}

.agc-review-body {
  font-size: 14px;
  line-height: 1.65;
  color: var(--ag-text);
  margin-left: 50px;
}

.agc-reviews-empty {
  display: block;
  text-align: center;
  padding: 40px 20px;
  color: var(--ag-text-soft);
  font-size: 14px;
}

.agc-answer {
  margin: 14px 0 0 50px;
  padding: 12px 16px;
  background: var(--ag-bg);
  border-left: 3px solid var(--ag-accent);
  border-radius: 0 var(--ag-radius-sm) var(--ag-radius-sm) 0;
}

.agc-answer-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.agc-answer-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ag-accent);
}

.agc-answer-body {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ag-text-muted);
}

/* Pagination SAG */
.agc-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--ag-border);
}

.agc-page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--ag-border);
  background: var(--ag-surface);
  color: var(--ag-text-muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
}

a.agc-page-link:hover {
  border-color: var(--ag-border-strong);
  color: var(--ag-text) !important;
  text-decoration: none;
}

.agc-page-link.is-current {
  background: #9b9b9b;
  border-color: #9b9b9b;
  color: #fff;
}

.agc-page-link.is-current:hover {
  color: #fff !important;
}

span.agc-page-link {
  border: 0;
  background: transparent;
  min-width: 18px;
  padding: 0 4px;
  color: var(--ag-text-soft);
  cursor: default;
}

/* Responsive */
@media (max-width: 992px) {
  .agc-summary-top {
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
  }

  .agc-score {
    align-items: center;
    text-align: center;
  }

  .agc-cols {
    flex-direction: column;
  }

  .agc-col-side {
    flex-basis: auto;
    width: 100%;
  }
}

@media (max-width: 600px) {
  .agc-shell {
    padding: 10px 16px 40px;
  }

  .agc-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .up-reviews-brandbar {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .up-reviews-brandbar .agc-header-brand-wrap {
    align-items: flex-end;
  }

  .agc-header-brand {
    font-size: 12px;
    padding: 4px 8px;
  }

  .agc-header-brand__more {
    font-size: 11px;
  }

  .agc-header .ag-header-title {
    width: 100%;
    text-align: center;
  }

  .agc-header .ag-header-title h1 {
    font-size: 24px;
  }

  .agc-score-num {
    font-size: 38px;
  }

  .agc-review-body,
  .agc-answer {
    margin-left: 0;
  }

  .agc-review {
    display: flex;
    flex-direction: column;
  }

  .agc-review-head {
    display: contents;
  }

  .agc-review-ident {
    order: 1;
    margin-bottom: 12px;
    width: 100%;
    align-items: center;
  }

  /* Mobile : logo seul à droite de agc-review-id */
  .agc-verified-label--desktop {
    display: none;
  }

  .agc-verified-label--mobile {
    display: inline-flex;
    flex: 0 0 auto;
    margin-left: auto;
    padding-left: 8px;
  }

  .agc-verified-label--mobile .agc-verified-label__icon {
    width: 18px;
    height: 18px;
  }

  .agc-review-body {
    order: 2;
  }

  .agc-review-meta {
    order: 3;
    width: 100%;
    margin-top: 10px;
    align-items: flex-start;
    text-align: left;
  }

  .agc-review .agc-answer {
    order: 4;
  }
}
