/* GFXDeck Favorites — Detail, Card & Account Favorites UI */

.resource-panel-badges {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
}

.gfx-fav-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.gfx-fav-btn__icon {
  display: block;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1), fill 160ms ease, stroke 160ms ease;
}

/* Detail Page Heart Button (40x40px, 20px icon, 10px radius) */
.gfx-fav-btn--detail {
  width: 40px;
  height: 40px;
  min-width: 40px;
  flex-shrink: 0;
  border-radius: 10px;
  border: 1px solid var(--border, #e2e8f0);
  background: var(--surface, #ffffff);
  color: #6b7280;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.04);
}

.gfx-fav-btn--detail .gfx-fav-btn__icon {
  width: 20px;
  height: 20px;
}

.gfx-fav-btn--detail:hover {
  background: var(--item-hover, #f8fafc);
  border-color: #cbd5e1;
  color: #374151;
}

.gfx-fav-btn--detail:active {
  transform: scale(0.95);
}

.gfx-fav-btn--detail.is-favorited {
  color: #ef4444;
  background: rgb(239 68 68 / 0.08);
  border-color: rgb(239 68 68 / 0.28);
}

.gfx-fav-btn--detail.is-favorited:hover {
  background: rgb(239 68 68 / 0.14);
  border-color: rgb(239 68 68 / 0.42);
  color: #dc2626;
}

.gfx-fav-btn--detail.is-favorited .gfx-fav-btn__icon {
  fill: currentColor;
  stroke: currentColor;
}

html[data-theme="dark"] .gfx-fav-btn--detail {
  background: rgb(255 255 255 / 0.04);
  border-color: rgb(255 255 255 / 0.12);
  color: #9ca3af;
  box-shadow: none;
}

html[data-theme="dark"] .gfx-fav-btn--detail:hover {
  background: rgb(255 255 255 / 0.09);
  border-color: rgb(255 255 255 / 0.22);
  color: #e5e7eb;
}

html[data-theme="dark"] .gfx-fav-btn--detail.is-favorited {
  color: #f87171;
  background: rgb(248 113 113 / 0.14);
  border-color: rgb(248 113 113 / 0.36);
}

html[data-theme="dark"] .gfx-fav-btn--detail.is-favorited:hover {
  background: rgb(248 113 113 / 0.2);
  border-color: rgb(248 113 113 / 0.5);
  color: #ef4444;
}

/* Product Card Heart Button (top-right of thumbnail, never overlaps left badge or bottom-right software logo) */
.gfx-fav-btn--card {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 4;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgb(15 23 42 / 0.1);
  background: rgb(255 255 255 / 0.9);
  color: #52525b;
  box-shadow: 0 2px 8px rgb(15 23 42 / 0.14);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.gfx-fav-btn--card .gfx-fav-btn__icon {
  width: 18px;
  height: 18px;
}

.gfx-fav-btn--card:hover {
  background: #ffffff;
  color: #18181b;
  transform: scale(1.04);
  box-shadow: 0 4px 12px rgb(15 23 42 / 0.2);
}

.gfx-fav-btn--card:active {
  transform: scale(0.94);
}

.gfx-fav-btn--card.is-favorited {
  color: #ef4444;
  background: rgb(255 255 255 / 0.95);
  border-color: rgb(239 68 68 / 0.32);
}

.gfx-fav-btn--card.is-favorited:hover {
  color: #dc2626;
  background: #ffffff;
}

.gfx-fav-btn--card.is-favorited .gfx-fav-btn__icon {
  fill: currentColor;
  stroke: currentColor;
}

html[data-theme="dark"] .gfx-fav-btn--card {
  background: rgb(24 24 27 / 0.78);
  border-color: rgb(255 255 255 / 0.16);
  color: #d4d4d8;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.32);
}

html[data-theme="dark"] .gfx-fav-btn--card:hover {
  background: rgb(24 24 27 / 0.94);
  border-color: rgb(255 255 255 / 0.28);
  color: #ffffff;
}

html[data-theme="dark"] .gfx-fav-btn--card.is-favorited {
  color: #f87171;
  background: rgb(24 24 27 / 0.88);
  border-color: rgb(248 113 113 / 0.44);
}

html[data-theme="dark"] .gfx-fav-btn--card.is-favorited:hover {
  color: #ef4444;
  background: rgb(24 24 27 / 0.96);
}

/* Focus-visible ring */
.gfx-fav-btn:focus-visible {
  outline: 2px solid #ef4444;
  outline-offset: 2px;
}

.gfx-fav-btn.is-pending {
  opacity: 0.78;
}

.gfx-fav-btn.is-popping .gfx-fav-btn__icon {
  transform: scale(1.18);
}

/* Accessible Hover / Focus Tooltips (zero overflow on cards and detail) */
.gfx-fav-btn[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  white-space: nowrap;
  padding: 5px 9px;
  border-radius: 7px;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.25;
  background: #18181b;
  color: #ffffff;
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.22);
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
}

html[data-theme="dark"] .gfx-fav-btn[data-tooltip]::after {
  background: #f4f4f5;
  color: #18181b;
}

.gfx-fav-btn--detail[data-tooltip]::after {
  right: 0;
  bottom: calc(100% + 8px);
  transform: translateY(3px);
}

.gfx-fav-btn--detail[data-tooltip]:hover::after,
.gfx-fav-btn--detail[data-tooltip]:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.gfx-fav-btn--card[data-tooltip]::after {
  right: calc(100% + 6px);
  top: 50%;
  transform: translate(3px, -50%);
}

.gfx-fav-btn--card[data-tooltip]:hover::after,
.gfx-fav-btn--card[data-tooltip]:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translate(0, -50%);
}

@media (hover: none), (pointer: coarse) {
  .gfx-fav-btn[data-tooltip]::after {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gfx-fav-btn,
  .gfx-fav-btn__icon,
  .gfx-fav-btn[data-tooltip]::after,
  .account-favorites-grid .resource-card {
    transition: none !important;
  }
}

/* Account Favorites Tab */
.account-favorites-note {
  margin: 6px 0 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--sf-text-muted, #64748b);
}

html[data-theme="dark"] .account-favorites-note {
  color: #9ca3af;
}

.account-favorites-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.account-favorites-grid .resource-card {
  transition: opacity 180ms ease, transform 180ms ease;
}

.account-favorites-grid .resource-card.gfx-fav-card-removing {
  opacity: 0;
  transform: scale(0.96);
  pointer-events: none;
}

.account-favorites-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 12px;
  background: rgb(239 68 68 / 0.08);
  color: #ef4444;
}

.account-favorites-empty-icon svg {
  width: 24px;
  height: 24px;
}

html[data-theme="dark"] .account-favorites-empty-icon {
  background: rgb(248 113 113 / 0.14);
  color: #f87171;
}

@media (max-width: 1080px) {
  .account-favorites-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .account-favorites-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Toast Error Notice */
.gfx-fav-toast {
  position: fixed;
  right: 16px;
  bottom: 20px;
  z-index: 950;
  max-width: min(360px, calc(100vw - 32px));
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.4;
  background: #18181b;
  color: #ffffff;
  border: 1px solid rgb(255 255 255 / 0.12);
  box-shadow: 0 12px 28px rgb(0 0 0 / 0.26);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.gfx-fav-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.gfx-fav-toast.is-error {
  background: #7f1d1d;
  border-color: rgb(248 113 113 / 0.4);
  color: #fef2f2;
}
