/**
 * KineticUltra — Kinetic Command "Comparateur" — extras.
 * Carousel of related units, fixed action bar, empty page state, responsive.
 * Loaded after kinetic-compare.css.
 */

/* ---------- Carousel: Other units ---------- */
.k-compare__related { margin-top: 6rem; }
.k-compare__related-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}
.k-compare__related-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.5rem, 2.6vw, 2.25rem);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--k-text);
  margin: 0;
}
.k-compare__related-nav { display: flex; gap: 0.5rem; }
.k-compare__related-nav-btn {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--k-muted);
  background: transparent;
  border: 0; cursor: pointer;
  transition: color 200ms, box-shadow 200ms, background 200ms;
}
.k-compare__related-nav-btn:hover {
  color: var(--k-cyan);
  background: rgba(0,212,255,0.06);
  box-shadow: inset 0 0 0 1px rgba(0,212,255,0.15);
}
/* Keen-slider handles display:flex + overflow on .keen-slider */
.k-compare__related-slider {
  margin: 0;
  padding: 0;
}
.k-compare__related-slide {
  /* Give each slide a minimum height so short cards don't collapse */
  display: flex;
  flex-direction: column;
}
.k-compare__related-slide .k-prod-card {
  width: 100%;
  height: 100%;
}
/* Disabled state for nav buttons */
.k-compare__related-nav-btn:disabled,
.k-compare__related-nav-btn[aria-disabled="true"] {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

/* ---------- Fixed bottom action bar ---------- */
.k-compare__action-bar {
  position: fixed;
  bottom: 1.5rem;
  left: clamp(1.5rem, 3vw, 4rem);
  right: clamp(1.5rem, 3vw, 4rem);
  z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 1.5rem 1rem 2rem;
  background: rgba(var(--k-glass-rgb), 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: 9999px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.55);
}
.k-compare__action-left { display: flex; align-items: center; gap: 1rem; }
.k-compare__action-stack { display: flex; align-items: center; }
.k-compare__action-stack img,
.k-compare__action-stack .k-compare__action-thumb {
  flex-shrink: 0;
  /* max-width:100% from global img reset overrides width — neutralise it */
  width: 40px !important; max-width: 40px !important;
  height: 40px !important; min-height: 40px;
  border-radius: 50% !important;
  object-fit: cover;
  background: var(--k-surface-2);
  outline: 2px solid var(--k-surface);
  margin-right: -10px;
  display: block;
  overflow: hidden;
}
.k-compare__action-divider {
  width: 1px; height: 32px;
  background: rgba(232,232,237,0.10);
  margin: 0 0.5rem;
}
.k-compare__action-favorite {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--k-muted);
  display: inline-flex; align-items: center; gap: 0.6rem;
}
.k-compare__action-favorite-pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--k-green);
  box-shadow: 0 0 12px var(--k-green);
  animation: k-compare-pulse 1.6s ease-in-out infinite;
}
@keyframes k-compare-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}
.k-compare__action-favorite strong { color: var(--k-cyan); font-weight: 700; }
.k-compare__action-right { display: flex; align-items: center; gap: 1.5rem; }
.k-compare__action-secondary {
  display: inline-flex; align-items: center;
  white-space: nowrap;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--k-muted);
  background: transparent;
  border: 0; cursor: pointer;
  padding: 0.5rem 0;
  transition: color 200ms;
  text-decoration: none;
  line-height: 1;
}
.k-compare__action-secondary:hover { color: var(--k-text); }
.k-compare__action-primary {
  display: inline-flex !important; align-items: center; gap: 0.5rem;
  padding: 0 2rem !important;
  height: 48px !important;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--k-background) !important;
  background: var(--k-cyan) !important;
  border: 0 !important;
  border-radius: 9999px !important;
  margin: 0 !important;
  cursor: pointer;
  box-shadow: 0 0 24px rgba(0,212,255,0.35);
  transition: transform 200ms;
  white-space: nowrap;
  line-height: 1;
}
.k-compare__action-primary:hover { transform: translateY(-1px); }
.k-compare__action-primary:active { transform: translateY(0); }

/* ---------- Empty page state (no products yet) ---------- */
.k-compare__empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem;
  min-height: 50vh;
  padding: 3rem 1rem;
  text-align: center;
}
.k-compare__empty-state-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--k-text);
  margin: 0;
}
.k-compare__empty-state-desc {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  color: var(--k-muted);
  max-width: 48ch;
}
.k-compare__empty-state-cta {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.85rem 2rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--k-background);
  background: var(--k-cyan);
  text-decoration: none;
  transition: box-shadow 200ms;
}
.k-compare__empty-state-cta:hover { box-shadow: 0 0 24px rgba(0,212,255,0.4); }

