/* ============================
   Product Advisor – Front CSS
   ============================ */

:root {
  /* Colors */
  --pa-color-primary: #4f86f7;
  --pa-color-primary-strong: #1a7efb;
  --pa-color-accent: #009fe3;
  --pa-color-title: #1a1a2e;
  --pa-color-text: #2c3e50;
  --pa-color-text-muted: #666;
  --pa-color-muted: #888;
  --pa-color-white: #fff;
  --pa-color-indigo: #17016e;
  --pa-color-success: #28a745;
  --pa-color-danger: #dc3545;
  --pa-color-grey: #6c757d;
  --pa-color-track: #e9ecef;
  --pa-color-border: #dce6ff;
  --pa-color-tint: #e0e8ff;
  --pa-color-tint-strong: #f0f5ff;
  --pa-color-surface: #f0f4ff;
  --pa-color-scrollbar: #c5d0e8;
  --pa-color-scrollbar-hover: #a8b8e0;

  /* Typography */
  --pa-font-base: 'Tisa Sans Pro', sans-serif;

  /* Radius */
  --pa-radius-xs: 4px;
  --pa-radius-sm: 6px;
  --pa-radius-md: 10px;
  --pa-radius-lg: 12px;
  --pa-radius-xl: 14px;
  --pa-radius-pill: 50px;

  /* Shadows */
  --pa-shadow-card: 0 2px 8px rgba(0, 0, 0, 0.04);
  --pa-shadow-hover: 0 4px 16px rgba(79, 134, 247, 0.15);
  --pa-shadow-toast: 0 4px 20px rgba(26, 126, 251, 0.35);

  /* Transitions */
  --pa-transition-base: 0.18s ease;
}

/* Tisa Sans Pro */
@font-face {
  font-family: 'Tisa Sans Pro';
  src: url('../fonts/tisa-sans-pro-regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Tisa Sans Pro';
  src: url('../fonts/tisa-sans-pro-medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Tisa Sans Pro';
  src: url('../fonts/tisa-sans-pro-bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* Page wrapper */
.pa-page-wrapper {
  max-width: 820px;
  margin: 30px auto;
  padding: 0 15px;
  font-family: var(--pa-font-base);
}

/* Header */
.pa-header {
  text-align: center;
  margin-bottom: 30px;
}
.pa-page-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--pa-color-title);
}
.pa-page-desc {
  color: var(--pa-color-text-muted);
  font-size: 1rem;
}

/* Progress bar */
.pa-progress-bar {
  background: var(--pa-color-track);
  height: 6px;
  border-radius: var(--pa-radius-sm);
  overflow: hidden;
  margin-bottom: 28px;
}
.pa-progress-fill {
  background: linear-gradient(90deg, var(--pa-color-primary), var(--pa-color-primary-strong));
  height: 100%;
  width: 0;
  transition: width 0.4s ease;
}

/* Breadcrumb */
.pa-breadcrumb {
  font-size: 0.82rem;
  color: var(--pa-color-muted);
  margin-bottom: 18px;
}
.pa-breadcrumb span {
  margin: 0 5px;
}
.pa-breadcrumb span:first-child {
  margin-left: 0;
}

/* Loading */
.pa-loading {
  text-align: center;
  padding: 40px;
  color: var(--pa-color-muted);
}
.pa-spinner {
  width: 36px;
  height: 36px;
  border: 4px solid var(--pa-color-tint);
  border-top-color: var(--pa-color-primary);
  border-radius: 50%;
  animation: pa-spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes pa-spin {
  to { transform: rotate(360deg); }
}

/* Question zone */
.pa-question-zone {
  padding: 10px 0 30px;
}
.pa-question-text {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--pa-color-title);
  margin-bottom: 24px;
  line-height: 1.4;
}

.pa-question-image-wrap {
  margin-bottom: 20px;
  border-radius: var(--pa-radius-xl);
  overflow: hidden;
  max-height: 320px;
}
.pa-question-image-wrap img {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  display: block;
}

/* Answers grid */
.pa-answers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 560px) {
  .pa-answers-grid { grid-template-columns: 1fr; }
}
.pa-answer-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--pa-color-white);
  border: 2px solid var(--pa-color-border);
  border-radius: var(--pa-radius-lg);
  padding: 16px 20px;
  font-size: 1rem;
  color: var(--pa-color-text);
  cursor: pointer;
  transition: all var(--pa-transition-base);
  font-weight: 500;
  box-shadow: var(--pa-shadow-card);
}
.pa-answer-btn--with-img {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.pa-answer-img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}
.pa-answer-label {
  display: block;
  padding: 14px 18px;
}
.pa-answer-btn:hover {
  border-color: var(--pa-color-primary);
  background: var(--pa-color-tint-strong);
  color: var(--pa-color-primary-strong);
  transform: translateY(-2px);
  box-shadow: var(--pa-shadow-hover);
}
.pa-answer-btn:active {
  transform: translateY(0);
}

