/* ===== FLOATING CONTACT WIDGET - STEAMWEB ===== */
@import url('chatbot/chatbot.css');

:root {
    --steam-orange: #F2561D;
    --steam-teal: #3FA6A6;
    --steam-teal-dark: #206A73;
    --steam-dark: #00010D;
}

.floating-contact-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    overflow: visible;
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    /* metade do trigger: centro da engrenagem = origem do fan + linhas */
    --fc-trigger-half: 50px;
    /* raio do arco dos ícones (menor = mais perto do botão, alinhado à cunha decorativa) */
    --fc-radius-base: 86px;
    --fc-radius-offset: 8px;
    --fc-radius: calc(var(--fc-radius-base) + var(--fc-radius-offset));
    /* metade do botão 46px — translate fixo (evita deslocar com width no hover) */
    --fc-icon-half: 23px;
}

/* ===== CAMPO DE ENERGIA (fundo futurista — fora do fluxo flex, atrás do menu/botão) ===== */
/* Canto inferior direito do viewBox SVG = centro da engrenagem — mesmo critério do .floating-contact-fan (left/bottom: --fc-trigger-half) */
.floating-contact-energy {
    position: absolute;
    left: auto;
    top: auto;
    right: var(--fc-trigger-half);
    bottom: var(--fc-trigger-half);
    width: min(260px, 68vw);
    height: min(260px, 48vh);
    max-width: 260px;
    max-height: 260px;
    pointer-events: none;
    z-index: 0;
    flex: none;
    margin: 0;
    padding: 0;
    border-top-left-radius: min(140px, 80vw);
    border-bottom-right-radius: 44px;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.96);
    transform-origin: 100% 100%;
    transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1), transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-contact-widget:has(.floating-contact-menu.is-open) .floating-contact-energy {
    opacity: 1;
    transform: scale(1);
}

.floating-contact-energy__svg {
    display: block;
    width: 100%;
    height: 100%;
}

.floating-contact-energy__svg--mobile {
    display: none;
}

.floating-contact-energy__ring {
    vector-effect: non-scaling-stroke;
    animation: fcHudDash 2.4s linear infinite;
}

.floating-contact-energy__ring--b {
    animation-duration: 3.1s;
    animation-direction: reverse;
}

.floating-contact-energy__ring--c {
    animation-duration: 2.7s;
}

.floating-contact-energy__ring--d {
    animation-duration: 3.6s;
    animation-direction: reverse;
}

.floating-contact-energy__ring--e {
    animation-duration: 2.2s;
}

@keyframes fcHudDash {
    to {
        stroke-dashoffset: -120;
    }
}

@media (prefers-reduced-motion: reduce) {
    .floating-contact-energy__ring {
        animation: none;
    }
}

/* quando a página já foi rolada, reduz um pouco o widget */
.floating-contact-widget.is-scrolled .floating-contact-trigger {
    width: 90px;
    height: 90px;
}

.floating-contact-widget.is-scrolled .floating-contact-gear {
    width: 36px;
    height: 36px;
}

.floating-contact-widget.is-scrolled .floating-contact-pulse {
    transform: scale(0.9);
}

.floating-contact-widget.is-scrolled {
    --fc-trigger-half: 45px;
}

.floating-contact-widget.is-scrolled .floating-contact-menu {
    height: 90px;
}

/* ===== TRIGGER ===== */
.floating-contact-trigger {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    transition: all 0.3s cubic-bezier(0.16,1,0.3,1);
    backdrop-filter: blur(10px);
    padding: 0;
    flex-shrink: 0;
    z-index: 10;
}

    .floating-contact-trigger:hover {
        transform: scale(1.1) translateY(-5px);
        color: var(--steam-orange);
        box-shadow: 0 0 30px rgba(242,86,29,0.32);
    }

    .floating-contact-trigger:active {
        transform: scale(0.95);
    }

/* ===== GEAR ===== */
.floating-contact-gear {
    width: 38px;
    height: 38px;
    animation: rotate-gear 20s linear infinite;
    transition: color 0.3s;
    pointer-events: none;
}

.floating-contact-trigger-image {
    display: block;
    width: 100px;
    height: 100px;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(63,166,166,0.35));
}

.floating-contact-widget.is-scrolled .floating-contact-trigger-image {
    width: 90px;
    height: 90px;
}

