/* ═══════════════════════════════════════════════════════════════════
   animatedDropdown.css — Globální animovaný design Bootstrap dropdownů.
   Cílí na .dropdown-menu / .dropdown-item, aplikuje se napříč všemi
   panely (GPS, Admin, DefaultPanel, Authentication, Dev).
   ═══════════════════════════════════════════════════════════════════ */

:root {
    /* Tokens lze override per-tema/per-provider */
    --rdd-bg: #ffffff;
    --rdd-bg-hover: linear-gradient(90deg, rgba(32,107,196,0.10), rgba(32,107,196,0.02));
    --rdd-text: #1d273b;
    --rdd-text-muted: #6c7a91;
    --rdd-text-hover: var(--brand-primary, #206bc4);
    --rdd-divider: rgba(15, 23, 42, 0.06);
    --rdd-radius: 14px;
    --rdd-item-radius: 10px;
    --rdd-shadow: 0 10px 30px rgba(15, 23, 42, 0.12),
                  0 2px 6px rgba(15, 23, 42, 0.06),
                  0 0 0 1px rgba(15, 23, 42, 0.04);
    --rdd-accent: var(--brand-primary, #206bc4);
    --rdd-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --rdd-duration: 260ms;
    --rdd-item-stagger: 35ms;
}

/* ── Container ─────────────────────────────────────────────────── */
/* Pozor: NEPOUZIVAME composite `transform` na .dropdown-menu, protoze
   Bootstrap Popper nastavuje vlastni `transform: translate3d(...)`
   inline pro pozicovani. Animujeme pres individualni properties
   `translate` + `scale`, ktere browser kombinuje s Popper transform. */
.dropdown-menu {
    background: var(--rdd-bg);
    border: none !important;
    border-radius: var(--rdd-radius) !important;
    box-shadow: var(--rdd-shadow) !important;
    padding: 8px !important;
    min-width: 220px;
}

/* Entrance animace — spustí se ve chvíli, kdy Bootstrap přidá .show */
.dropdown-menu.show {
    animation: rdd-menu-in var(--rdd-duration) var(--rdd-ease);
}

@keyframes rdd-menu-in {
    0% {
        opacity: 0;
        translate: 0 -8px;
        scale: 0.96;
        filter: blur(2px);
    }
    60% {
        filter: blur(0);
    }
    100% {
        opacity: 1;
        translate: 0 0;
        scale: 1;
        filter: blur(0);
    }
}

/* ── Items ─────────────────────────────────────────────────────── */
.dropdown-menu .dropdown-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px !important;
    margin: 2px 0;
    border-radius: var(--rdd-item-radius);
    color: var(--rdd-text);
    font-weight: 500;
    text-decoration: none;
    background: transparent;
    transition: color 180ms var(--rdd-ease),
                background 220ms var(--rdd-ease),
                transform 220ms var(--rdd-ease),
                padding-left 220ms var(--rdd-ease);
    overflow: hidden;
}

/* Levý akcentový pruh — vyjíždí při hoveru */
.dropdown-menu .dropdown-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 12%;
    bottom: 12%;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--rdd-accent);
    transform: scaleY(0);
    transform-origin: center;
    transition: transform 220ms var(--rdd-ease);
}

.dropdown-menu .dropdown-item:hover,
.dropdown-menu .dropdown-item:focus,
.dropdown-menu .dropdown-item.active {
    background: var(--rdd-bg-hover);
    color: var(--rdd-text-hover);
    padding-left: 18px !important;
    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.06);
}

.dropdown-menu .dropdown-item:hover::before,
.dropdown-menu .dropdown-item:focus::before,
.dropdown-menu .dropdown-item.active::before {
    transform: scaleY(1);
}

/* Ikona uvnitř itemu — Material Icons + Tabler SVG */
.dropdown-menu .dropdown-item .material-icons,
.dropdown-menu .dropdown-item .icon {
    transition: color 180ms var(--rdd-ease),
                transform 220ms var(--rdd-ease),
                filter 220ms var(--rdd-ease);
    color: var(--rdd-text-muted);
}

.dropdown-menu .dropdown-item:hover .material-icons,
.dropdown-menu .dropdown-item:hover .icon,
.dropdown-menu .dropdown-item:focus .material-icons,
.dropdown-menu .dropdown-item:focus .icon {
    color: var(--rdd-accent);
    transform: scale(1.08);
    filter: drop-shadow(0 1px 2px rgba(32,107,196,0.25));
}

