/* ==========================================================================
   FAB Container — Floating Action Buttons
   ==========================================================================
   Single source of truth for all FAB-related styles.
   Replaces scattered FAB CSS from style.css and dark-mode-toggle sections.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Container
   -------------------------------------------------------------------------- */
.webtron-fab-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 12px;
    z-index: var(--z-fixed, 300);
}

/* Hide when AI chat panel is open */
body.ai-chat-open .webtron-fab-container {
    display: none !important;
}

/* Hide when mobile docs panel is open */
body.mobile-panel-open .webtron-fab-container .dark-mode-toggle,
body.mobile-panel-open .webtron-fab-container .docs-mobile-toggle,
body.mobile-panel-open .webtron-fab-container .ai-chat-toggle {
    display: none !important;
}

/* --------------------------------------------------------------------------
   Button base — shared by all FABs
   -------------------------------------------------------------------------- */
.webtron-fab {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Dark mode button appearance */
body.dark-mode .webtron-fab {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.35);
}

.webtron-fab:hover {
    background: var(--wp--preset--color--primary, #0866ff);
    border-color: var(--wp--preset--color--primary, #0866ff);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.webtron-fab:focus-visible {
    outline: 2px solid var(--wp--preset--color--primary, #0866ff);
    outline-offset: 3px;
}

/* Icons */
.webtron-fab i {
    font-size: 20px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: transform 0.3s ease;
}

.webtron-fab:hover i {
    transform: rotate(15deg);
}

/* --------------------------------------------------------------------------
   Dark mode toggle — icon swap
   -------------------------------------------------------------------------- */
.dark-mode-toggle .fa-sun {
    display: none;
}

body.dark-mode .dark-mode-toggle .fa-moon {
    display: none;
}

body.dark-mode .dark-mode-toggle .fa-sun {
    display: flex;
}

/* Update aria-pressed visually */
.dark-mode-toggle[aria-pressed="true"] {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.35);
}

/* --------------------------------------------------------------------------
   Scroll to top — show/hide based on scroll position
   -------------------------------------------------------------------------- */
.scroll-to-top {
    opacity: 0;
    pointer-events: none;
}

.scroll-to-top[hidden] {
    display: flex; /* Override hidden but keep invisible for transition */
    opacity: 0;
    pointer-events: none;
}

.scroll-to-top.is-visible {
    opacity: 1;
    pointer-events: auto;
}

/* --------------------------------------------------------------------------
   Docs mobile toggle — mobile only
   -------------------------------------------------------------------------- */
.docs-mobile-toggle {
    display: none !important;
}

@media screen and (max-width: 768px) {
    .docs-mobile-toggle {
        display: flex !important;
    }
}

/* --------------------------------------------------------------------------
   Mobile responsive
   -------------------------------------------------------------------------- */
@media screen and (max-width: 768px) {
    .webtron-fab-container {
        bottom: 20px;
        right: 20px;
        gap: 10px;
    }

    .webtron-fab {
        width: 45px;
        height: 45px;
    }

    .webtron-fab i {
        font-size: 18px;
        width: 18px;
        height: 18px;
    }
}