.floating-contact-trigger:hover .floating-contact-gear {
    animation: rotate-gear 6s linear infinite;
}

@keyframes rotate-gear {
    to {
        transform: rotate(360deg);
    }
}

/* ===== PULSE ===== */
.floating-contact-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--steam-teal);
    animation: pulse-ring 2s ease-out infinite;
    pointer-events: none;
}

@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }

    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

/* ===== MENU ===== */
.floating-contact-menu {
    position: relative;
    width: 0;
    height: 100px;
    overflow: visible;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.16,1,0.3,1), visibility 0.3s cubic-bezier(0.16,1,0.3,1);
    pointer-events: none;
    flex-shrink: 0;
    z-index: 3;
}

    .floating-contact-menu.is-open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        /* Acima da engrenagem (z-index 10): filhos não “saltam” por cima só com z-index interno */
        z-index: 20;
    }

/* ===== FAN — centro = centro do botão (mesma origem que o SVG) ===== */
.floating-contact-fan {
    position: absolute;
    left: var(--fc-trigger-half);
    bottom: var(--fc-trigger-half);
    width: 0;
    height: 0;
    z-index: 2;
    pointer-events: none;
}

    .floating-contact-fan .floating-contact-item {
        pointer-events: auto;
    }

/* ===== ITEM BASE ===== */
/* O item fica sempre 46×46 (centro na origem do fan); o pill expande no .floating-contact-item-surface */
button.floating-contact-item {
    appearance: none;
    border: none;
    background: none;
    padding: 0;
    margin: 0;
    font: inherit;
    cursor: pointer;
    text-align: inherit;
}

.floating-contact-item {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 46px;
    height: 46px;
    margin: 0;
    z-index: 1;
    transform-origin: center center;
    transform: translate(calc(-1 * var(--fc-icon-half)), var(--fc-icon-half)) scale(0);
    display: block;
    text-decoration: none;
    overflow: visible;
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.16,1,0.3,1), opacity 0.35s cubic-bezier(0.16,1,0.3,1), z-index 0s;
}

.floating-contact-item:hover,
.floating-contact-item:focus-within {
    z-index: 100;
}

/* Borda direita da pílula = centro do <a> (eixo do ícone no arco): left 50% + translateX(-100%) alinha a direita ao centro; o conteúdo [rótulo][ícone] fica à esquerda do ícone */
.floating-contact-item-surface {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-100%, -50%);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    box-sizing: border-box;
    min-width: 46px;
    width: 46px;
    height: 46px;
    padding: 0 0 0 10px;
    border-radius: 50%;
    background: rgba(0,1,13,0.85);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(63,166,166,0.4);
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    overflow: hidden;
    white-space: nowrap;
    transition: width 0.3s cubic-bezier(0.16,1,0.3,1), border-radius 0.3s cubic-bezier(0.16,1,0.3,1), border-color 0.3s, background 0.3s, box-shadow 0.3s;
}

/* ===== ARCO ABERTO (itens no .floating-contact-fan — filhos 1–5, passo 22,5°) ===== */
.floating-contact-menu.is-open .floating-contact-fan .floating-contact-item:nth-child(1) {
    opacity: 1;
    /* 0° */
    transform: translate(calc(-1 * var(--fc-icon-half)), var(--fc-icon-half)) rotate(-0deg) translateY(calc(-1 * var(--fc-radius))) rotate(0deg) scale(1);
    transition-delay: 0.05s;
}

.floating-contact-menu.is-open .floating-contact-fan .floating-contact-item:nth-child(2) {
    opacity: 1;
    /* 22,5° */
    transform: translate(calc(-1 * var(--fc-icon-half)), var(--fc-icon-half)) rotate(-22.5deg) translateY(calc(-1 * var(--fc-radius))) rotate(22.5deg) scale(1);
    transition-delay: 0.11s;
}

.floating-contact-menu.is-open .floating-contact-fan .floating-contact-item:nth-child(3) {
    opacity: 1;
    /* 45° */
    transform: translate(calc(-1 * var(--fc-icon-half)), var(--fc-icon-half)) rotate(-45deg) translateY(calc(-1 * var(--fc-radius))) rotate(45deg) scale(1);
    transition-delay: 0.17s;
}

