/* ═══════════════════════════════════════════════
   Kirchhof Mobile CTA Dock – Frontend Styles
   Version: 1.3.0 – Desktop FAB + mobile dock
   ═══════════════════════════════════════════════ */

:root {
    --kmc-brand-blue: #1A3172;
    --kmc-brand-green: #0F7B53;
    --kmc-wa-green-1: #58DB6C;
    --kmc-wa-green-2: #22BF5B;
    --kmc-bg: rgba(255, 255, 255, 0.92);
    --kmc-text-primary: #1A3172;
    --kmc-text-emergency: #0F7B53;
    --kmc-dock-h: 56px;
    --kmc-notch-h: 28px;
    --kmc-fab-size: 54px;
    --kmc-fab-size-desktop: 60px;
    --kmc-fab-border: 4px;
    --kmc-side-margin: 12px;
    --kmc-safe-bottom: env(safe-area-inset-bottom, 0px);
    --kmc-font: 600 clamp(11px, 3.2vw, 13px) / 1.1 'Work Sans', Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* ─── Dock: hidden on desktop ─── */
.kmc-dock {
    display: none;
}

/* ═══════════════════════════════════════════════
   WHATSAPP FAB – Always visible (desktop + mobile)
   ═══════════════════════════════════════════════ */

/* Desktop default: bottom-right corner */
.kmc-wa-fab {
    position: fixed;
    right: 28px;
    bottom: 28px;
    z-index: 999999;
    width: var(--kmc-fab-size-desktop);
    height: var(--kmc-fab-size-desktop);
    border-radius: 50%;
    background: linear-gradient(145deg, var(--kmc-wa-green-1) 0%, #2CCB63 40%, var(--kmc-wa-green-2) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border: 3px solid #ffffff;
    background-clip: padding-box;
    box-shadow:
        0 4px 20px rgba(37, 211, 102, 0.3),
        0 2px 8px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.5),
        inset 0 1px 1px rgba(255, 255, 255, 0.3);
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.2s ease;
    cursor: pointer;
    animation: kmc-float 3s ease-in-out infinite;
}

@keyframes kmc-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

.kmc-wa-fab:hover {
    animation-play-state: paused;
    transform: scale(1.1);
    box-shadow:
        0 8px 28px rgba(37, 211, 102, 0.4),
        0 4px 12px rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(255, 255, 255, 0.5),
        inset 0 1px 1px rgba(255, 255, 255, 0.3);
}

.kmc-wa-fab:active {
    transform: scale(0.92);
    box-shadow:
        0 2px 10px rgba(37, 211, 102, 0.35),
        0 1px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.08s ease;
}

.kmc-wa-fab__icon {
    width: 28px;
    height: 28px;
    display: block;
}

/* Pulse ring */
.kmc-wa-fab__pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    pointer-events: none;
    animation: kmc-pulse 3s ease-in-out infinite;
}

@keyframes kmc-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.35); }
    50%      { box-shadow: 0 0 0 12px rgba(37, 211, 102, 0); }
}

