/* ==========================================================================
   Imortis product detail page (v2)
   Styles for templates/shop/product_detail.html. Depends on the --hp-* tokens
   and shared section/card/button classes in home-v2.css (load that first).
   Prefix: pd- (product detail).
   ========================================================================== */

.pd-crumbs {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.875rem;
  color: var(--hp-text-2);
  padding-top: 1.75rem;
}

.pd-crumbs a {
  color: var(--hp-text-2);
  transition: color 0.2s ease;
}

.pd-crumbs a:hover {
  color: var(--hp-text);
}

.pd-crumbs span[aria-current] {
  color: var(--hp-text);
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Product hero: gallery + info
   -------------------------------------------------------------------------- */
.pd-hero {
  display: grid;
  grid-template-columns: minmax(0, 560px) minmax(0, 1fr);
  gap: 4rem;
  align-items: start;
  padding: 2rem 0 5rem 0;
}

.pd-gallery {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pd-gallery__main {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--hp-radius);
  overflow: hidden;
  background: var(--hp-bg-muted);
  border: 1px solid var(--hp-border-soft);
  cursor: zoom-in;
}

.pd-gallery__main .main-image-link {
  display: block;
  width: 100%;
  height: 100%;
}

.pd-gallery__main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s var(--hp-ease), opacity 0.2s ease;
}

.pd-gallery__main:hover img {
  transform: scale(1.03);
}

.image-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--hp-bg-muted);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.image-zoom-icon {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.pd-gallery__main:hover .image-zoom-icon {
  opacity: 1;
}

.pd-thumbs {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.pd-thumbs .thumbnail {
  width: 100px;
  height: 100px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--hp-border-soft);
  background: var(--hp-bg-muted);
  box-sizing: border-box;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.pd-thumbs .thumbnail:hover {
  border-color: var(--hp-accent-light);
}

.pd-thumbs .thumbnail.active {
  border-color: var(--hp-accent);
}

.pd-thumbs .thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pd-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--hp-text-2);
}

/* Info column */
.pd-info {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.pd-title {
  font-family: var(--hp-font-display);
  font-size: 2.75rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--hp-text);
  text-wrap: balance;
}

.pd-tagline {
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--hp-text-2);
  text-wrap: pretty;
}

.pd-price {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-top: 0.25rem;
}

.pd-price__current {
  font-family: var(--hp-font-display);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--hp-text);
}

.pd-price__vat {
  font-size: 0.875rem;
  color: var(--hp-text-2);
}

.pd-price__original {
  font-size: 1.25rem;
  color: var(--hp-text-2);
  text-decoration: line-through;
}

.pd-price__badge {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffffff;
  background: var(--hp-accent);
  border-radius: 50px;
  padding: 0.3rem 0.7rem;
}

.pd-delivery {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.95rem;
  color: var(--hp-text);
}

.pd-delivery svg {
  flex-shrink: 0;
  color: var(--hp-accent);
}

.pd-description,
.pd-description p {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--hp-text-2);
}

.pd-description p + p {
  margin-top: 0.75rem;
}

.pd-specs {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  font-size: 0.95rem;
  color: var(--hp-text);
}

.pd-specs li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.pd-specs svg {
  flex-shrink: 0;
  color: var(--hp-accent);
  margin-top: 0.15rem;
}

.pd-specs strong {
  font-weight: 700;
}

.pd-spec-table {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.5rem 1.5rem;
  font-size: 0.95rem;
}

.pd-spec-table dt {
  color: var(--hp-text-2);
}

.pd-spec-table dd {
  margin: 0;
  color: var(--hp-text);
  font-weight: 500;
}

/* Buy form */
.pd-buy {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  padding-top: 0.5rem;
}

.pd-qty {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.pd-qty__label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hp-text-2);
}

.pd-qty__controls {
  display: flex;
  align-items: center;
  height: 56px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 50px;
  overflow: hidden;
  background: var(--hp-surface);
}