.floating-contact-menu.is-open .floating-contact-fan .floating-contact-item:nth-child(4) {
    opacity: 1;
    /* 67,5° */
    transform: translate(calc(-1 * var(--fc-icon-half)), var(--fc-icon-half)) rotate(-67.5deg) translateY(calc(-1 * var(--fc-radius))) rotate(67.5deg) scale(1);
    transition-delay: 0.23s;
}

.floating-contact-menu.is-open .floating-contact-fan .floating-contact-item:nth-child(5) {
    opacity: 1;
    /* 90° */
    transform: translate(calc(-1 * var(--fc-icon-half)), var(--fc-icon-half)) rotate(-90deg) translateY(calc(-1 * var(--fc-radius))) rotate(90deg) scale(1);
    transition-delay: 0.29s;
}

/* ===== ÍCONE ===== */
.floating-contact-item-icon {
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
}

    .floating-contact-item-icon svg {
        width: 22px;
        height: 22px;
        fill: currentColor;
    }

/* ===== LABEL ===== */
.floating-contact-item-label {
    flex: 0 1 auto;
    min-width: 0;
    display: block;
    max-width: 0;
    overflow: hidden;
    opacity: 0;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255,255,255,0.92);
    text-shadow: 0 1px 10px rgba(0,0,0,0.55);
    text-align: right;
    transition: max-width 0.35s cubic-bezier(0.16,1,0.3,1), opacity 0.25s ease;
    padding-right: 0;
    pointer-events: none;
}

/* ===== HOVER ===== */
.floating-contact-item:hover .floating-contact-item-surface {
    width: 220px;
    border-radius: 50px;
    overflow: visible;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

    .floating-contact-item:hover .floating-contact-item-icon {
        transform: scale(1.1) rotate(8deg);
    }

    .floating-contact-item:hover .floating-contact-item-label {
        max-width: 118px;
        opacity: 1;
        padding-right: 4px;
    }

/* ===== CORES ===== */
.floating-contact-item.whatsapp {
    color: #25d366;
}

.floating-contact-item.email {
    color: var(--steam-orange);
}

.floating-contact-item.linkedin {
    color: #0077b5;
}

.floating-contact-item.instagram {
    color: #e1306c;
}

.floating-contact-item.chatbot {
    color: #7fe8ff;
}

.floating-contact-item.whatsapp:hover .floating-contact-item-surface {
    border-color: #25d366;
    background: rgba(37,211,102,0.12);
    box-shadow: 0 8px 24px rgba(37,211,102,0.25);
}

.floating-contact-item.email:hover .floating-contact-item-surface {
    border-color: var(--steam-orange);
    background: rgba(242,86,29,0.12);
    box-shadow: 0 8px 24px rgba(242,86,29,0.25);
}

.floating-contact-item.linkedin:hover .floating-contact-item-surface {
    border-color: #0077b5;
    background: rgba(0,119,181,0.12);
    box-shadow: 0 8px 24px rgba(0,119,181,0.25);
}

.floating-contact-item.instagram:hover .floating-contact-item-surface {
    border-color: #e1306c;
    background: rgba(225,48,108,0.12);
    box-shadow: 0 8px 24px rgba(225,48,108,0.25);
}

.floating-contact-item.chatbot:hover .floating-contact-item-surface {
    border-color: rgba(127,232,255,0.55);
    background: rgba(63,166,166,0.14);
    box-shadow: 0 8px 24px rgba(63,166,166,0.28);
}

/* ===== OVERLAY ===== */
.floating-contact-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 9998;
    pointer-events: none;
}

    .floating-contact-overlay.is-active {
        opacity: 0.4;
        visibility: visible;
        pointer-events: auto;
    }

/* ===== MOBILE ===== */
/* Aplica layout em coluna apenas quando NÃO há hover (mobile real).
   Em notebooks Windows com touch, (pointer: coarse) pode ser true e quebrar o desktop. */
