/* ============================================
   WEBRETA FLOATING WIDGET - FRONTEND v5.0
   Button: 55px | SVG: 35px
   ============================================ */

#wfw-container {
    position: fixed;
    bottom: 25px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ---- POSITION ---- */
.wfw-position-right { right: 25px; left: auto; align-items: flex-end; }
.wfw-position-left  { left: 25px; right: auto; align-items: flex-start; }

/* ---- BUTTONS ---- */
.wfw-button {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    transition: transform 0.25s cubic-bezier(.18,.89,.32,1.28), box-shadow 0.25s ease;
    box-shadow: 0 4px 14px rgba(0,0,0,0.18);
    flex-shrink: 0;
}
.wfw-button:last-child { margin-bottom: 0; }
.wfw-button svg { width: 35px; height: 35px; flex-shrink: 0; }

/* Renkler - fallback + CSS variable override */
.wfw-whatsapp   { background: #25D366; background: var(--wfw-whatsapp-bg, #25D366); }
.wfw-instagram  { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%); background: var(--wfw-instagram-bg, radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%)); }
.wfw-facebook   { background: #1877F2; background: var(--wfw-facebook-bg, #1877F2); }
.wfw-call       { background: #34B7F1; background: var(--wfw-call-bg, #34B7F1); }
.wfw-linkedin   { background: #0e76a8; background: var(--wfw-linkedin-bg, #0e76a8); }
.wfw-youtube    { background: #FF0000; background: var(--wfw-youtube-bg, #FF0000); }
.wfw-tiktok     { background: #010101; background: var(--wfw-tiktok-bg, #010101); }
.wfw-twitter    { background: #1d9bf0; background: var(--wfw-twitter-bg, #1d9bf0); }
.wfw-telegram   { background: #0088cc; background: var(--wfw-telegram-bg, #0088cc); }
.wfw-pinterest  { background: #E60023; background: var(--wfw-pinterest-bg, #E60023); }
.wfw-custom     { background: #6c757d; background: var(--wfw-custom-bg, #6c757d); }

/* Text inside */
.wfw-button.has-text { width: auto; border-radius: 28px; padding: 0 20px 0 14px; }
.wfw-button.has-text span { margin-left: 10px; font-size: 15px; font-weight: 600; line-height: 1; }

/* ---- HOVER ---- */
.wfw-button:hover {
    transform: scale(1.12) translateY(-3px);
    box-shadow: 0 10px 28px rgba(0,0,0,0.22);
}

/* ---- STACK MODE (Default, always visible) ---- */
.wfw-mode-stack .wfw-button {
    opacity: 1;
    transform: translateY(0);
}

/* ---- ANIMATION: BOUNCE (Stack) ---- */
.wfw-mode-stack.wfw-anim-bounce .wfw-button {
    animation: wfw-slide-in 0.5s cubic-bezier(.18,.89,.32,1.28) both;
}
.wfw-mode-stack.wfw-anim-bounce .wfw-button:nth-child(1) { animation-delay: 0.05s; }
.wfw-mode-stack.wfw-anim-bounce .wfw-button:nth-child(2) { animation-delay: 0.12s; }
.wfw-mode-stack.wfw-anim-bounce .wfw-button:nth-child(3) { animation-delay: 0.19s; }
.wfw-mode-stack.wfw-anim-bounce .wfw-button:nth-child(4) { animation-delay: 0.26s; }
.wfw-mode-stack.wfw-anim-bounce .wfw-button:nth-child(5) { animation-delay: 0.33s; }
.wfw-mode-stack.wfw-anim-bounce .wfw-button:nth-child(6) { animation-delay: 0.40s; }
.wfw-mode-stack.wfw-anim-bounce .wfw-button:nth-child(7) { animation-delay: 0.47s; }
.wfw-mode-stack.wfw-anim-bounce .wfw-button:nth-child(8) { animation-delay: 0.54s; }

@keyframes wfw-slide-in {
    0% { opacity: 0; transform: translateX(40px) scale(0.7); }
    60% { transform: translateX(-6px) scale(1.05); }
    100% { opacity: 1; transform: translateX(0) scale(1); }
}
.wfw-position-left.wfw-mode-stack.wfw-anim-bounce .wfw-button {
    animation-name: wfw-slide-in-left;
}
@keyframes wfw-slide-in-left {
    0% { opacity: 0; transform: translateX(-40px) scale(0.7); }
    60% { transform: translateX(6px) scale(1.05); }
    100% { opacity: 1; transform: translateX(0) scale(1); }
}

/* ---- ANIMATION: PULSE (Stack) ---- */
.wfw-mode-stack.wfw-anim-pulse .wfw-button::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: inherit;
    animation: wfw-pulse-ring 2.5s ease-out infinite;
    z-index: -1;
    opacity: 0.6;
}
.wfw-button.has-text::after { border-radius: 28px; }
@keyframes wfw-pulse-ring {
    0% { transform: scale(1); opacity: 0.6; }
    70% { transform: scale(1.5); opacity: 0; }
    100% { transform: scale(1.5); opacity: 0; }
}
.wfw-mode-stack.wfw-anim-pulse .wfw-button:nth-child(2)::after { animation-delay: 0.4s; }
.wfw-mode-stack.wfw-anim-pulse .wfw-button:nth-child(3)::after { animation-delay: 0.8s; }
.wfw-mode-stack.wfw-anim-pulse .wfw-button:nth-child(4)::after { animation-delay: 1.2s; }

/* ---- TOGGLE MODE ---- */
.wfw-mode-toggle { flex-direction: column-reverse; }

#wfw-toggle-button {
    width: 55px; height: 55px;
    background: var(--wfw-main-button-bg);
    color: var(--wfw-icon-color);
    border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0,0,0,0.22);
    transition: all 0.3s ease;
    position: relative;
    flex-shrink: 0;
    white-space: nowrap;
    z-index: 2;
}
#wfw-toggle-button:hover { transform: scale(1.1); }

#wfw-toggle-button.has-text { width: auto; border-radius: 30px; padding: 0 20px; }
#wfw-toggle-button.has-text .wfw-main-button-text { padding-left: 10px; font-size: 16px; font-weight: 600; }

#wfw-toggle-button .wfw-main-icon-wrapper {
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.35s cubic-bezier(.68,-0.55,.27,1.55), opacity 0.3s ease;
    width: 35px; height: 35px;
}
#wfw-toggle-button .wfw-icon-main { width: 35px; height: 35px; }
#wfw-toggle-button .wfw-main-logo { display: block; object-fit: contain; }
#wfw-toggle-button .wfw-icon-close {
    width: 30px; height: 30px;
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%) rotate(-90deg) scale(0);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(.68,-0.55,.27,1.55), opacity 0.25s ease;
    fill: currentColor; stroke: none;
    color: var(--wfw-icon-color);
}

/* Toggle button pulse */
.wfw-mode-toggle #wfw-toggle-button::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--wfw-main-button-bg);
    animation: wfw-toggle-pulse 2s ease-out infinite;
    z-index: -1;
}
@keyframes wfw-toggle-pulse {
    0% { transform: scale(1); opacity: 0.6; }
    80% { transform: scale(1.6); opacity: 0; }
    100% { transform: scale(1.6); opacity: 0; }
}

/* Active toggle */
.wfw-mode-toggle.active #wfw-toggle-button {
    background: var(--wfw-close-color);
    background-image: none;
}
.wfw-mode-toggle.active #wfw-toggle-button::before { animation: none; }
.wfw-mode-toggle.active #wfw-toggle-button .wfw-main-icon-wrapper { transform: rotate(90deg) scale(0); opacity: 0; }
.wfw-mode-toggle.active #wfw-toggle-button .wfw-main-button-text { opacity: 0; width: 0; padding: 0; overflow: hidden; }
.wfw-mode-toggle.active #wfw-toggle-button .wfw-icon-close { transform: translate(-50%, -50%) rotate(0) scale(1); opacity: 1; }

/* Toggle buttons hidden by default */
.wfw-mode-toggle .wfw-buttons {
    display: flex; flex-direction: column;
    margin-bottom: 14px;
}
.wfw-mode-toggle .wfw-button {
    opacity: 0;
    transform: translateY(20px) scale(0.7);
    transition: opacity 0.3s ease, transform 0.35s cubic-bezier(.18,.89,.32,1.28);
    pointer-events: none;
}
.wfw-mode-toggle.active .wfw-button {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.wfw-mode-toggle.active .wfw-button:hover { transform: scale(1.1) translateY(-2px); }

/* Stagger animation for toggle */
.wfw-mode-toggle.active .wfw-buttons a:nth-last-child(1) { transition-delay: 0.05s; }
.wfw-mode-toggle.active .wfw-buttons a:nth-last-child(2) { transition-delay: 0.10s; }
.wfw-mode-toggle.active .wfw-buttons a:nth-last-child(3) { transition-delay: 0.15s; }
.wfw-mode-toggle.active .wfw-buttons a:nth-last-child(4) { transition-delay: 0.20s; }
.wfw-mode-toggle.active .wfw-buttons a:nth-last-child(5) { transition-delay: 0.25s; }
.wfw-mode-toggle.active .wfw-buttons a:nth-last-child(6) { transition-delay: 0.30s; }
.wfw-mode-toggle.active .wfw-buttons a:nth-last-child(7) { transition-delay: 0.35s; }
.wfw-mode-toggle.active .wfw-buttons a:nth-last-child(8) { transition-delay: 0.40s; }

/* Pulse on toggle buttons when open */
.wfw-mode-toggle.active.wfw-anim-pulse .wfw-button::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: inherit;
    animation: wfw-pulse-ring 2.5s ease-out infinite;
    z-index: -1;
}

/* ---- TOOLTIP ---- */
a[data-wfw-tooltip] { position: relative; }
a[data-wfw-tooltip]::after {
    content: attr(data-wfw-tooltip);
    position: absolute;
    top: 50%; transform: translateY(-50%);
    background: #1e293b;
    color: #fff;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0; visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
    pointer-events: none;
    z-index: 10;
    transform: translateY(-50%) scale(0.9);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
a[data-wfw-tooltip]:hover::after {
    opacity: 1; visibility: visible;
    transform: translateY(-50%) scale(1);
}
.wfw-position-right a[data-wfw-tooltip]::after { right: calc(100% + 12px); left: auto; }
.wfw-position-left  a[data-wfw-tooltip]::after { left: calc(100% + 12px); right: auto; }

/* ---- CTA BUBBLE ---- */
.wfw-cta-bubble {
    position: absolute;
    bottom: calc(55px + 20px);
    background: #fff;
    color: #1e293b;
    padding: 12px 18px;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0; transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    visibility: hidden;
    z-index: 10;
    max-width: 260px;
    white-space: normal;
}
.wfw-cta-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    width: 0; height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #fff;
}
.wfw-position-right .wfw-cta-bubble { right: 0; }
.wfw-position-right .wfw-cta-bubble::after { right: 20px; }
.wfw-position-left  .wfw-cta-bubble { left: 0; }
.wfw-position-left  .wfw-cta-bubble::after { left: 20px; }
.wfw-mode-toggle .wfw-cta-bubble.is-visible { opacity: 1; transform: translateY(0); visibility: visible; }
#wfw-container.cta-interacted .wfw-cta-bubble { display: none; }

/* ---- MOBILE ---- */
@media (max-width: 768px) {
    a[data-wfw-tooltip]::after { content: none !important; }
    .wfw-button:hover { transform: none; box-shadow: 0 4px 14px rgba(0,0,0,0.18); }
    #wfw-toggle-button:hover { transform: none; }
    .wfw-mode-toggle.active .wfw-button:hover { transform: none; }
    .wfw-button.wfw-hide-on-mobile-js { display: none !important; }
    .wfw-button {
		width: 50px !important;
		height: 50px !important;
	}
	
	.wfw-button svg {
		width: 25px !important;
		height: 25px !important;
	}
}
