/**
 * @file
 * SMA popup recommendation styles.
 * Consistent with Olivero theme design language.
 */

/* =============================================
   Popup Container
   ============================================= */

.sma-popup {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  width: 320px;
  max-width: calc(100vw - 40px);
  background: var(--color--white, #fff);
  border-radius: 12px;
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.12),
    0 1px 4px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  opacity: 0;
  transform: translateY(24px);
  animation: smaSlideUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  font-family: 'Lora', 'Georgia', serif;
}

.sma-popup.sma-popup--closing {
  animation: smaSlideDown 0.3s cubic-bezier(0.55, 0, 1, 0.45) forwards;
}

/* =============================================
   Image Area
   ============================================= */

.sma-popup__image-wrap {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56%;
  background: var(--color--gray-95, #f0f1f2);
  overflow: hidden;
}

.sma-popup__image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  transition: transform 0.4s ease;
  padding: 8px;
}

.sma-popup--article .sma-popup__image {
  object-fit: cover;
  padding: 0;
}

.sma-popup:hover .sma-popup__image {
  transform: scale(1.04);
}

/* =============================================
   Close Button
   ============================================= */

.sma-popup__close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  color: var(--color--gray-45, #6b7280);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.2s;
  padding: 0;
  line-height: 1;
  font-size: 16px;
}

.sma-popup__close:hover {
  background: var(--color--white, #fff);
  color: var(--color--gray-5, #111);
  transform: scale(1.1);
}

.sma-popup__close svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* =============================================
   Content Area
   ============================================= */

.sma-popup__body {
  padding: 14px 16px 16px;
}

.sma-popup__hint {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color--gray-60, #8b919a);
  margin-bottom: 6px;
  font-family: 'Metropolitan', 'Helvetica Neue', sans-serif;
  font-weight: 600;
}

.sma-popup__hint-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  background: #ede9fe;
  color: #6d28d9;
}

.sma-popup--article .sma-popup__hint-badge {
  background: #e0f2fe;
  color: #0369a1;
}

.sma-popup__title {
  display: block;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--color--gray-5, #1a1a2e);
  margin-bottom: 4px;
  text-decoration: none;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.sma-popup__title:hover {
  color: var(--color--primary-50, #1b6faa);
}

.sma-popup__suggestion {
  font-size: 13px;
  line-height: 1.45;
  color: var(--color--gray-45, #6b7280);
  margin-bottom: 12px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* =============================================
   Footer: Price + CTA
   ============================================= */

.sma-popup__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sma-popup__price {
  font-size: 17px;
  font-weight: 700;
  color: var(--color--gray-5, #1a1a2e);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.sma-popup__price-currency {
  font-size: 13px;
  font-weight: 500;
  color: var(--color--gray-60, #8b919a);
  margin-left: 2px;
}

.sma-popup__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--color--primary-50, #1b6faa);
  color: var(--color--white, #fff);
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  white-space: nowrap;
  font-family: inherit;
}

.sma-popup--article .sma-popup__cta {
  background: #0f766e;
}

.sma-popup--article .sma-popup__cta:hover {
  background: #115e59;
}

.sma-popup__cta:hover {
  background: var(--color--primary-40, #155a8a);
  transform: translateY(-1px);
}

.sma-popup__cta:active {
  transform: translateY(0);
}

.sma-popup__cta svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* =============================================
   Animations
   ============================================= */

@keyframes smaSlideUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes smaSlideDown {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(24px);
  }
}

/* =============================================
   Mobile Responsive
   ============================================= */

@media (max-width: 480px) {
  .sma-popup {
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    max-width: none;
    border-radius: 10px;
  }

  .sma-popup__image-wrap {
    padding-bottom: 48%;
  }

  .sma-popup__body {
    padding: 12px 14px 14px;
  }

  .sma-popup__title {
    font-size: 14px;
  }

  .sma-popup__cta {
    padding: 7px 14px;
    font-size: 12px;
  }
}

/* =============================================
   Reduced motion preference
   ============================================= */

@media (prefers-reduced-motion: reduce) {
  .sma-popup {
    animation-duration: 0.01ms;
  }

  .sma-popup.sma-popup--closing {
    animation-duration: 0.01ms;
  }

  .sma-popup:hover .sma-popup__image {
    transform: none;
  }
}

/* =============================================
   In-Page Editorial Contextual Card
   ============================================= */

.sma-editorial-card {
  margin: 2.25rem 0;
  padding: 1.25rem 1.5rem;
  background: #fbfbfb;
  border: 1px solid #e5e7eb;
  border-left: 4px solid #1e293b;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  font-family: inherit;
  box-sizing: border-box;
  animation: smaFadeIn 0.45s ease-out forwards;
  clear: both;
}

.sma-editorial-card__badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed #e2e8f0;
}

.sma-editorial-card__badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #1e293b;
  color: #ffffff;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  line-height: 1.2;
}

.sma-editorial-card__label {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 500;
}

.sma-editorial-card__content {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.sma-editorial-card__thumb-link {
  flex-shrink: 0;
  width: 90px;
  height: 90px;
  border-radius: 6px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.sma-editorial-card__thumb {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  padding: 4px;
  transition: transform 0.3s ease;
}

.sma-editorial-card__thumb-link:hover .sma-editorial-card__thumb {
  transform: scale(1.06);
}

.sma-editorial-card__details {
  flex-grow: 1;
  min-width: 0;
}

.sma-editorial-card__title {
  display: block;
  font-size: 1.05rem;
  font-weight: 600;
  color: #0f172a;
  text-decoration: none;
  margin-bottom: 0.35rem;
  line-height: 1.35;
}

.sma-editorial-card__title:hover {
  color: #2563eb;
  text-decoration: underline;
}

.sma-editorial-card__text {
  margin: 0 0 0.85rem 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #334155;
  font-style: normal;
}

.sma-editorial-card__meta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.sma-editorial-card__price {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
}

.sma-editorial-card__btn {
  font-size: 0.85rem;
  font-weight: 600;
  color: #2563eb;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: color 0.2s, transform 0.2s;
}

.sma-editorial-card__btn:hover {
  color: #1d4ed8;
  transform: translateX(3px);
  text-decoration: underline;
}

@keyframes smaFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 600px) {
  .sma-editorial-card {
    padding: 1rem;
    margin: 1.5rem 0;
  }
  .sma-editorial-card__content {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
  }
  .sma-editorial-card__thumb-link {
    width: 80px;
    height: 80px;
  }
}

