/* =========================================================
   Card Favorites 2026
   - Personal, server-backed favorites
   - Accessible toggle buttons
   - Favorites stay visible above the normal sections
   ========================================================= */

#favoritesSection.favorites-section{
  position:relative;
  border:1px solid rgba(212,180,106,.28);
  box-shadow:
    0 8px 24px rgba(0,0,0,.25),
    inset 0 1px 0 rgba(255,255,255,.04);
}

#favoritesSection.favorites-section[hidden]{
  display:none !important;
}

main#mainContent.section-hub-smart:not(.section-hub-search-mode) > #favoritesSection.favorites-section:not([hidden]),
main#mainContent.section-hub-classic:not(.section-hub-search-mode) > #favoritesSection.favorites-section:not([hidden]),
main#mainContent.section-hub-search-mode > #favoritesSection.favorites-section:not([hidden]){
  display:block !important;
}

#favoritesSection .favorites-section-title{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
}

#favoritesSection .favorites-section-title > i{
  color:#f6c94a;
  filter:drop-shadow(0 2px 6px rgba(0,0,0,.20));
}

.favorite-card-host{
  display:contents;
}

#favoritesSection .card{
  background:var(--favorite-source-bg, var(--card-surface));
  color:var(--favorite-source-color, inherit);
}

.favorite-toggle{
  position:absolute;
  top:-9px;
  right:-8px;
  z-index:20;

  width:38px;
  height:38px;
  min-width:38px;
  min-height:38px;
  padding:0;

  display:inline-flex;
  align-items:center;
  justify-content:center;

  border-radius:999px;
  border:1px solid rgba(255,255,255,.38);
  background:rgba(15,23,42,.92);
  color:#e5e7eb;
  box-shadow:0 6px 16px rgba(0,0,0,.28);

  cursor:pointer;
  -webkit-tap-highlight-color:transparent;
  touch-action:manipulation;

  transition:
    transform .18s ease,
    background .18s ease,
    color .18s ease,
    border-color .18s ease,
    box-shadow .18s ease,
    opacity .18s ease;
}

.favorite-toggle i{
  font-size:17px;
  line-height:1;
  pointer-events:none;
}

.favorite-toggle:hover{
  transform:translateY(-1px) scale(1.05);
}

.favorite-toggle:focus-visible{
  outline:3px solid rgba(246,201,74,.45);
  outline-offset:3px;
}

.card.is-favorite > .favorite-toggle{
  color:#f6c94a;
  border-color:rgba(246,201,74,.72);
  background:rgba(51,40,12,.94);
  box-shadow:
    0 6px 16px rgba(0,0,0,.30),
    0 0 0 3px rgba(246,201,74,.10);
}

.favorite-toggle.is-pending,
.favorite-toggle:disabled{
  cursor:wait;
  opacity:.72;
  transform:none !important;
}

.favorite-toggle.is-pending i{
  animation:sgaFavoritePulse .8s ease-in-out infinite alternate;
}

@keyframes sgaFavoritePulse{
  from{ transform:scale(.88); opacity:.65; }
  to{ transform:scale(1.08); opacity:1; }
}

.favorites-sr-only{
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  padding:0 !important;
  margin:-1px !important;
  overflow:hidden !important;
  clip:rect(0,0,0,0) !important;
  white-space:nowrap !important;
  border:0 !important;
}

body[data-theme="light"] #favoritesSection.favorites-section{
  border-color:rgba(184,134,11,.24);
  box-shadow:
    0 6px 20px rgba(0,0,0,.08),
    inset 0 1px 0 rgba(255,255,255,.72);
}

body[data-theme="light"] .favorite-toggle{
  background:rgba(255,255,255,.96);
  color:#475569;
  border-color:rgba(15,23,42,.15);
  box-shadow:0 5px 14px rgba(15,23,42,.16);
}

