/**
 * OptionFinder UI Enhancements v1.0.0
 *
 * Enthält:
 * - Scroll-Animationen (Fade-In)
 * - Opportunity Cards Hover-Effekte
 * - KPI-Balken Animationen
 * - Heatmap Tile Verbesserungen
 * - Konsistente Design-Tokens
 * - Scroll-to-Top Button
 */

/* ==========================================================================
   1. DESIGN TOKENS - Konsistente Werte
   ========================================================================== */

:root {
    /* Konsistente Border-Radius */
    --of-radius-sm: 6px;
    --of-radius-md: 10px;
    --of-radius-lg: 16px;
    --of-radius-xl: 24px;

    /* Schatten-Hierarchie */
    --of-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --of-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.06);
    --of-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --of-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --of-shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.16);

    /* Animation Timings */
    --of-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --of-ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="dark"] {
    --of-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
    --of-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.25);
    --of-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --of-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
    --of-shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.5);
}


/* ==========================================================================
   2. SCROLL ANIMATIONS - Fade-In beim Scrollen
   ========================================================================== */

.of-fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s var(--of-ease-out), transform 0.6s var(--of-ease-out);
}

.of-fade-in.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered Animation für Listen */
.of-fade-in-stagger > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s var(--of-ease-out), transform 0.5s var(--of-ease-out);
}

.of-fade-in-stagger.is-visible > *:nth-child(1) { transition-delay: 0ms; opacity: 1; transform: translateY(0); }
.of-fade-in-stagger.is-visible > *:nth-child(2) { transition-delay: 80ms; opacity: 1; transform: translateY(0); }
.of-fade-in-stagger.is-visible > *:nth-child(3) { transition-delay: 160ms; opacity: 1; transform: translateY(0); }
.of-fade-in-stagger.is-visible > *:nth-child(4) { transition-delay: 240ms; opacity: 1; transform: translateY(0); }
.of-fade-in-stagger.is-visible > *:nth-child(5) { transition-delay: 320ms; opacity: 1; transform: translateY(0); }

/* Sektions-Trenner */
.of-section-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--of-border, #e2e8f0) 20%, var(--of-border, #e2e8f0) 80%, transparent);
    margin: 0;
    border: none;
}


/* ==========================================================================
   3. OPPORTUNITY CARDS - Hover-Effekte & Skeleton Loading
   ========================================================================== */

/* Hover Lift Effect */
.of-opportunity {
    transition: transform 0.3s var(--of-ease-out), box-shadow 0.3s var(--of-ease-out);
}

.of-opportunity:hover {
    transform: translateY(-4px);
    box-shadow: var(--of-shadow-lg);
}

/* Skeleton Loading */
.of-skeleton {
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: of-skeleton-shimmer 1.5s infinite;
    border-radius: var(--of-radius-md);
}

[data-theme="dark"] .of-skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
}

@keyframes of-skeleton-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.of-skeleton-card {
    height: 180px;
    margin-bottom: 12px;
}

.of-skeleton-text {
    height: 16px;
    margin-bottom: 8px;
    width: 60%;
}

.of-skeleton-text--short { width: 40%; }
.of-skeleton-text--long { width: 80%; }


/* ==========================================================================
   4. KPI-BALKEN - Animationen & Tooltips
   ========================================================================== */

/* Animierte Balken */
.of-kpi-bar__gradient {
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 1s var(--of-ease-out);
}

.of-kpi-bar.is-animated .of-kpi-bar__gradient {
    transform: scaleX(1);
}

/* Indikator-Animation */
.of-kpi-bar__indicator {
    opacity: 0;
    transform: translateX(-50%) scale(0.5);
    transition: opacity 0.4s ease 0.8s, transform 0.4s var(--of-ease-bounce) 0.8s;
}

.of-kpi-bar.is-animated .of-kpi-bar__indicator {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* Enhanced Tooltip */
.of-tooltip__content {
    opacity: 0;
    visibility: hidden;
    transform: translateY(5px);
    transition: all 0.2s var(--of-ease-out);
}

.of-tooltip:hover .of-tooltip__content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}


/* ==========================================================================
   5. HEATMAP TILES - Verbesserungen
   ========================================================================== */

/* Sanftere Farbübergänge */
.of-tile {
    transition: all 0.25s var(--of-ease-out) !important;
}

/* Top-Score Effekt - Goldener Rahmen + Glow */
.of-tile--top-score {
    border: 2px solid #fbbf24 !important;
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.6), 0 0 24px rgba(251, 191, 36, 0.3) !important;
    animation: of-tile-glow 2s ease-in-out infinite;
    z-index: 50 !important;
}

.of-tile--top-score::before {
    content: "★";
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

@keyframes of-tile-glow {
    0%, 100% {
        box-shadow: 0 0 12px rgba(251, 191, 36, 0.6), 0 0 24px rgba(251, 191, 36, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(251, 191, 36, 0.8), 0 0 40px rgba(251, 191, 36, 0.4);
    }
}

/* Verbesserte Hover-States */
.of-tile:hover {
    transform: scale(1.08) !important;
    z-index: 100 !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25) !important;
}


/* ==========================================================================
   6. SCROLL-TO-TOP BUTTON
   ========================================================================== */

.of-scroll-top {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 48px;
    height: 48px;
    background: var(--of-bg-primary, #ffffff);
    border: 1px solid var(--of-border, #e2e8f0);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s var(--of-ease-out);
    box-shadow: var(--of-shadow-md);
    z-index: 9000;
}

.of-scroll-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.of-scroll-top:hover {
    transform: translateY(-3px);
    box-shadow: var(--of-shadow-lg);
    border-color: var(--of-accent-teal, #14b8a6);
}

.of-scroll-top__icon {
    width: 20px;
    height: 20px;
    color: var(--of-text-secondary, #64748b);
    transition: color 0.2s ease;
}

.of-scroll-top:hover .of-scroll-top__icon {
    color: var(--of-accent-teal, #14b8a6);
}

[data-theme="dark"] .of-scroll-top {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .of-scroll-top__icon {
    color: #94a3b8;
}

/* Mobile: Links unten positionieren, nicht mit Sticky Banner kollidieren */
@media (max-width: 1024px) {
    .of-scroll-top {
        bottom: 20px;
        left: 20px;
        width: 44px;
        height: 44px;
    }
}


/* ==========================================================================
   7. ALLGEMEINE VERBESSERUNGEN
   ========================================================================== */

/* Konsistente Card-Styles */
.of-card {
    background: var(--of-bg-primary, #ffffff);
    border: 1px solid var(--of-border, #e2e8f0);
    border-radius: var(--of-radius-lg);
    box-shadow: var(--of-shadow-sm);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.of-card:hover {
    box-shadow: var(--of-shadow-md);
}

[data-theme="dark"] .of-card {
    background: #1e293b;
    border-color: #334155;
}

/* Smooth Section Backgrounds */
.of-hero,
.of-market-insights,
.of-pricing {
    position: relative;
}

/* Focus States für Accessibility */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--of-accent-teal, #14b8a6);
    outline-offset: 2px;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .of-fade-in {
        opacity: 1;
        transform: none;
    }
}