@media (max-width: 768px) and (hover: none) {
    .floating-contact-fan {
        position: static;
        left: auto;
        bottom: auto;
        width: 100%;
        height: auto;
        max-height: none;
        pointer-events: auto;
        display: flex;
        flex-direction: column;
        gap: 5px;
        flex-shrink: 0;
    }

    .floating-contact-energy {
        display: block !important;
        right: 0;
        bottom: calc(72px + 10px);
        left: auto;
        top: auto;
        width: 100%;
        max-width: min(360px, calc(100vw - 40px));
        /* Fundo decorativo: não limita altura do menu (evita área “cortada” com scroll) */
        height: min(220px, 55vw);
        max-height: none;
        margin: 0;
        border-top-left-radius: 18px;
        border-bottom-right-radius: 18px;
        overflow: hidden;
        z-index: 0;
    }

    .floating-contact-energy__svg--desktop {
        display: none !important;
    }

    .floating-contact-energy__svg--mobile {
        display: block !important;
    }

    .floating-contact-widget {
        bottom: 20px;
        right: 20px;
        flex-direction: column;
        align-items: flex-end;
    }

    .floating-contact-trigger {
        width: 80px;
        height: 80px;
    }

    .floating-contact-gear {
        width: 36px;
        height: 36px;
    }

    .floating-contact-trigger-image {
        width: 80px;
        height: 80px;
    }

    .floating-contact-menu {
        position: relative;
        z-index: 2;
        width: auto;
        height: auto;
        display: flex;
        flex-direction: column;
        gap: 0;
        padding: 8px 10px;
        border-radius: 12px;
        background: rgba(32,106,115,0.15);
        backdrop-filter: blur(20px);
        border: 1px solid rgba(63,166,166,0.3);
        overflow: visible;
        margin-bottom: 10px;
        flex-shrink: 0;
    }

        .floating-contact-item,
        .floating-contact-menu.is-open .floating-contact-fan .floating-contact-item:nth-child(1),
        .floating-contact-menu.is-open .floating-contact-fan .floating-contact-item:nth-child(2),
        .floating-contact-menu.is-open .floating-contact-fan .floating-contact-item:nth-child(3),
        .floating-contact-menu.is-open .floating-contact-fan .floating-contact-item:nth-child(4),
        .floating-contact-menu.is-open .floating-contact-fan .floating-contact-item:nth-child(5) {
            position: static;
            width: auto;
            height: clamp(30px, 7.25dvh, 36px);
            min-height: 30px;
            margin: 0;
            padding: 0;
            border-radius: 0;
            overflow: visible;
            opacity: 1;
            transform: none !important;
            transition-delay: 0s;
            flex-shrink: 0;
        }

        .floating-contact-item-surface {
            position: relative;
            right: auto;
            left: auto;
            top: auto;
            transform: none;
            display: flex;
            flex-direction: row;
            align-items: center;
            justify-content: flex-start;
            width: 100%;
            min-width: 0;
            height: 100%;
            min-height: 30px;
            padding: 0 10px;
            border-radius: 8px;
            overflow: visible;
            gap: 6px;
        }

    .floating-contact-item-icon {
        order: 1;
        width: clamp(30px, 7.25dvh, 36px);
        height: clamp(30px, 7.25dvh, 36px);
        flex-shrink: 0;
    }

        .floating-contact-item-icon svg {
            width: 18px;
            height: 18px;
        }

    .floating-contact-item-label {
        order: 2;
        flex: 1 1 auto;
        max-width: none;
        opacity: 1;
        text-align: left;
        padding-right: 6px;
        font-size: 11px;
        letter-spacing: 0.5px;
        line-height: 1.2;
    }
}

/* Telas muito baixas (landscape / barra do browser): itens ainda menores, sem scroll */
@media (max-width: 768px) and (hover: none) and (max-height: 520px) {
    .floating-contact-menu {
        padding: 6px 8px;
    }

    .floating-contact-fan {
        gap: 4px;
    }

    .floating-contact-item,
    .floating-contact-menu.is-open .floating-contact-fan .floating-contact-item:nth-child(1),
    .floating-contact-menu.is-open .floating-contact-fan .floating-contact-item:nth-child(2),
    .floating-contact-menu.is-open .floating-contact-fan .floating-contact-item:nth-child(3),
    .floating-contact-menu.is-open .floating-contact-fan .floating-contact-item:nth-child(4),
    .floating-contact-menu.is-open .floating-contact-fan .floating-contact-item:nth-child(5) {
        height: 28px;
        min-height: 28px;
    }

    .floating-contact-item-icon {
        width: 28px;
        height: 28px;
    }

        .floating-contact-item-icon svg {
            width: 16px;
            height: 16px;
        }

    .floating-contact-item-label {
        font-size: 10px;
    }
}

/* ===== ACESSIBILIDADE ===== */
.floating-contact-trigger:focus,
.floating-contact-item:focus {
    outline: 2px solid var(--steam-teal);
    outline-offset: 2px;
}