body[data-theme="light"] .card.is-favorite > .favorite-toggle{
  background:#fff9df;
  color:#b8860b;
  border-color:rgba(184,134,11,.48);
}

@media (max-width: 575.98px){
  .favorite-toggle{
    width:40px;
    height:40px;
    min-width:40px;
    min-height:40px;
    top:-10px;
    right:-7px;
  }
}

@media (prefers-reduced-motion: reduce){
  .favorite-toggle,
  .favorite-toggle.is-pending i{
    transition:none !important;
    animation:none !important;
  }
}

/* =========================================================
   Favorites collapsible section — 2026-09-30
   Native <details>/<summary>: keyboard accessible without JS.
   ========================================================= */
#favoritesSection .favorites-details{
  width:100%;
}

#favoritesSection .favorites-section-summary{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
  min-height:44px;
  padding:2px 48px 10px;
  cursor:pointer;
  list-style:none;
  -webkit-tap-highlight-color:transparent;
  user-select:none;
}

#favoritesSection .favorites-section-summary::-webkit-details-marker{
  display:none;
}

#favoritesSection .favorites-section-summary::marker{
  content:"";
}

#favoritesSection .favorites-section-summary:focus-visible{
  outline:3px solid rgba(246,201,74,.36);
  outline-offset:4px;
  border-radius:12px;
}

#favoritesSection .favorites-section-title{
  margin:0;
  pointer-events:none;
}

#favoritesSection .favorites-collapse-indicator{
  position:absolute;
  left:10px;
  top:50%;
  transform:translateY(-58%);
  width:34px;
  height:34px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:999px;
  color:#f6c94a;
  background:rgba(15,23,42,.42);
  border:1px solid rgba(246,201,74,.22);
  pointer-events:none;
}

#favoritesSection .favorites-collapse-indicator i{
  transition:transform .22s ease;
}

#favoritesSection .favorites-details:not([open]) .favorites-collapse-indicator i{
  transform:rotate(90deg);
}

#favoritesSection .favorites-collapsible-content{
  padding-top:4px;
}

body[data-theme="light"] #favoritesSection .favorites-collapse-indicator{
  color:#b8860b;
  background:rgba(255,255,255,.72);
  border-color:rgba(184,134,11,.22);
}

@media (max-width:575.98px){
  #favoritesSection .favorites-section-summary{
    padding-right:40px;
    padding-left:40px;
  }

  #favoritesSection .favorites-collapse-indicator{
    left:4px;
    width:32px;
    height:32px;
  }
}

@media (prefers-reduced-motion: reduce){
  #favoritesSection .favorites-collapse-indicator i{
    transition:none !important;
  }
}

/* =========================================================
   Favorites header refinement — clean 2026 UI
   - Remove decorative gold divider under the title.
   - Keep the title, star and collapse control as the only visual cues.
   ========================================================= */
#favoritesSection .favorites-section-title::after{
  content:none !important;
  display:none !important;
}

#favoritesSection .favorites-section-title{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  line-height:1.2;
}

#favoritesSection .favorites-section-title > i{
  font-size:.95em;
}

#favoritesSection .favorites-section-summary{
  padding-top:6px;
  padding-bottom:8px;
}

#favoritesSection .favorites-section-summary:hover .favorites-section-title{
  filter:brightness(1.06);
}

#favoritesSection .favorites-collapse-indicator{
  transition:background-color .18s ease, border-color .18s ease, transform .18s ease;
}

#favoritesSection .favorites-section-summary:hover .favorites-collapse-indicator{
  background:rgba(15,23,42,.58);
  border-color:rgba(246,201,74,.34);
}

body[data-theme="light"] #favoritesSection .favorites-section-summary:hover .favorites-collapse-indicator{
  background:rgba(255,255,255,.92);
  border-color:rgba(184,134,11,.32);
}

@media (prefers-reduced-motion: reduce){
  #favoritesSection .favorites-collapse-indicator{
    transition:none !important;
  }
}
