/* ============================================================
   TIPPSPIEL — Animations & Polish Layer  v1.0
   chiemgau-tipp.de  ·  WM / Dünya Kupası Tippspiel
   ------------------------------------------------------------
   ADDITIVE STYLESHEET — load this AFTER your main stylesheet.
   Reuses your existing design tokens (--accent, --bg-surface…).
   Does NOT change any colors, layout structure or branding.
   It only adds: entrance motion, micro-interactions, glow,
   shimmer, live-pulse and winner effects.
   ============================================================ */

/* ── EXTRA TOKENS (only motion, nothing visual) ───────────── */
:root {
    --anim-fast:   0.22s cubic-bezier(0.2, 0, 0, 1);
    --anim-base:   0.4s  cubic-bezier(0.2, 0, 0, 1);
    --anim-slow:   0.6s  cubic-bezier(0.16, 1, 0.3, 1);
    --spring:      cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── KEYFRAME LIBRARY ─────────────────────────────────────── */
@keyframes cf-fade-up {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes cf-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes cf-scale-in {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes cf-slide-left {
    from { opacity: 0; transform: translateX(-12px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes cf-shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes cf-pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.0); }
    50%      { box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.18); }
}
@keyframes cf-live-dot {
    0%, 100% { opacity: 1;   transform: scale(1); }
    50%      { opacity: 0.4; transform: scale(0.7); }
}
@keyframes cf-gold-sheen {
    0%   { background-position: -150% center; }
    60%, 100% { background-position: 250% center; }
}
@keyframes cf-bob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-2px); }
}
@keyframes cf-spin-in {
    from { opacity: 0; transform: rotate(-90deg) scale(0.5); }
    to   { opacity: 1; transform: rotate(0) scale(1); }
}

/* ── PAGE ENTRANCE — boxes / panels / info-boxes ──────────── */
.box,
.panel,
.info-box,
section.content > .row > [class*="col-"] {
    animation: cf-fade-up var(--anim-base) both;
}
/* Stagger consecutive boxes for a cascade feel */
.box:nth-of-type(1)  { animation-delay: 0.02s; }
.box:nth-of-type(2)  { animation-delay: 0.08s; }
.box:nth-of-type(3)  { animation-delay: 0.14s; }
.box:nth-of-type(4)  { animation-delay: 0.20s; }
.box:nth-of-type(5)  { animation-delay: 0.26s; }

.content-header h1,
section.content h1,
.page-header {
    animation: cf-slide-left var(--anim-base) both;
}

/* ── BOX HOVER LIFT ───────────────────────────────────────── */
.box {
    transition: transform var(--anim-fast),
                box-shadow var(--anim-fast),
                border-color var(--anim-fast) !important;
}
.box:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md) !important;
    border-color: var(--border-strong) !important;
}

/* ── INFO-BOX (sponsor / stat) HOVER ──────────────────────── */
.info-box {
    transition: transform var(--anim-fast), box-shadow var(--anim-fast) !important;
}
.info-box:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md) !important;
}
.info-box:hover .info-box-icon img,
.info-box:hover .sponsor-logo {
    transform: scale(1.06);
    transition: transform var(--anim-base) var(--spring);
}
.info-box-icon img,
.sponsor-logo { transition: transform var(--anim-base) var(--spring); }

/* ── SIDEBAR — staggered slide-in + hover slide ───────────── */
.sidebar-menu > li {
    animation: cf-slide-left var(--anim-base) both;
}
.sidebar-menu > li:nth-child(1)  { animation-delay: 0.04s; }
.sidebar-menu > li:nth-child(2)  { animation-delay: 0.07s; }
.sidebar-menu > li:nth-child(3)  { animation-delay: 0.10s; }
.sidebar-menu > li:nth-child(4)  { animation-delay: 0.13s; }
.sidebar-menu > li:nth-child(5)  { animation-delay: 0.16s; }
.sidebar-menu > li:nth-child(6)  { animation-delay: 0.19s; }
.sidebar-menu > li:nth-child(7)  { animation-delay: 0.22s; }
.sidebar-menu > li:nth-child(8)  { animation-delay: 0.25s; }
.sidebar-menu > li:nth-child(n+9){ animation-delay: 0.28s; }

.sidebar-menu > li > a { position: relative; }
.sidebar-menu > li:hover > a > i { transform: scale(1.12); }
.sidebar-menu > li > a > i { transition: transform var(--anim-fast) var(--spring), opacity var(--transition) !important; }

/* Active item glow accent on the left bar */
.sidebar-menu > li.active > a {
    box-shadow: inset 3px 0 0 var(--accent), 0 0 18px -6px var(--accent-glow);
}

