/* BD Header Elements - Frontend CSS v1.1.13 */

/* ====== PULSANTE DARK MODE ====== */
.bdhe-dark-toggle.bdhe-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bdhe-color-btn-bg, transparent);
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--bdhe-color-icon, inherit);
    line-height: 1;
    transition: opacity 0.2s ease;
}
.bdhe-dark-toggle.bdhe-button:hover { opacity: 0.75; }
.bdhe-dark-toggle.bdhe-button:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
    border-radius: 3px;
}
.bdhe-toggle-icon { display: inline-block; line-height: 1; }

/* ====== INTERRUTTORE ON/OFF ====== */
.bdhe-switch-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.bdhe-switch-label {
    font-size: 0.85em;
    color: var(--bdhe-color-label, inherit);
    opacity: 0.7;
    transition: opacity 0.25s;
    user-select: none;
}

.bdhe-switch-label-light { opacity: 1; }
.bdhe-switch-label-dark  { opacity: 0.5; }

.custom-dark .bdhe-switch-label-light { opacity: 0.5; }
.custom-dark .bdhe-switch-label-dark  { opacity: 1; }

/* Il pulsante switch */
.bdhe-dark-toggle.bdhe-switch {
    position: relative;
    display: inline-block;
    width: var(--bdhe-sw-w, 40px);
    height: var(--bdhe-sw-h, 22px);
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
}
.bdhe-dark-toggle.bdhe-switch:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
    border-radius: 999px;
}

/* Traccia */
.bdhe-switch-track {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--bdhe-color-track-off, rgba(128,128,128,0.6));
    border: 1px solid rgba(0,0,0,0.2);
    border-radius: 999px;
    transition: background 0.25s ease;
    position: relative;
}

.custom-dark .bdhe-switch-track,
.bdhe-dark-toggle.bdhe-switch[aria-checked="true"] .bdhe-switch-track {
    background: var(--bdhe-color-track-on, var(--theme-palette-color-1, #2872fa));
    border-color: transparent;
}

/* Knob */
.bdhe-switch-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: var(--bdhe-sw-k, 18px);
    height: var(--bdhe-sw-k, 18px);
    background: var(--bdhe-color-knob, #fff);
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    transition: transform 0.25s ease;
}

.custom-dark .bdhe-switch-knob,
.bdhe-dark-toggle.bdhe-switch[aria-checked="true"] .bdhe-switch-knob {
    transform: translateX(calc(var(--bdhe-sw-w, 40px) - var(--bdhe-sw-k, 18px) - 4px));
}

/* Knob con icone ☾ / ☼ */
.bdhe-switch-knob.bdhe-knob-icons {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(var(--bdhe-sw-k, 18px) * 0.6);
    line-height: 1;
    user-select: none;
    color: #888;
    transition: transform 0.25s ease, color 0.25s ease;
}
/* Icona chiara visibile di default */
.bdhe-switch-knob.bdhe-knob-icons::before {
    content: '☾';
    display: block;
}
/* Icona scura quando attivo */
.custom-dark .bdhe-switch-knob.bdhe-knob-icons::before,
.bdhe-dark-toggle.bdhe-switch[aria-checked="true"] .bdhe-switch-knob.bdhe-knob-icons::before {
    content: '☼';
    color: #f5c542;
}

/* ====== HTML BLOCKS ====== */
.bdhe-html-block {
    display: flex;
    align-items: center;
}
.bdhe-html-block > * { margin: 0; }

/* ====== WIDGET SLOTS ====== */
.bdhe-widget-slot { display: flex; align-items: center; }
.bdhe-widget-slot .widget { margin: 0; }
.bdhe-widget-slot .widget-title { display: none; }
.bdhe-widget-slot p { margin-block-end: 0; margin-bottom: 0; }

/* ====== CONTENT BLOCKS ====== */
.bdhe-content-block { display: flex; align-items: center; }
.bdhe-content-block > * { margin: 0; }
.bdhe-content-block p:last-child { margin-bottom: 0; }

/* Empty state nel Customizer */
.bdhe-empty {
    padding: 8px 12px;
    opacity: 0.5;
    font-size: 12px;
    font-style: italic;
    border: 1px dashed currentColor;
    border-radius: 4px;
}

/* Fix: wrapper elementi deve essere flex come gli altri elementi Blocksy */
[data-id^="html-block-"],
[data-id^="content-block-"],
[data-id^="widget-slot-"],
[data-id="dark-mode-toggle"] {
    display: flex !important;
    align-items: center;
}