/* Result zone */
.pa-result-zone {
  padding: 10px 0 30px;
}
.pa-result-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.pa-result-header h3 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--pa-color-title);
  margin: 0;
}

/* Products grid — scroll horizontal si trop de produits */
.pa-products-grid {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 12px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.pa-products-grid::-webkit-scrollbar {
  height: 8px;
}
.pa-products-grid::-webkit-scrollbar-track {
  background: var(--pa-color-surface);
  border-radius: var(--pa-radius-xs);
}
.pa-products-grid::-webkit-scrollbar-thumb {
  background: var(--pa-color-scrollbar);
  border-radius: var(--pa-radius-xs);
}
.pa-products-grid::-webkit-scrollbar-thumb:hover {
  background: var(--pa-color-scrollbar-hover);
}

/* Result products use the native theme miniature (.minty-product-miniature).
   Only the carousel sizing is applied here; the card design comes from the theme. */
.pa-products-grid > .minty-product-miniature {
  flex: 0 0 240px;
  width: 240px;
  scroll-snap-align: start;
}
@media (max-width: 700px) {
  .pa-products-grid > .minty-product-miniature { flex-basis: 200px; width: 200px; }
}
@media (max-width: 480px) {
  .pa-products-grid > .minty-product-miniature {
    flex-basis: calc((100vw - 30px - 12px) / 2);
    width: calc((100vw - 30px - 12px) / 2);
  }
}

/* Product card — design autonome, ne depend d'aucune classe du theme */
.pa-product-card {
  flex: 0 0 240px;
  width: 240px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
}
@media (max-width: 700px) {
  .pa-product-card { flex-basis: 200px; width: 200px; }
}
@media (max-width: 480px) {
  /* 2 cartes visibles d'office, le reste accessible par scroll horizontal */
  .pa-product-card { flex-basis: calc((100vw - 30px - 12px) / 2); width: calc((100vw - 30px - 12px) / 2); }
  .pa-products-grid { gap: 12px; }
}

.pa-product-card__image-link {
  display: block;
  background: var(--pa-color-surface);
  border-radius: var(--pa-radius-md);
  overflow: hidden;
}
.pa-product-card__image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}
.pa-product-img-placeholder {
  width: 100%;
  aspect-ratio: 1;
  background: var(--pa-color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pa-product-card__footer {
  margin-top: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.pa-product-card__title {
  margin: 0 0 6px;
  font-size: 0.95rem;
  line-height: 1.3;
  min-height: 2.6em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pa-product-card__title a {
  color: var(--pa-color-indigo);
  font-weight: 700;
  text-decoration: none;
}
.pa-product-card__price {
  margin: 0 0 12px;
  font-size: 1rem;
  color: var(--pa-color-accent);
  font-weight: 700;
}
.pa-product-card .pa-btn-cart {
  margin-top: auto;
}

.pa-btn-cart {
  width: 100%;
  padding: 14px 20px;
  background: var(--pa-color-accent);
  color: var(--pa-color-white);
  border: none;
  border-radius: var(--pa-radius-pill);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: opacity 0.18s, transform 0.12s;
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.pa-btn-cart::after {
  content: '';
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .25);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='21' r='1'/%3E%3Ccircle cx='20' cy='21' r='1'/%3E%3Cpath d='M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px;
  flex-shrink: 0;
}
.pa-btn-cart:hover { opacity: 0.92; transform: translateY(-1px); }
.pa-btn-cart:active { transform: translateY(0); }
.pa-btn-cart.loading {
  opacity: 0.6;
  cursor: not-allowed;
}
.pa-btn-cart.added {
  background: var(--pa-color-grey);
}

/* Restart */
.pa-result-actions {
  margin-top: 28px;
  text-align: center;
}
.pa-btn-restart {
  padding: 10px 28px;
  border-radius: var(--pa-radius-pill);
  font-weight: 600;
}

/* Hook link */
.pa-quiz-link-block {
  margin: 15px 0;
}
.pa-quiz-link-btn {
  border-radius: var(--pa-radius-pill);
  padding: 8px 20px;
  font-weight: 600;
}
.pa-quiz-link-icon {
  margin-right: 4px;
}

/* Toast notification */
.pa-toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--pa-color-primary-strong);
  color: var(--pa-color-white);
  padding: 12px 22px;
  border-radius: var(--pa-radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  z-index: 9999;
  box-shadow: var(--pa-shadow-toast);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}
.pa-toast.show {
  opacity: 1;
  transform: translateY(0);
}
.pa-toast.success { background: var(--pa-color-success); }
.pa-toast.error   { background: var(--pa-color-danger); }
