/* ==========================================================================
   Favourites (المفضلة) — shared by every front-end theme.

   One markup (resources/views/components/favorite-button.blade.php), styled
   per theme through the .fav-theme-{default|classic|new} class so each heart
   follows its theme's palette:
     default / classic  → Font Awesome 5 heart
     new                → inline SVG heart
   The heart itself is red (#e0245e) on every theme.

   Variants
     .fav-btn--card    round button floating over a card's cover image
     .fav-btn--inline  pill with icon + label, sits beside a page title
   ========================================================================== */

.fav-btn {
    --fav-accent: #e0245e;
    --fav-muted: #6c757d;
    --fav-bg: rgba(255, 255, 255, .94);

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--fav-muted);
    font: inherit;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color .2s ease, background-color .2s ease, border-color .2s ease, transform .15s ease, box-shadow .2s ease;
}

.fav-btn:focus { outline: 0; }
.fav-btn:focus-visible { box-shadow: 0 0 0 3px rgba(0, 0, 0, .15); }
.fav-btn.is-busy { pointer-events: none; opacity: .7; }

/* The heart is red on every theme (product decision); only the idle grey
   follows the theme's text palette. */
.fav-btn.fav-theme-new     { --fav-muted: var(--clr-txt-hierarchy-0, #666); }

/* icon pair: outline shown when idle, filled when active */
.fav-btn .fav-ico { display: inline-block; font-size: 1.1em; line-height: 1; }
.fav-btn .fav-ico-on { display: none; }
.fav-btn.is-active .fav-ico-off { display: none; }
.fav-btn.is-active .fav-ico-on { display: inline-block; animation: fav-pop .35s cubic-bezier(.2, 1.4, .5, 1); }
.fav-btn.is-active { color: var(--fav-accent); }

.fav-btn svg.fav-ico { width: 1.15em; height: 1.15em; fill: currentColor; }

@keyframes fav-pop {
    0%   { transform: scale(.6); }
    60%  { transform: scale(1.25); }
    100% { transform: scale(1); }
}

/* --- card variant ---------------------------------------------------------- */
.fav-btn--card {
    position: absolute;
    top: 16px;
    inset-inline-end: 16px;
    z-index: 5;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--fav-bg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
    font-size: 15px;
}
.fav-btn--card:hover { transform: scale(1.08); color: var(--fav-accent); }
.fav-btn--card.fav-theme-new { width: 32px; height: 32px; font-size: 14px; }

/* the wrappers the card button floats over */
.course-box-wrap,
.card-container,
.course-tile,
.track-card { position: relative; }

/* --- inline (page title) variant ------------------------------------------- */
.fav-btn--inline {
    padding: .45rem .95rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: .9rem;
    font-weight: 600;
    white-space: nowrap;
    color: var(--fav-muted);
    background: transparent;
}
.fav-btn--inline:hover { color: var(--fav-accent); }
.fav-btn--inline.is-active {
    color: #fff;
    background: var(--fav-accent);
    border-color: var(--fav-accent);
}
.fav-btn--inline.fav-theme-new { border-radius: 16px; font-size: .8rem; font-weight: 700; padding: .35rem .9rem; }

/* title rows that host the inline button */
.cx-title-row,
.fav-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.cx-title-row .cx-title { margin: 0; flex: 1 1 auto; }
.fav-title-row .fav-page-title { margin: 0; font-size: 1.35rem; font-weight: 700; color: var(--headers-color, inherit); }

/* --- header icon (default / classic) --------------------------------------- */
.favorites-box .icon a i { font-size: 18px; }
.favorites-box .icon .number.is-zero { display: none; }

/* --- favourites page ------------------------------------------------------- */
.fav-empty {
    text-align: center;
    padding: 56px 16px;
    color: #6c757d;
}
.fav-empty .fav-empty-ico { font-size: 44px; margin-bottom: 14px; color: var(--fav-accent, #e0245e); opacity: .85; }
.fav-empty h4 { font-size: 1.15rem; margin-bottom: 6px; color: inherit; }
.fav-empty p { margin-bottom: 18px; }

.fav-card-leave { transition: opacity .25s ease, transform .25s ease; opacity: 0; transform: scale(.96); }

.fav-count-badge {
    display: inline-block;
    min-width: 1.6em;
    padding: 0 .45em;
    margin-inline-start: .35em;
    border-radius: 999px;
    font-size: .75em;
    line-height: 1.6;
    text-align: center;
    color: #fff;
    background: var(--fav-accent, #e0245e);
}

/* --- toast ------------------------------------------------------------------
   One element, re-used; .fav-theme-* picks the look of the page it sits on. */
.fav-toast {
    --fav-toast-bg: #fff;
    --fav-toast-fg: #29303b;
    --fav-toast-accent: #e0245e;

    position: fixed;
    bottom: 28px;
    left: 50%;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(92vw, 420px);
    padding: 12px 18px;
    border-radius: 12px;
    background: var(--fav-toast-bg);
    color: var(--fav-toast-fg);
    font-size: .95rem;
    font-weight: 600;
    line-height: 1.4;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 16px);
    transition: opacity .25s ease, transform .25s ease;
}
.fav-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.fav-toast .fav-toast-ico { display: inline-flex; flex: 0 0 auto; }
.fav-toast .fav-toast-ico svg { width: 22px; height: 22px; fill: var(--fav-toast-accent); animation: fav-pop .35s cubic-bezier(.2, 1.4, .5, 1); }
.fav-toast.is-error { --fav-toast-accent: #c0392b; }

/* default / classic: white card with the theme's accent bar on the start edge,
   like the site's alert boxes */
.fav-toast.fav-theme-default,
.fav-toast.fav-theme-classic {
    border-inline-start: 4px solid var(--fav-toast-accent);
    border-radius: 6px;
    font-family: Almarai, inherit;
}
.fav-toast.fav-theme-default.is-success,
.fav-toast.fav-theme-classic.is-success { --fav-toast-accent: #e0245e; }
.fav-toast.fav-theme-default.is-info,
.fav-toast.fav-theme-classic.is-info { --fav-toast-accent: var(--headers-color, #6c757d); }

/* new: dark pill in the theme's text colour, rounded like its buttons */
.fav-toast.fav-theme-new {
    --fav-toast-bg: var(--clr-txt-main, #333);
    --fav-toast-fg: var(--clr-txt-white, #fff);
    --fav-toast-accent: #ff6b8e;

    bottom: 84px;              /* above the mobile bottom nav */
    padding: 10px 18px;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 700;
}
.fav-toast.fav-theme-new.is-info { --fav-toast-accent: var(--clr-txt-white, #fff); }
.fav-toast.fav-theme-new.is-error { --fav-toast-accent: #ff8a80; }
@media (min-width: 800px) { .fav-toast.fav-theme-new { bottom: 28px; } }

/* --- header pill with live count (new theme) -------------------------------
   Sits next to the profile block, drawn like the nav buttons beside it. */
.desktop-nav-end {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 14px;
}
.fav-nav-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 14px;
    border-radius: 8px;
    background-color: var(--clr-disabled, #d9d7d5);
    color: #e0245e;
    text-decoration: none;
    transition: background-color .2s ease, transform .15s ease;
}
.fav-nav-pill:hover { background-color: var(--clr-border, #e9e7e2); transform: translateY(-1px); }
.fav-nav-pill svg { width: 24px; height: 24px; fill: currentColor; }
.fav-nav-pill .fav-nav-count {
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--clr-accent, #e0245e);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
}
.fav-nav-pill .fav-nav-count.is-zero { display: none; }