/* Active state — výrazněji */
.dropdown-menu .dropdown-item.active {
    background: linear-gradient(90deg, rgba(32,107,196,0.18), rgba(32,107,196,0.04)) !important;
    color: var(--rdd-accent) !important;
    font-weight: 600;
}

/* Disabled */
.dropdown-menu .dropdown-item.disabled,
.dropdown-menu .dropdown-item:disabled {
    color: var(--rdd-text-muted);
    opacity: 0.5;
    cursor: not-allowed;
    background: transparent !important;
    padding-left: 14px !important;
}

.dropdown-menu .dropdown-item.disabled::before,
.dropdown-menu .dropdown-item:disabled::before {
    transform: scaleY(0) !important;
}

/* ── Stagger animace itemů ──────────────────────────────────────── */
.dropdown-menu.show .dropdown-item,
.dropdown-menu.show > li,
.dropdown-menu.show .dropdown-divider,
.dropdown-menu.show .dropdown-header {
    animation: rdd-item-in 320ms var(--rdd-ease) both;
}

.dropdown-menu.show > :nth-child(1) { animation-delay: calc(var(--rdd-item-stagger) * 1); }
.dropdown-menu.show > :nth-child(2) { animation-delay: calc(var(--rdd-item-stagger) * 2); }
.dropdown-menu.show > :nth-child(3) { animation-delay: calc(var(--rdd-item-stagger) * 3); }
.dropdown-menu.show > :nth-child(4) { animation-delay: calc(var(--rdd-item-stagger) * 4); }
.dropdown-menu.show > :nth-child(5) { animation-delay: calc(var(--rdd-item-stagger) * 5); }
.dropdown-menu.show > :nth-child(6) { animation-delay: calc(var(--rdd-item-stagger) * 6); }
.dropdown-menu.show > :nth-child(7) { animation-delay: calc(var(--rdd-item-stagger) * 7); }
.dropdown-menu.show > :nth-child(8) { animation-delay: calc(var(--rdd-item-stagger) * 8); }
.dropdown-menu.show > :nth-child(n+9) { animation-delay: calc(var(--rdd-item-stagger) * 9); }

@keyframes rdd-item-in {
    0% {
        opacity: 0;
        transform: translateX(-10px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ── Divider & Header ───────────────────────────────────────────── */
.dropdown-menu .dropdown-divider {
    border: 0;
    border-top: 1px solid var(--rdd-divider);
    margin: 6px 4px;
}

.dropdown-menu .dropdown-header {
    color: var(--rdd-text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 8px 14px 4px;
}

/* ── Toggle button — jemná interakce ────────────────────────────── */
.dropdown-toggle {
    transition: transform 200ms var(--rdd-ease);
}

.dropdown-toggle::after {
    transition: transform 240ms var(--rdd-ease);
}

.dropdown-toggle[aria-expanded="true"]::after {
    transform: rotate(180deg);
}

/* ── Dark navbar variant (mobile collapse + dark navbar dropdowns) ─ */
@media screen and (max-width: 767.98px) {
    .navbar .dropdown-menu.show {
        background: rgba(15, 23, 42, 0.96);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        padding: 8px !important;
    }

    .navbar .dropdown-menu .dropdown-item {
        color: rgba(255, 255, 255, 0.85);
    }

    .navbar .dropdown-menu .dropdown-item:hover,
    .navbar .dropdown-menu .dropdown-item:focus {
        background: rgba(255, 255, 255, 0.10);
        color: #ffffff;
        text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.4);
    }

    .navbar .dropdown-menu .dropdown-item .material-icons,
    .navbar .dropdown-menu .dropdown-item .icon {
        color: rgba(255, 255, 255, 0.6);
    }

    .navbar .dropdown-menu .dropdown-item:hover .material-icons,
    .navbar .dropdown-menu .dropdown-item:hover .icon {
        color: #ffffff;
    }

    .navbar .dropdown-menu .dropdown-divider {
        border-top-color: rgba(255, 255, 255, 0.08);
    }
}

/* ── Tabler dropdown-menu-arrow (šipka nahoře) ────────────────────── */
.dropdown-menu.dropdown-menu-arrow::before {
    border-bottom-color: var(--rdd-bg);
    filter: drop-shadow(0 -1px 1px rgba(15, 23, 42, 0.05));
}

/* ── Respect reduced motion ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .dropdown-menu.show,
    .dropdown-menu.show > *,
    .dropdown-menu .dropdown-item,
    .dropdown-menu .dropdown-item::before,
    .dropdown-menu .dropdown-item .material-icons,
    .dropdown-menu .dropdown-item .icon,
    .dropdown-toggle::after {
        animation: none !important;
        transition: none !important;
    }
}