[data-theme="dark"] .pd-qty__controls {
  border-color: rgba(255, 255, 255, 0.14);
}

.pd-qty__btn {
  width: 52px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--hp-text);
  cursor: pointer;
  transition: background 0.2s ease;
}

.pd-qty__btn:hover {
  background: var(--hp-bg-muted);
}

.pd-qty__btn:focus-visible {
  outline: 2px solid var(--hp-accent);
  outline-offset: -2px;
}

.pd-qty__input {
  width: 56px;
  height: 56px;
  border: none;
  border-left: 1px solid var(--hp-border);
  border-right: 1px solid var(--hp-border);
  background: transparent;
  text-align: center;
  font-family: var(--hp-font-body);
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--hp-text);
  -moz-appearance: textfield;
  appearance: textfield;
}

.pd-qty__input::-webkit-outer-spin-button,
.pd-qty__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.pd-qty__input:focus {
  outline: none;
  background: var(--hp-bg-muted);
}

.add-to-cart-button {
  flex-grow: 1;
  height: 56px;
  position: relative;
  overflow: hidden;
  border: none;
  font-family: var(--hp-font-body);
  cursor: pointer;
  gap: 0.625rem;
}

.add-to-cart-button:disabled {
  background: var(--hp-bg-muted);
  color: var(--hp-text-2);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.add-to-cart-button .button-text {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  transition: transform 0.3s ease;
}

.add-to-cart-button.adding .button-text {
  transform: translateY(-160%);
}

.add-to-cart-button .loading-text {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  transition: transform 0.3s ease;
}

.add-to-cart-button.adding .loading-text {
  transform: translateY(-100%);
}

.add-to-cart-button .loading-text i {
  animation: pd-spin 1s linear infinite;
}

@keyframes pd-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Trust strip */
.pd-trust {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--hp-border);
}

.pd-trust__item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.875rem;
  color: var(--hp-text);
}

.pd-trust__item svg {
  flex-shrink: 0;
  color: var(--hp-primary-light);
}

[data-theme="dark"] .pd-trust__item svg {
  color: var(--hp-accent-light);
}

.pd-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  font-size: 0.875rem;
  color: var(--hp-text-2);
}

.pd-meta a {
  color: var(--hp-accent);
}

/* --------------------------------------------------------------------------
   Sales sections reuse .hp-section / .hp-steps / .hp-cards from home-v2.css.
   Product-specific extras below.
   -------------------------------------------------------------------------- */
.pd-benefits {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  align-items: stretch;
}

.pd-benefit {
  background: var(--hp-surface);
  border: 1px solid var(--hp-border);
  border-radius: var(--hp-radius);
  padding: 2rem;
  box-shadow: var(--hp-shadow-sm);
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  transition: all 0.3s var(--hp-ease);
}

.pd-benefit:hover {
  transform: translateY(-6px);
  box-shadow: var(--hp-shadow-lg);
  border-color: var(--hp-accent);
}

.pd-benefit__icon {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--hp-icon-fill);
  color: var(--hp-icon-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--hp-icon-shadow);
}

.pd-benefit__body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pd-benefit__body h3 {
  font-family: var(--hp-font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--hp-text);
}

.pd-benefit__body p {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--hp-text-2);
}

/* Delivery and warranty info blocks (from product fields) */
.pd-info-blocks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.pd-info-block {
  background: var(--hp-surface);
  border: 1px solid var(--hp-border);
  border-radius: var(--hp-radius-sm);
  padding: 1.5rem;
}

.pd-info-block h3 {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-family: var(--hp-font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--hp-text);
  margin-bottom: 0.75rem;
}

.pd-info-block h3 svg {
  color: var(--hp-accent);
}

.pd-info-block,
.pd-info-block p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--hp-text-2);
}

