/* Shared homepage theme toggle styles for every public FlowKit surface. */
/* ============================================================
   BOTÃO DE ALTERNÂNCIA DE TEMA (whw-theme-toggle)
   Fixo no canto inferior direito
   Sobrescreve resets do tema WordPress
   ============================================================ */

.whw-theme-toggle-wrapper {
    --whw-toggle-space-1: 0.25rem;
    --whw-toggle-space-3: 0.75rem;
    --whw-toggle-space-4: 1rem;
    --whw-toggle-space-6: 1.5rem;
    --whw-toggle-z-index: 1000;
    --whw-toggle-background: rgba(255, 255, 255, 0.6);
    --whw-toggle-blur: blur(8px);
    --whw-toggle-border-width: 1px;
    --whw-toggle-border-style: solid;
    --whw-toggle-border-radius-sm: 0.5rem;
    --whw-toggle-border: rgba(3, 102, 214, 0.04);
    --whw-toggle-shadow-md: 0 4px 20px rgba(0, 0, 0, 0.02);
    --whw-toggle-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.02);
    --whw-toggle-text: rgba(0, 0, 0, 0.4);
    --whw-toggle-primary: #0366D6;
    --whw-toggle-primary-light: #6093FF;
    --whw-toggle-transition-base: 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    --whw-toggle-transition-slow: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    --whw-toggle-transition-fast: 0.15s ease;
    --whw-toggle-font-size-lg: 1.2rem;
    --whw-toggle-font-size-md: 1rem;
    --whw-toggle-font-size-xs: 0.6rem;
    --whw-toggle-font-family: 'Poppins', system-ui, -apple-system, sans-serif;
    --whw-toggle-font-weight-medium: 500;
    position: fixed;
    bottom: var(--whw-toggle-space-6);
    right: var(--whw-toggle-space-6);
    z-index: var(--whw-toggle-z-index);
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-theme="dark"] .whw-theme-toggle-wrapper {
    --whw-toggle-background: rgba(255, 255, 255, 0.02);
    --whw-toggle-border: rgba(255, 255, 255, 0.02);
    --whw-toggle-shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.15);
    --whw-toggle-text: rgba(255, 255, 255, 0.25);
}

/* Reset completo com maior especificidade e !important para evitar herança */
button.whw-theme-toggle,
button.whw-theme-toggle:focus,
button.whw-theme-toggle:hover,
button.whw-theme-toggle:active {
    all: initial !important;
    /* Reseta tudo, inclusive herança de hover/focus do tema */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 3.2rem !important;
    height: 3.2rem !important;
    border-radius: 50% !important;
    background: var(--whw-toggle-background) !important;
    backdrop-filter: var(--whw-toggle-blur) !important;
    -webkit-backdrop-filter: var(--whw-toggle-blur) !important;
    border: var(--whw-toggle-border-width) var(--whw-toggle-border-style) var(--whw-toggle-border) !important;
    box-shadow: var(--whw-toggle-shadow-md), 0 0 0 1px rgba(255, 255, 255, 0.8) inset !important;
    color: var(--whw-toggle-text) !important;
    cursor: pointer !important;
    transition: all var(--whw-toggle-transition-base) !important;
    font-size: var(--whw-toggle-font-size-lg) !important;
    font-family: var(--whw-toggle-font-family) !important;
    line-height: 1 !important;
    text-decoration: none !important;
    outline: none !important;
    position: relative !important;
    padding: 0 !important;
    margin: 0 !important;
    min-width: 0 !important;
    min-height: 0 !important;
}

/* Remove qualquer outline ou box-shadow indesejado do tema */
button.whw-theme-toggle:focus-visible,
button.whw-theme-toggle:focus {
    outline: none !important;
    box-shadow: var(--whw-toggle-shadow-md), 0 0 0 2px var(--whw-toggle-primary) !important;
}

/* Efeito de scan (herdado) */
button.whw-theme-toggle::before {
    content: '' !important;
    position: absolute !important;
    inset: 0 !important;
    background: linear-gradient(180deg,
            transparent 0%,
            rgba(3, 102, 214, 0.02) 30%,
            rgba(3, 102, 214, 0.03) 50%,
            rgba(3, 102, 214, 0.02) 70%,
            transparent 100%) !important;
    background-size: 100% 200% !important;
    background-position: 0% 0% !important;
    pointer-events: none !important;
    transition: background-position var(--whw-toggle-transition-slow) !important;
    border-radius: 50% !important;
    z-index: 0 !important;
}
button.whw-theme-toggle:hover::before {
    background-position: 0% 100% !important;
}