/* ---------- Mobile add-product CTA (replaces hidden empty slot on narrow viewports) ---------- */
.k-compare__add-cta {
  display: none; /* shown only inside the mobile breakpoint below */
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .k-compare__hero { grid-template-columns: 1fr; }
  .k-compare__hero-stat { min-width: 0; }
  .k-compare__col--empty { display: none; }
  .k-compare__action-bar { padding: 0.75rem 1.25rem; }
  .k-compare__action-secondary { display: none; }

  /* Rail toggle becomes visible. Default state below 1100px = collapsed
     (rail hidden) so the product columns reclaim horizontal real-estate.
     The user opts back in via the toggle button (.is-rail-expanded). */
  .k-compare__rail-toggle { display: inline-flex; }
  .k-compare__rail { display: none; }
  .k-compare__grid {
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    overflow-x: auto;
  }
  .k-compare.is-rail-expanded .k-compare__rail { display: block; }
  .k-compare.is-rail-expanded .k-compare__grid {
    grid-template-columns: 200px repeat(3, minmax(220px, 1fr));
  }

  /* Full-width add-product banner — replaces the column-slot that is now hidden */
  .k-compare__add-cta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem 1.25rem;
    background: rgba(var(--k-glass-rgb), 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px dashed rgba(0,212,255,0.28);
    border-radius: 12px;
    text-decoration: none;
    color: var(--k-text);
    transition: border-color 200ms, transform 200ms, box-shadow 200ms;
  }
  .k-compare__add-cta:hover {
    border-color: rgba(0,212,255,0.6);
    box-shadow: 0 0 20px rgba(0,212,255,0.1);
    transform: translateY(-1px);
  }
  .k-compare__add-cta-icon {
    flex-shrink: 0;
    width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    border: 1px dashed rgba(0,212,255,0.4);
    color: var(--k-cyan);
  }
  .k-compare__add-cta-body {
    flex: 1 1 0;
    display: flex; flex-direction: column; gap: 0.2rem;
  }
  .k-compare__add-cta-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--k-text);
  }
  .k-compare__add-cta-meta {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    color: var(--k-muted);
  }
  .k-compare__add-cta-chevron {
    flex-shrink: 0;
    color: var(--k-cyan);
    opacity: 0.7;
    transition: opacity 200ms, transform 200ms;
  }
  .k-compare__add-cta:hover .k-compare__add-cta-chevron {
    opacity: 1;
    transform: translateX(3px);
  }
}
@media (max-width: 720px) {
  .k-compare { padding-bottom: 8rem; }
  .k-compare__grid { grid-template-columns: repeat(2, minmax(200px, 1fr)); }
  .k-compare.is-rail-expanded .k-compare__grid {
    grid-template-columns: 160px repeat(2, minmax(200px, 1fr));
  }
  .k-compare__action-bar { left: 1rem; right: 1rem; border-radius: 16px; }
  .k-compare__action-favorite { display: none; }
}

/* ───────── Hero action buttons states + Toast (compare-actions.js) ───────── */
.k-compare__hero-action[disabled] {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
}

.k-compare__toast {
  position: fixed;
  left: 50%;
  bottom: 6rem;
  transform: translate(-50%, 20px);
  z-index: 9999;
  padding: .75rem 1.25rem;
  border-radius: 10px;
  background: rgba(20, 22, 32, .92);
  backdrop-filter: blur(16px);
  color: #f9f5fd;
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  letter-spacing: .01em;
  box-shadow: 0 0 30px rgba(0, 0, 0, .35);
  opacity: 0;
  transition: opacity .22s ease, transform .22s ease;
  pointer-events: none;
  max-width: min(420px, calc(100vw - 2rem));
  text-align: center;
}
.k-compare__toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.k-compare__toast--success { box-shadow: 0 0 30px rgba(0, 255, 136, .25), inset 0 0 0 1px rgba(0, 255, 136, .35); }
.k-compare__toast--error   { box-shadow: 0 0 30px rgba(255, 59, 92, .25), inset 0 0 0 1px rgba(255, 59, 92, .35); }
.k-compare__toast--info    { box-shadow: 0 0 30px rgba(0, 212, 255, .25), inset 0 0 0 1px rgba(0, 212, 255, .35); }

html[data-theme="light"] .k-compare__toast {
  background: rgba(255, 255, 255, .96);
  color: #0d0f15;
}