/* Order band */
.pd-band {
  background: var(--hp-dark-band);
  padding: 3rem 0;
  border-top: 1px solid rgba(224, 218, 210, 0.1);
}

.pd-band__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.pd-band__product {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.pd-band__thumb {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--hp-bg-muted);
  flex-shrink: 0;
}

.pd-band__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pd-band__name {
  font-family: var(--hp-font-display);
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--hp-dark-text);
}

.pd-band__note {
  font-size: 0.875rem;
  color: rgba(224, 218, 210, 0.7);
}

.pd-band__cta {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.pd-band__price {
  font-family: var(--hp-font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--hp-dark-text);
}

.pd-band .hp-btn {
  border: none;
  font-family: var(--hp-font-body);
  cursor: pointer;
  gap: 0.625rem;
  padding: 1.125rem 2.5rem;
}

/* Related products */
.pd-related {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem;
}

.pd-related__card {
  background: var(--hp-surface);
  border: 1px solid var(--hp-border);
  border-radius: var(--hp-radius-sm);
  overflow: hidden;
  display: block;
  color: var(--hp-text);
  transition: all 0.3s var(--hp-ease);
}

.pd-related__card:hover {
  transform: translateY(-5px);
  box-shadow: var(--hp-shadow-lg);
  border-color: var(--hp-accent);
  color: var(--hp-text);
}

.pd-related__image {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--hp-bg-muted);
  overflow: hidden;
}

.pd-related__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s var(--hp-ease);
}

.pd-related__card:hover .pd-related__image img {
  transform: scale(1.05);
}

.pd-related__badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #ffffff;
  background: var(--hp-accent);
  border-radius: 50px;
  padding: 0.25rem 0.625rem;
}

.pd-related__body {
  padding: 1rem 1.25rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.pd-related__title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--hp-text);
}

.pd-related__price {
  font-family: var(--hp-font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--hp-text);
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.pd-related__price s {
  font-family: var(--hp-font-body);
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--hp-text-2);
}

/* --------------------------------------------------------------------------
   Sticky buy bar (phones only; toggled by the page script)
   -------------------------------------------------------------------------- */
.pd-stickybar {
  display: none;
}

