/**
 * EventHub Favorites - Styling
 *
 * Styles für den Favoriten-Button (Herz-Icon).
 * Verwendet CSS-Variablen für Theme-Kompatibilität.
 *
 * @package EventHub
 * @since 1.0.0
 */

/* ==========================================================================
   Favoriten-Button Base
   ========================================================================== */

.eventhub-favorite-btn {
    /* Reset */
    appearance: none;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;

    /* Layout */
    display: inline-flex;
    align-items: center;
    justify-content: center;

    /* Styling */
    color: var(--eventhub-favorite-color, #ffffff);
    transition:
        transform var(--eventhub-transition, 0.2s ease),
        color var(--eventhub-transition, 0.2s ease);

    /* Interaktiv */
    -webkit-tap-highlight-color: transparent;
}

.eventhub-favorite-btn:hover {
    transform: scale(1.1);
}

.eventhub-favorite-btn:focus {
    outline: 2px solid var(--eventhub-color-primary, #0073aa);
    outline-offset: 2px;
}

.eventhub-favorite-btn:focus:not(:focus-visible) {
    outline: none;
}

.eventhub-favorite-btn:active {
    transform: scale(0.95);
}

/* ==========================================================================
   SVG Icons
   ========================================================================== */

.eventhub-favorite-btn__icon {
    display: block;
    width: 100%;
    height: 100%;

    /* Drop Shadow für bessere Sichtbarkeit auf Bildern */
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Outline-Icon (Standard) */
.eventhub-favorite-btn__icon--outline {
    display: block;
}

/* Filled-Icon (Favorisiert) */
.eventhub-favorite-btn__icon--filled {
    display: none;
    color: var(--eventhub-favorite-color-active, #e74c3c);
}

/* Favorisiert: Icons tauschen */
.eventhub-favorite-btn.is-favorited .eventhub-favorite-btn__icon--outline {
    display: none;
}

.eventhub-favorite-btn.is-favorited .eventhub-favorite-btn__icon--filled {
    display: block;
}

/* ==========================================================================
   Größen-Varianten
   ========================================================================== */

.eventhub-favorite-btn--small {
    width: 24px;
    height: 24px;
}

.eventhub-favorite-btn--medium {
    width: 32px;
    height: 32px;
}

.eventhub-favorite-btn--large {
    width: 44px;
    height: 44px;
}

/* ==========================================================================
   Positions-Varianten
   ========================================================================== */

/* Hero-Position: Absolut positioniert oben rechts */
.eventhub-favorite-btn--hero {
    position: absolute;
    top: var(--eventhub-spacing-md, 1rem);
    right: var(--eventhub-spacing-md, 1rem);
    z-index: 10;

    /* Heller Hintergrund wie Cards */
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    padding: var(--eventhub-spacing-sm, 0.5rem);
    color: var(--eventhub-color-text-muted, #666);

    /* Größe anpassen inkl. Padding */
    width: auto;
    height: auto;
}

.eventhub-favorite-btn--hero .eventhub-favorite-btn__icon {
    width: 28px;
    height: 28px;
    filter: none;
}

.eventhub-favorite-btn--hero:hover {
    background: rgba(255, 255, 255, 1);
    color: var(--eventhub-favorite-color-active, #e74c3c);
}

.eventhub-favorite-btn--hero.is-favorited {
    color: var(--eventhub-favorite-color-active, #e74c3c);
}

/* Card-Position: Kleiner, für Event-Cards (oben rechts) */
.eventhub-favorite-btn--card {
    position: absolute;
    top: var(--eventhub-spacing-sm, 0.5rem);
    right: var(--eventhub-spacing-sm, 0.5rem);
    z-index: 5;

    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    padding: var(--eventhub-spacing-xs, 0.25rem);
    color: var(--eventhub-color-text-muted, #666);
}

/* Card-Position Bottom: Unten rechts (z.B. Plugin-Default) */
.eventhub-favorite-btn--card-bottom {
    position: absolute;
    bottom: var(--eventhub-spacing-sm, 0.5rem);
    right: var(--eventhub-spacing-sm, 0.5rem);
    z-index: 5;

    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    padding: var(--eventhub-spacing-xs, 0.25rem);
    color: var(--eventhub-color-text-muted, #666);
}

.eventhub-favorite-btn--card .eventhub-favorite-btn__icon,
.eventhub-favorite-btn--card-bottom .eventhub-favorite-btn__icon {
    width: 20px;
    height: 20px;
    filter: none;
}

.eventhub-favorite-btn--card:hover,
.eventhub-favorite-btn--card-bottom:hover {
    background: rgba(255, 255, 255, 1);
    color: var(--eventhub-favorite-color-active, #e74c3c);
}

.eventhub-favorite-btn--card.is-favorited,
.eventhub-favorite-btn--card-bottom.is-favorited {
    color: var(--eventhub-favorite-color-active, #e74c3c);
}

/* Inline-Position: Im Textfluss */
.eventhub-favorite-btn--inline {
    vertical-align: middle;
    margin-left: var(--eventhub-spacing-xs, 0.25rem);
}

/* ==========================================================================
   Animation
   ========================================================================== */

.eventhub-favorite-btn--animating {
    animation: eventhub-favorite-pulse 0.3s ease-out;
}

@keyframes eventhub-favorite-pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
    100% {
        transform: scale(1);
    }
}

/* Herz "schlägt" beim Favorisieren */
.eventhub-favorite-btn.is-favorited.eventhub-favorite-btn--animating
    .eventhub-favorite-btn__icon--filled {
    animation: eventhub-heart-beat 0.3s ease-out;
}

@keyframes eventhub-heart-beat {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

/* Screen reader only text */
.eventhub-favorite-btn .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .eventhub-favorite-btn,
    .eventhub-favorite-btn--animating,
    .eventhub-favorite-btn--animating .eventhub-favorite-btn__icon--filled {
        animation: none;
        transition: none;
    }
}

/* ==========================================================================
   Favorites Pill (Slider)
   ========================================================================== */

.eventhub-favorites-pill {
    /* Positioning */
    position: absolute;
    top: var(--eventhub-spacing-md, 1rem);
    right: var(--eventhub-spacing-md, 1rem);
    z-index: 20;

    /* Layout */
    display: inline-flex;
    align-items: center;
    gap: var(--eventhub-spacing-xs, 0.25rem);

    /* Styling */
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #fff;
    padding: var(--eventhub-spacing-xs, 0.25rem)
        var(--eventhub-spacing-sm, 0.5rem);
    border-radius: 999px;
    font-size: var(--eventhub-font-size-sm, 0.875rem);
    text-decoration: none;
    transition:
        background var(--eventhub-transition, 0.2s ease),
        transform var(--eventhub-transition, 0.2s ease);
}

.eventhub-favorites-pill:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.05);
    color: #fff;
    text-decoration: none;
}

.eventhub-favorites-pill__icon {
    flex-shrink: 0;
    color: var(--eventhub-favorite-color-active, #e91e63);
}

.eventhub-favorites-pill__text {
    font-weight: 500;
}

.eventhub-favorites-pill__badge {
    color: inherit;
    font-size: inherit;
    font-weight: 500;
}

/* Klammern um die Zahl */
.eventhub-favorites-pill__badge::before {
    content: '(';
}

.eventhub-favorites-pill__badge::after {
    content: ')';
}

.eventhub-favorites-pill__badge:empty,
.eventhub-favorites-pill__badge[style*='display: none'] {
    display: none !important;
}

/* Animation wenn Badge sich ändert */
@keyframes eventhub-badge-bounce {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

.eventhub-favorites-pill__badge--animate {
    animation: eventhub-badge-bounce 0.3s ease;
}