/* ═══════════════════════════════════════════════
   MOBILE ONLY – Dock bar + FAB repositioned
   ═══════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* ─── Show dock ─── */
    .kmc-dock {
        display: block !important;
        position: fixed !important;
        left: var(--kmc-side-margin);
        right: var(--kmc-side-margin);
        bottom: var(--kmc-safe-bottom, 0px);
        z-index: 999999 !important;
        pointer-events: none;
        opacity: 0;
        transform: translateY(100%);
        transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                    transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
        animation: kmc-fallback-show 0.5s cubic-bezier(0.16, 1, 0.3, 1) 2s both;
    }

    .kmc-dock--visible {
        opacity: 1 !important;
        transform: translateY(0) !important;
        animation: none !important;
    }

    @keyframes kmc-fallback-show {
        to { opacity: 1; transform: translateY(0); }
    }

    .kmc-dock > * {
        pointer-events: auto;
    }

    /* ─── Dock Bar ─── */
    .kmc-dock__bar {
        position: relative;
        width: 100%;
        height: calc(var(--kmc-dock-h) + var(--kmc-notch-h));
        display: grid;
        grid-template-columns: 1fr 1fr;
        align-items: end;
        padding: 0 20px 12px;
        background: none;
    }

    .kmc-dock__bg-shape {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        color: var(--kmc-bg);
        pointer-events: none;
        z-index: -1;
        filter:
            drop-shadow(0 -3px 12px rgba(0, 0, 0, 0.06))
            drop-shadow(0 -1px 3px rgba(0, 0, 0, 0.04));
    }

    /* ─── Dock Buttons ─── */
    .kmc-dock__btn {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        text-decoration: none;
        background: transparent;
        padding: 8px 10px;
        border-radius: 999px;
        font: var(--kmc-font);
        letter-spacing: 0.02em;
        transition: background-color 0.18s ease,
                    transform 0.18s ease;
        -webkit-tap-highlight-color: transparent;
        position: relative;
        z-index: 1;
    }

    .kmc-dock__btn:active {
        transform: scale(0.93);
        transition: transform 0.08s ease;
    }

    .kmc-dock__btn--kontakt {
        justify-self: start;
        color: var(--kmc-text-primary);
    }

    .kmc-dock__btn--phone {
        justify-self: end;
        color: var(--kmc-text-emergency);
        display: flex;
        align-items: center;
        gap: 0.4rem;
    }

    .kmc-dock__btn--phone .kmc-dock__label {
        white-space: nowrap;
    }

    /* ─── Icons ─── */
    .kmc-dock__icon {
        width: clamp(16px, 5vw, 19px);
        height: clamp(16px, 5vw, 19px);
        flex-shrink: 0;
    }

    .kmc-dock__icon--ring {
        transform-origin: 55% 55%;
        animation: kmc-ring 3.2s ease-in-out infinite;
    }

    @keyframes kmc-ring {
        0%, 42%, 100% { transform: rotate(0deg); }
        6%  { transform: rotate(-14deg); }
        12% { transform: rotate(12deg); }
        18% { transform: rotate(-10deg); }
        24% { transform: rotate(8deg); }
        30% { transform: rotate(-5deg); }
        36% { transform: rotate(2deg); }
    }

    .kmc-dock__label {
        user-select: none;
        -webkit-user-select: none;
    }

    /* ─── FAB override: reposition into the cup on mobile ─── */
    .kmc-wa-fab {
        position: fixed;
        right: auto;
        left: 50%;
        bottom: calc(var(--kmc-dock-h) + var(--kmc-safe-bottom, 0px) - 22px);
        transform: translateX(-50%);
        width: var(--kmc-fab-size);
        height: var(--kmc-fab-size);
        z-index: 1000000;
        /* Match dock entrance */
        opacity: 0;
        transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1);
        animation: kmc-fab-mobile-show 0.3s ease 2.2s both;
    }

    .kmc-dock--visible ~ .kmc-wa-fab,
    .kmc-wa-fab.kmc-wa-fab--mobile-visible {
        opacity: 1 !important;
        animation: none !important;
    }

    @keyframes kmc-fab-mobile-show {
        to { opacity: 1; }
    }

    .kmc-wa-fab:hover {
        transform: translateX(-50%);
    }

    .kmc-wa-fab:active {
        transform: translateX(-50%) scale(0.9);
        transition: transform 0.08s ease;
    }

    .kmc-wa-fab__icon {
        width: 24px;
        height: 24px;
    }

    /* ═══════════════════════════════════════════════
       DARK MODE
       ═══════════════════════════════════════════════ */
    @media (prefers-color-scheme: dark) {
        :root {
            --kmc-bg: rgba(18, 20, 26, 0.92);
            --kmc-text-primary: #c8d0e8;
            --kmc-text-emergency: #6fcfa4;
        }

        .kmc-dock__bg-shape {
            filter:
                drop-shadow(0 -3px 12px rgba(0, 0, 0, 0.2))
                drop-shadow(0 -1px 3px rgba(0, 0, 0, 0.15));
        }

        .kmc-wa-fab {
            border-color: rgba(40, 44, 56, 0.9);
        }
    }

    /* ═══════════════════════════════════════════════
       REDUCED MOTION
       ═══════════════════════════════════════════════ */
    @media (prefers-reduced-motion: reduce) {
        .kmc-dock {
            transition: none !important;
            opacity: 1 !important;
            transform: translateY(0) !important;
        }

        .kmc-dock__icon--ring {
            animation: none !important;
        }

        .kmc-wa-fab__pulse {
            animation: none !important;
            display: none;
        }

        .kmc-dock__btn:active,
        .kmc-wa-fab:active {
            transform: none !important;
            transition: none !important;
        }

        .kmc-wa-fab {
            transition: none !important;
        }
    }

    /* ═══════════════════════════════════════════════
       VERY SMALL SCREENS
       ═══════════════════════════════════════════════ */
    @media (max-width: 380px) {
        :root {
            --kmc-fab-size: 48px;
            --kmc-dock-h: 50px;
            --kmc-notch-h: 24px;
            --kmc-fab-border: 3px;
            --kmc-side-margin: 8px;
        }

        .kmc-wa-fab__icon {
            width: 20px;
            height: 20px;
        }
    }

    @media (max-width: 330px) {
        :root {
            --kmc-fab-size: 44px;
            --kmc-dock-h: 46px;
            --kmc-notch-h: 22px;
            --kmc-side-margin: 6px;
        }

        .kmc-dock__btn {
            padding: 6px 6px;
            gap: 0.3rem;
        }

        .kmc-dock__label {
            font-size: 10px;
        }
    }

} /* end @media max-width: 768px */

/* ═══════════════════════════════════════════════
   DESKTOP DARK MODE for FAB
   ═══════════════════════════════════════════════ */
@media (min-width: 769px) and (prefers-color-scheme: dark) {
    .kmc-wa-fab {
        border-color: rgba(40, 44, 56, 0.9);
    }
}

@media (min-width: 769px) and (prefers-reduced-motion: reduce) {
    .kmc-wa-fab__pulse {
        animation: none !important;
        display: none;
    }

    .kmc-wa-fab {
        transition: none !important;
    }

    .kmc-wa-fab:hover,
    .kmc-wa-fab:active {
        transform: none !important;
    }
}