/* Borda neon animada */
button.whw-theme-toggle::after {
    content: '' !important;
    position: absolute !important;
    inset: -2px !important;
    border-radius: 50% !important;
    padding: 2px !important;
    background: conic-gradient(from 0deg,
            transparent 0%,
            rgba(3, 102, 214, 0.02) 25%,
            rgba(3, 102, 214, 0.02) 50%,
            rgba(3, 102, 214, 0.02) 75%,
            transparent 100%) !important;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0) !important;
    -webkit-mask-composite: xor !important;
    mask-composite: exclude !important;
    pointer-events: none !important;
    transition: all var(--whw-toggle-transition-slow) !important;
    z-index: 0 !important;
}
button.whw-theme-toggle:hover::after {
    background: conic-gradient(from 0deg,
            transparent 0%,
            rgba(3, 102, 214, 0.15) 25%,
            var(--whw-toggle-primary) 50%,
            rgba(3, 102, 214, 0.15) 75%,
            transparent 100%) !important;
    animation: whw-toggle-border-spin 3s linear infinite !important;
}
@keyframes whw-toggle-border-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Ícone */
button.whw-theme-toggle .whw-toggle-icon {
    position: relative !important;
    z-index: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: transform var(--whw-toggle-transition-base) !important;
    font-size: var(--whw-toggle-font-size-lg) !important;
    color: var(--whw-toggle-text) !important;
}
button.whw-theme-toggle:hover .whw-toggle-icon {
    transform: scale(1.1) rotate(15deg) !important;
    color: var(--whw-toggle-primary) !important;
}

/* Tooltip flutuante */
button.whw-theme-toggle .whw-toggle-label {
    position: absolute !important;
    right: calc(100% + var(--whw-toggle-space-3)) !important;
    background: var(--whw-toggle-background) !important;
    backdrop-filter: var(--whw-toggle-blur) !important;
    -webkit-backdrop-filter: var(--whw-toggle-blur) !important;
    padding: var(--whw-toggle-space-1) var(--whw-toggle-space-3) !important;
    border-radius: var(--whw-toggle-border-radius-sm) !important;
    border: var(--whw-toggle-border-width) var(--whw-toggle-border-style) var(--whw-toggle-border) !important;
    font-size: var(--whw-toggle-font-size-xs) !important;
    font-weight: var(--whw-toggle-font-weight-medium) !important;
    color: var(--whw-toggle-text) !important;
    white-space: nowrap !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity var(--whw-toggle-transition-fast), transform var(--whw-toggle-transition-fast) !important;
    transform: translateX(8px) !important;
    z-index: 2 !important;
}
button.whw-theme-toggle:hover .whw-toggle-label {
    opacity: 1 !important;
    transform: translateX(0) !important;
}

/* Tema escuro: ícone e cores diferentes */
[data-theme="dark"] button.whw-theme-toggle {
    background: var(--whw-toggle-background) !important;
    border-color: rgba(255, 255, 255, 0.04) !important;
    box-shadow: var(--whw-toggle-shadow-sm), 0 0 0 1px rgba(255, 255, 255, 0.02) inset !important;
}
[data-theme="dark"] button.whw-theme-toggle .whw-toggle-icon {
    color: var(--whw-toggle-text) !important;
}
[data-theme="dark"] button.whw-theme-toggle:hover .whw-toggle-icon {
    color: var(--whw-toggle-primary-light) !important;
}
[data-theme="dark"] button.whw-theme-toggle::after {
    background: conic-gradient(from 0deg,
            transparent 0%,
            rgba(255, 255, 255, 0.02) 25%,
            rgba(255, 255, 255, 0.02) 50%,
            rgba(255, 255, 255, 0.02) 75%,
            transparent 100%) !important;
}
[data-theme="dark"] button.whw-theme-toggle:hover::after {
    background: conic-gradient(from 0deg,
            transparent 0%,
            rgba(3, 102, 214, 0.15) 25%,
            var(--whw-toggle-primary-light) 50%,
            rgba(3, 102, 214, 0.15) 75%,
            transparent 100%) !important;
}

/* Responsividade */
@media (max-width: 640px) {
    .whw-theme-toggle-wrapper {
        bottom: var(--whw-toggle-space-4);
        right: var(--whw-toggle-space-4);
    }
    button.whw-theme-toggle {
        width: 2.8rem !important;
        height: 2.8rem !important;
    }
    button.whw-theme-toggle .whw-toggle-icon {
        font-size: var(--whw-toggle-font-size-md) !important;
    }
    button.whw-theme-toggle .whw-toggle-label {
        display: none !important;
    }
}
