/**
 * EventHub Frontend: Folgen-Button und Hinweis
 *
 * Ein Button, zwei Formen:
 * - --pill: Kapsel mit Text ("Folgen" / "Du folgst"), erster Button der Aktionsleiste
 *   auf den Seiten von Ort, Veranstalter und Kategorie.
 * - --dot: runder Plus-/Haken-Knopf hinter dem Namen im Info-Block der Veranstaltung.
 *
 * Plus/Haken und Beschriftung schaltet aria-pressed um (JS setzt es aus dem Gerätespeicher).
 * Farben über die Plugin-Tokens, damit Themes sie per --eventhub-color-primary anpassen.
 * Das Herz gehört der Merkliste; hier bewusst Plus/Haken.
 *
 * @package EventHub
 * @since 1.19.0
 */

/* ==========================================================================
   BUTTON (gemeinsam)
   ========================================================================== */

button.eventhub-follow {
    --eventhub-follow-color: var(--eventhub-color-primary, #0073aa);
    /* Dunklere Hover-Farbe aus der Akzentfarbe abgeleitet: Themes setzen --eventhub-color-primary-dark
       oft nicht, dann griffe die blaue Plugin-Vorgabe. */
    --eventhub-follow-color-dark: color-mix(in srgb, var(--eventhub-follow-color) 82%, #000);
    --eventhub-follow-on-color: var(--eventhub-color-primary-contrast, #fff);

    position: relative;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    border: 1.5px solid var(--eventhub-follow-color);
    background: #fff;
    color: var(--eventhub-follow-color);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    box-shadow: none;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

/* Hover: Schrift und Rand explizit setzen. Das Theme färbt button:hover weiß mit dunklem
   Rand; im Ruhezustand würde der Knopf dann auf heller Fläche verschwinden. */
button.eventhub-follow:hover {
    border-color: var(--eventhub-follow-color);
    background: color-mix(in srgb, var(--eventhub-follow-color) 8%, #fff);
    color: var(--eventhub-follow-color);
}

button.eventhub-follow[aria-pressed="true"] {
    background: var(--eventhub-follow-color);
    color: var(--eventhub-follow-on-color);
}

button.eventhub-follow[aria-pressed="true"]:hover {
    border-color: var(--eventhub-follow-color-dark);
    background: var(--eventhub-follow-color-dark);
    color: var(--eventhub-follow-on-color);
}

/* Wie die übrigen Buttons: beim Hover leicht nach oben, nur mit echtem Hover (nicht am Touchscreen). */
@media (hover: hover) and (pointer: fine) {
    button.eventhub-follow:hover {
        transform: translateY(-2px);
    }
}

button.eventhub-follow:focus-visible {
    outline: 2px solid var(--eventhub-follow-color);
    outline-offset: 2px;
}

/* Zustand: Plus/Beschriftung im Ruhezustand, Haken/Beschriftung wenn gefolgt. */
.eventhub-follow[aria-pressed="true"] .eventhub-follow__off,
.eventhub-follow[aria-pressed="false"] .eventhub-follow__on {
    display: none;
}

.eventhub-follow__icon {
    display: inline-flex;
}

/* ==========================================================================
   KAPSEL (Aktionsleiste)
   ========================================================================== */

button.eventhub-follow--pill {
    gap: 6px;
    height: 36px;
    padding: 0 14px 0 10px;
    border-radius: var(--eventhub-border-radius-pill, 18px);
    white-space: nowrap;
}

/* Handy: eigene Zeile über den übrigen Buttons. Vier Kapseln passen nicht
   nebeneinander, und "Du folgst" ist breiter als "Folgen" — so springt beim
   Umschalten nichts. */
@media (max-width: 560px) {
    .eventhub-export-actions__follow {
        flex: 0 0 100%;
    }
}

/* ==========================================================================
   RUNDER KNOPF (Info-Block der Veranstaltung)
   ========================================================================== */

button.eventhub-follow--dot {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    margin: -2px 0 0;
    padding: 0;
    border-radius: 50%;
}

/* Trefferfläche 44 px, auch wenn der Knopf nur 28 px groß ist. */
button.eventhub-follow--dot::before {
    content: "";
    position: absolute;
    inset: -8px;
}

button.eventhub-follow--dot svg {
    width: 14px;
    height: 14px;
}

/* Name und Knopf nebeneinander; der Knopf bleibt bei langem Namen auf der ersten Zeile. */
.eventhub-info-block__value--follow {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

/* ==========================================================================
   HINWEIS (nach dem Umschalten)
   Karte unten mittig: Symbol, Überschrift mit hervorgehobenem Namen, kleine
   Erklärung, darunter der weiße Hauptknopf und "Rückgängig".
   ========================================================================== */

.eventhub-follow-toast {
    --eventhub-toast-accent: var(--eventhub-color-primary, #0073aa);

    position: fixed;
    left: 50%;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 100000;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: 6px 12px;
    width: min(420px, calc(100vw - 32px));
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    background: var(--eventhub-color-text-dark, #1a1a1a);
    color: #fff;
    font-size: 0.875rem;
    line-height: 1.35;
    text-align: left;
    box-shadow:
        0 12px 32px rgba(0, 0, 0, 0.28),
        0 2px 6px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translate(-50%, 16px);
    pointer-events: none;
    transition:
        opacity 0.2s ease,
        transform 0.25s ease;
}

.eventhub-follow-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
    pointer-events: auto;
}

.eventhub-follow-toast__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--eventhub-toast-accent);
    color: #fff;
}

.eventhub-follow-toast__icon--off {
    background: rgba(255, 255, 255, 0.16);
}

.eventhub-follow-toast__icon svg {
    width: 14px;
    height: 14px;
}

.eventhub-follow-toast__body {
    min-width: 0;
    padding-top: 3px;
}

.eventhub-follow-toast__title,
.eventhub-follow-toast__note {
    margin: 0;
}

.eventhub-follow-toast__title {
    font-size: 0.95rem;
    font-weight: 400;
}

.eventhub-follow-toast__title strong {
    font-weight: 700;
}

.eventhub-follow-toast__note {
    margin-top: 3px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
}

.eventhub-follow-toast__actions {
    grid-column: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
    margin-top: 6px;
}

/* Eine Zeile: Symbol, Text, Knopf. */
.eventhub-follow-toast--inline {
    grid-template-columns: auto 1fr auto;
    align-items: center;
}

.eventhub-follow-toast--inline .eventhub-follow-toast__body {
    padding-top: 0;
}

.eventhub-follow-toast--inline .eventhub-follow-toast__actions {
    grid-column: auto;
    margin-top: 0;
}

.eventhub-follow-toast a.eventhub-follow-toast__action,
.eventhub-follow-toast button.eventhub-follow-toast__action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 8px 12px;
    border: 0;
    border-radius: 18px;
    background: transparent;
    color: rgba(255, 255, 255, 0.78);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: normal;
    text-transform: none;
    text-decoration: none;
    box-shadow: none;
    cursor: pointer;
    transition:
        background-color 0.15s ease,
        color 0.15s ease,
        transform 0.2s ease;
}

.eventhub-follow-toast a.eventhub-follow-toast__action:hover,
.eventhub-follow-toast button.eventhub-follow-toast__action:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

/* Hauptknopf: weiß auf dunkel, mit Pfeil. */
.eventhub-follow-toast a.eventhub-follow-toast__action--primary,
.eventhub-follow-toast button.eventhub-follow-toast__action--primary {
    background: #fff;
    color: var(--eventhub-color-text-dark, #1a1a1a);
    font-weight: 600;
}

.eventhub-follow-toast a.eventhub-follow-toast__action--primary:hover,
.eventhub-follow-toast button.eventhub-follow-toast__action--primary:hover {
    background: rgba(255, 255, 255, 0.88);
    color: var(--eventhub-color-text-dark, #1a1a1a);
}

/* Nur der Hauptknopf rückt beim Hover nach oben (wie die übrigen Buttons der Seite), nicht am
   Touchscreen. "Rückgängig" bleibt ruhig stehen. */
@media (hover: hover) and (pointer: fine) {
    .eventhub-follow-toast a.eventhub-follow-toast__action--primary:hover,
    .eventhub-follow-toast button.eventhub-follow-toast__action--primary:hover {
        transform: translateY(-2px);
    }
}

.eventhub-follow-toast__arrow {
    display: inline-flex;
}

.eventhub-follow-toast__arrow svg {
    width: 14px;
    height: 14px;
}

.eventhub-follow-toast .eventhub-follow-toast__action:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    button.eventhub-follow,
    .eventhub-follow-toast {
        transition: none;
    }
}