/* ── BUTTONS — sheen sweep + lift ─────────────────────────── */
.btn {
    position: relative;
    overflow: hidden;
    transition: transform var(--anim-fast), box-shadow var(--anim-fast),
                background var(--transition), border-color var(--transition) !important;
}
.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 30%,
                rgba(255, 255, 255, 0.22) 50%, transparent 70%);
    transform: translateX(-120%);
    transition: transform 0.55s var(--ease);
    pointer-events: none;
}
.btn:hover::after { transform: translateX(120%); }

.btn-primary:hover,
.btn-info:hover,
.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px -6px var(--accent-glow);
}
.btn-success:hover { box-shadow: 0 6px 18px -6px rgba(34, 197, 94, 0.45); }

/* Save bar CTA gets a soft idle pulse so users notice it */
.tipp-save-bar .btn-primary,
.tipp-save-bar .btn-success,
input[type="submit"].form-control.btn {
    animation: cf-pulse-glow 3.2s ease-in-out infinite;
}
.tipp-save-bar .btn-primary:hover,
.tipp-save-bar .btn-success:hover { animation: none; }

/* ── FORM CONTROLS — smooth focus grow ────────────────────── */
.form-control {
    transition: border-color var(--transition), box-shadow var(--transition),
                background var(--transition) !important;
}

/* ── TIPP SCORE INPUTS — focus pop ────────────────────────── */
input.tippValue,
input.addTipp {
    transition: border-color var(--anim-fast),
                box-shadow var(--anim-fast),
                transform var(--anim-fast) var(--spring),
                color var(--anim-fast) !important;
}
input.tippValue:focus,
input.addTipp:focus {
    transform: scale(1.12);
    color: var(--accent) !important;
}
/* When a tipp has a value, the wrapper glows subtly */
.tipp-card__input-group:focus-within {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
    transition: border-color var(--anim-fast), box-shadow var(--anim-fast);
}

/* ── TIPP MATCH CARDS — reveal + interactive depth ────────── */
.tipp-card {
    animation: cf-fade-up var(--anim-base) both;
    transition: background var(--transition),
                transform var(--anim-fast),
                box-shadow var(--anim-fast) !important;
}
.tipp-card:nth-child(1)  { animation-delay: 0.03s; }
.tipp-card:nth-child(2)  { animation-delay: 0.07s; }
.tipp-card:nth-child(3)  { animation-delay: 0.11s; }
.tipp-card:nth-child(4)  { animation-delay: 0.15s; }
.tipp-card:nth-child(5)  { animation-delay: 0.19s; }
.tipp-card:nth-child(6)  { animation-delay: 0.23s; }
.tipp-card:nth-child(7)  { animation-delay: 0.27s; }
.tipp-card:nth-child(n+8){ animation-delay: 0.30s; }

.tipp-card:hover {
    box-shadow: inset 3px 0 0 var(--accent);
    z-index: 1;
}

/* Team logos pop on card hover */
.tipp-card:hover .tipp-card__logo-wrap {
    border-color: var(--border-strong);
    transition: border-color var(--anim-fast);
}
.tipp-card__logo {
    transition: transform var(--anim-base) var(--spring);
}
.tipp-card:hover .tipp-card__logo { transform: scale(1.1); }

/* The result score gets a gentle entrance pop */
.tipp-card__result {
    transition: transform var(--anim-fast) var(--spring), color var(--transition);
}
.tipp-card:hover .tipp-card__result { transform: scale(1.05); }

/* Your tipp pill subtle bob on hover */
.tipp-card:hover .tipp-card__tipp--value {
    animation: cf-bob 1.4s ease-in-out infinite;
}

/* ── POINTS BADGES — gold winner sheen ────────────────────── */
.tipp-card__points {
    transition: transform var(--anim-fast) var(--spring);
}
.tipp-card:hover .tipp-card__points { transform: scale(1.05); }

/* Gold (exact score) gets an animated light sweep */
.tipp-card__points--gold {
    background: linear-gradient(110deg,
        rgba(245, 158, 11, 0.12) 0%,
        rgba(245, 158, 11, 0.30) 45%,
        rgba(245, 158, 11, 0.12) 60%) !important;
    background-size: 250% 100% !important;
    animation: cf-gold-sheen 4s ease-in-out infinite;
}

/* ── LIVE MATCH PULSE ─────────────────────────────────────── */
/* Add class .tipp-card--live to a running match's card.
   Add <span class="live-dot"></span> inside the meta row.  */
.tipp-card--live {
    background: linear-gradient(90deg,
        rgba(239, 68, 68, 0.05), transparent 40%) !important;
}
.live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5);
    animation: cf-live-dot 1.1s ease-in-out infinite;
    margin-right: 5px;
    vertical-align: middle;
}