/* --------------------------------------------------------------------------
   Add-to-cart success modal and toasts (created by the page script)
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-backdrop.visible {
  opacity: 1;
}

.add-to-cart-success {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 480px;
  background: var(--hp-surface);
  border: 1px solid var(--hp-border);
  border-radius: var(--hp-radius);
  padding: 2rem;
  box-shadow: var(--hp-shadow-xl);
  z-index: 9999;
  opacity: 0;
  font-family: var(--hp-font-body);
  animation: pd-fade-in-scale 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.add-to-cart-success.visible {
  opacity: 1;
}

@keyframes pd-fade-in-scale {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.success-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--hp-icon-fill);
  color: var(--hp-icon-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  transform: scale(0);
  animation: pd-scale-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes pd-scale-in {
  0% { transform: scale(0); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.success-title {
  font-family: var(--hp-font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--hp-text);
  margin: 0;
}

.success-actions {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.view-cart-btn,
.continue-shopping-btn {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 1rem;
  border-radius: 50px;
  font-family: var(--hp-font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s var(--hp-ease);
  text-decoration: none;
}

.view-cart-btn {
  background: var(--hp-accent);
  color: #ffffff !important;
  border: none;
}

.view-cart-btn:hover {
  background: var(--hp-accent-dark);
  transform: translateY(-2px);
}

.continue-shopping-btn {
  background: transparent;
  color: var(--hp-text) !important;
  border: 1px solid var(--hp-border);
}

.continue-shopping-btn:hover {
  border-color: var(--hp-accent);
  transform: translateY(-2px);
}

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  min-width: 300px;
  max-width: 400px;
  background: var(--hp-surface);
  border: 1px solid var(--hp-border);
  border-radius: var(--hp-radius-sm);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--hp-shadow-lg);
  z-index: 9999;
  font-family: var(--hp-font-body);
  transition: opacity 0.3s ease, transform 0.3s ease;
  animation: pd-slide-in 0.3s ease-out forwards;
}

@keyframes pd-slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--hp-text);
  font-size: 0.9rem;
}

.toast-content i {
  font-size: 1.25rem;
}

.toast.success .toast-content i {
  color: #22c55e;
}

.toast.error .toast-content i {
  color: #ef4444;
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--hp-text-2);
  cursor: pointer;
  padding: 0.25rem;
  margin-left: 0.5rem;
  border-radius: 8px;
}

.toast-close:hover {
  color: var(--hp-text);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .pd-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 2.5rem;
  }

  .pd-gallery {
    max-width: 560px;
  }

  .pd-benefits {
    gap: 1rem;
  }

  .pd-related {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .pd-crumbs {
    padding-top: 1rem;
    font-size: 0.8125rem;
  }

  .pd-hero {
    padding: 1rem 0 2.5rem 0;
    gap: 1.5rem;
  }

  .pd-gallery {
    max-width: none;
    gap: 0.75rem;
  }

  .pd-gallery__main {
    border-radius: 20px;
  }

  .pd-thumbs {
    gap: 0.625rem;
  }

  .pd-thumbs .thumbnail {
    width: 72px;
    height: 72px;
  }

  .pd-info {
    gap: 1rem;
  }

  .pd-title {
    font-size: 1.875rem;
  }

  .pd-tagline {
    font-size: 1rem;
  }

  .pd-price__current {
    font-size: 2.125rem;
  }

  .pd-buy {
    gap: 0.75rem;
  }

  .pd-qty__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .pd-qty__controls {
    height: 52px;
  }

  .pd-qty__btn {
    width: 44px;
    height: 52px;
  }

  .pd-qty__input {
    width: 40px;
    height: 52px;
  }

  .add-to-cart-button {
    height: 52px;
    padding: 0 1.25rem;
  }

  .pd-trust {
    grid-template-columns: 1fr;
    gap: 0.625rem;
    padding-top: 1rem;
  }

  .pd-benefits {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .pd-benefit {
    padding: 1.25rem;
    gap: 0.875rem;
    border-radius: 20px;
  }

  .pd-benefit__icon {
    width: 48px;
    height: 48px;
  }

  .pd-benefit__body h3 {
    font-size: 1.125rem;
  }

  .pd-benefit__body p {
    font-size: 0.9rem;
  }

  .pd-info-blocks {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-bottom: 2rem;
  }

  .pd-band {
    padding: 2rem 0;
  }

  .pd-band__inner {
    flex-direction: column;
    align-items: stretch;
    gap: 1.25rem;
  }

  .pd-band__cta {
    justify-content: space-between;
  }

  .pd-related {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  /* Sticky buy bar appears once the main buy form scrolls out of view */
  .pd-stickybar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 900;
    background: var(--hp-dark-band);
    border-top: 1px solid rgba(224, 218, 210, 0.1);
    padding: 0.75rem 1.25rem;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    transform: translateY(110%);
    transition: transform 0.3s var(--hp-ease);
  }

  .pd-stickybar.visible {
    transform: translateY(0);
  }

  .pd-stickybar__label {
    font-size: 0.75rem;
    color: rgba(224, 218, 210, 0.7);
  }

  .pd-stickybar__price {
    font-family: var(--hp-font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--hp-dark-text);
  }

  .pd-stickybar .hp-btn {
    height: 48px;
    padding: 0 1.75rem;
    border: none;
    font-family: var(--hp-font-body);
    cursor: pointer;
  }

  .success-actions {
    grid-template-columns: 1fr;
  }

  .toast {
    left: 1rem;
    right: 1rem;
    bottom: 5.5rem;
    min-width: auto;
    max-width: none;
  }
}
