/* ============================================================
   NXT Ing Favorites — Frontend Styles
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --nxt-fav-accent:        #c8a84b;   /* gold */
  --nxt-fav-saved:         #e63946;   /* red heart */
  --nxt-fav-saved-bg:      #fff0f1;
  --nxt-fav-text:          #1a1a2e;
  --nxt-fav-muted:         #6b7280;
  --nxt-fav-border:        #d1d5db;
  --nxt-fav-radius:        8px;
  --nxt-fav-radius-pill:   50px;
  --nxt-fav-transition:    0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  --nxt-fav-shadow:        0 2px 12px rgba(0,0,0,.08);
}

/* ── Wrapper ────────────────────────────────────────────────── */
.nxt-fav-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

/* ── The Button ─────────────────────────────────────────────── */
.nxt-fav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 2px solid var(--nxt-fav-border);
  border-radius: var(--nxt-fav-radius);
  background: #fff;
  color: var(--nxt-fav-text);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  transition:
    color var(--nxt-fav-transition),
    border-color var(--nxt-fav-transition),
    background var(--nxt-fav-transition),
    box-shadow var(--nxt-fav-transition),
    transform 0.15s ease;
  -webkit-user-select: none;
          user-select: none;
}

.nxt-fav-btn:hover {
  border-color: var(--nxt-fav-saved);
  color: var(--nxt-fav-saved);
  box-shadow: var(--nxt-fav-shadow);
  transform: translateY(-1px);
}

.nxt-fav-btn:active {
  transform: scale(0.97) translateY(0);
}

/* Saved state */
.nxt-fav-btn.nxt-fav-is-saved {
  border-color: var(--nxt-fav-saved);
  color: var(--nxt-fav-saved);
  background: var(--nxt-fav-saved-bg);
}

/* Loading state */
.nxt-fav-btn.nxt-fav-loading {
  opacity: 0.75;
  pointer-events: none;
}

/* ── Icon ──────────────────────────────────────────────────── */
.nxt-fav-icon {
  display: flex;
  align-items: center;
  line-height: 1;
}

.nxt-fav-icon svg {
  width: 20px;
  height: 20px;
  transition: transform var(--nxt-fav-transition), fill 0.2s ease;
}

.nxt-fav-btn.nxt-fav-is-saved .nxt-fav-icon-heart svg {
  fill: currentColor;
  transform: scale(1.15);
}

/* Heartbeat animation on save */
@keyframes nxt-heartbeat {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.4); }
  60%  { transform: scale(0.9); }
  80%  { transform: scale(1.2); }
  100% { transform: scale(1.1); }
}

.nxt-fav-btn.nxt-fav-just-saved .nxt-fav-icon svg {
  animation: nxt-heartbeat 0.55s ease forwards;
}

/* ── Ripple ─────────────────────────────────────────────────── */
.nxt-fav-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(230, 57, 70, 0.25);
  transform: scale(0);
  pointer-events: none;
  transition: transform 0.5s ease, opacity 0.5s ease;
  opacity: 0;
}

.nxt-fav-ripple.nxt-ripple-active {
  transform: scale(4);
  opacity: 0;
}

/* ── Style Variants ─────────────────────────────────────────── */

/* Minimal (icon only) */
.nxt-fav-style-minimal .nxt-fav-btn {
  padding: 8px;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  justify-content: center;
}
.nxt-fav-style-minimal .nxt-fav-label {
  display: none;
}

/* Pill */
.nxt-fav-style-pill .nxt-fav-btn {
  border-radius: var(--nxt-fav-radius-pill);
  padding: 10px 24px;
}

/* ── Save Count Badge ───────────────────────────────────────── */
.nxt-fav-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--nxt-fav-saved);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

/* ── Toast Notification ──────────────────────────────────────── */
.nxt-fav-toast {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: #1a1a2e;
  color: #fff;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 9999;
}

.nxt-fav-toast::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1a1a2e;
}

.nxt-fav-toast.nxt-toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Login Prompt ───────────────────────────────────────────── */
.nxt-fav-login-prompt {
  text-decoration: none;
}

/* ── Saved Ingredients List (Account Page) ──────────────────── */
.nxt-fav-saved-list {
  padding: 0;
}

.nxt-fav-saved-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.nxt-fav-saved-header h3 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--nxt-fav-text);
}

.nxt-fav-saved-count {
  background: var(--nxt-fav-accent);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}

/* Empty state */
.nxt-fav-empty-state {
  text-align: center;
  padding: 56px 24px;
  background: #fafafa;
  border: 2px dashed var(--nxt-fav-border);
  border-radius: 12px;
}

.nxt-fav-empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.nxt-fav-empty-state h4 {
  margin: 0 0 10px;
  font-size: 1.15rem;
  color: var(--nxt-fav-text);
}

.nxt-fav-empty-state p {
  color: var(--nxt-fav-muted);
  max-width: 380px;
  margin: 0 auto 24px;
  font-size: 0.9rem;
  line-height: 1.6;
}

.nxt-fav-browse-btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 28px;
  background: var(--nxt-fav-accent);
  color: #fff;
  border-radius: var(--nxt-fav-radius);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition: opacity 0.2s;
}

.nxt-fav-browse-btn:hover {
  opacity: 0.88;
  color: #fff;
}

/* Grid */
.nxt-fav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

/* Card */
.nxt-fav-card {
  background: #fff;
  border: 1px solid var(--nxt-fav-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--nxt-fav-shadow);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  display: flex;
  flex-direction: column;
}

.nxt-fav-card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,.12);
  transform: translateY(-2px);
}

.nxt-fav-card-image {
  display: block;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: #f3f4f6;
}

.nxt-fav-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.nxt-fav-card:hover .nxt-fav-card-image img {
  transform: scale(1.04);
}

.nxt-fav-no-image {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--nxt-fav-muted);
  text-decoration: none;
}

.nxt-fav-card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nxt-fav-card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.nxt-fav-card-title a {
  color: var(--nxt-fav-text);
  text-decoration: none;
}

.nxt-fav-card-title a:hover {
  color: var(--nxt-fav-accent);
}

.nxt-fav-card-excerpt {
  margin: 0;
  font-size: 0.83rem;
  color: var(--nxt-fav-muted);
  line-height: 1.5;
  flex: 1;
}

.nxt-fav-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.nxt-fav-view-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  background: var(--nxt-fav-text);
  color: #fff;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s;
}

.nxt-fav-view-btn:hover {
  background: var(--nxt-fav-accent);
  color: #fff;
}

.nxt-fav-remove-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border: 1px solid var(--nxt-fav-border);
  background: transparent;
  color: var(--nxt-fav-muted);
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  font-family: inherit;
}

.nxt-fav-remove-btn:hover {
  border-color: var(--nxt-fav-saved);
  color: var(--nxt-fav-saved);
  background: var(--nxt-fav-saved-bg);
}

.nxt-fav-card.nxt-fav-removing {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ── Login Notice ───────────────────────────────────────────── */
.nxt-fav-login-notice {
  padding: 16px;
  background: #fef3c7;
  border-left: 4px solid #f59e0b;
  border-radius: 4px;
  font-size: 0.9rem;
  color: var(--nxt-fav-text);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 480px) {
  .nxt-fav-grid {
    grid-template-columns: 1fr;
  }
  .nxt-fav-btn {
    font-size: 0.85rem;
    padding: 9px 16px;
  }
}

.nxt-fav-card-date {
  margin: 0;
  font-size: 0.75rem;
  color: var(--nxt-fav-muted);
  font-style: italic;
}