/* ── TABLE / LEADERBOARD — row reveal & hover ─────────────── */
.table > tbody > tr {
    animation: cf-fade-in var(--anim-fast) both;
}
.table > tbody > tr:nth-child(1)  { animation-delay: 0.02s; }
.table > tbody > tr:nth-child(2)  { animation-delay: 0.05s; }
.table > tbody > tr:nth-child(3)  { animation-delay: 0.08s; }
.table > tbody > tr:nth-child(4)  { animation-delay: 0.11s; }
.table > tbody > tr:nth-child(5)  { animation-delay: 0.14s; }
.table > tbody > tr:nth-child(n+6){ animation-delay: 0.16s; }

.table > tbody > tr {
    transition: background var(--transition), box-shadow var(--anim-fast) !important;
}
.table > tbody > tr:hover {
    box-shadow: inset 2px 0 0 var(--accent);
}

/* Top-3 leaderboard rows — soft medal tint on first column.
   Add class .rank-1 / .rank-2 / .rank-3 to those <tr> rows. */
.table > tbody > tr.rank-1 > td:first-child { box-shadow: inset 3px 0 0 #f59e0b; }
.table > tbody > tr.rank-2 > td:first-child { box-shadow: inset 3px 0 0 #cbd5e1; }
.table > tbody > tr.rank-3 > td:first-child { box-shadow: inset 3px 0 0 #d97757; }

/* Marked column (your own column) gentle pulse the first time */
.markedColumn { transition: background var(--transition) !important; }

/* ── TENDENCY ARROWS — animated entrance ──────────────────── */
.tendency-up,
.tendency-down {
    display: inline-block;
    animation: cf-spin-in var(--anim-base) var(--spring) both;
}
.tendency-up   { animation-name: cf-spin-in; }
.tendency-down { animation-name: cf-spin-in; }

/* ── TIPP RESULT ICONS — gold / green emphasis ────────────── */
.tipp-correct  { animation: cf-bob 2s ease-in-out infinite; display: inline-block; }
.tipp-tendency { animation: cf-fade-in var(--anim-base) both; display: inline-block; }

/* ── LABELS / BADGES — interactive ────────────────────────── */
.label, .badge {
    transition: transform var(--anim-fast) var(--spring) !important;
}
.label:hover, .badge:hover { transform: scale(1.08); }

/* ── ALERTS — slide in ────────────────────────────────────── */
.alert { animation: cf-fade-up var(--anim-base) both; }

/* ── MODALS — scale-in entrance ───────────────────────────── */
.modal.in .modal-dialog {
    animation: cf-scale-in var(--anim-fast) var(--spring) both;
}

/* ── DROPDOWNS — fade/scale from top ──────────────────────── */
.dropdown-menu {
    transform-origin: top right;
    animation: cf-scale-in 0.16s var(--ease) both;
}

/* ── NAV TABS — animated active underline ─────────────────── */
.nav-tabs > li > a { position: relative; }
.nav-tabs > li > a::after {
    content: '';
    position: absolute;
    left: 12px; right: 12px; bottom: -1px;
    height: 2px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform var(--anim-fast) var(--ease);
}
.nav-tabs > li.active > a::after { transform: scaleX(1); }

/* ── PAGINATION — already lifts; add focus ring ───────────── */
div.dataTables_wrapper div.dataTables_paginate .paginate_button {
    transition: all var(--anim-fast) !important;
}

/* ── LOADING SHIMMER (skeleton) ───────────────────────────── */
/* Add class .cf-skeleton to any placeholder element while data loads */
.cf-skeleton {
    background: linear-gradient(90deg,
        var(--bg-elevated) 25%,
        var(--bg-raised)   50%,
        var(--bg-elevated) 75%);
    background-size: 200% 100%;
    animation: cf-shimmer 1.4s linear infinite;
    border-radius: var(--radius-sm);
    color: transparent !important;
    pointer-events: none;
}

/* ── HEADER LOGO — subtle entrance ────────────────────────── */
.skin-blue .main-header .logo { animation: cf-fade-in var(--anim-slow) both; }

/* ── FOCUS-VISIBLE ACCESSIBILITY RING (keyboard nav) ──────── */
a:focus-visible,
.btn:focus-visible,
.form-control:focus-visible,
.paginate_button:focus-visible {
    outline: 2px solid var(--accent) !important;
    outline-offset: 2px !important;
}

/* ============================================================
   REDUCED MOTION — respect OS / user preference.
   Disables all decorative animation; keeps functionality.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
    .btn::after { display: none; }
}