/*
 * Shoppy header: two-level navigation.
 * Tokens follow the Shoppy brand guidelines and are scoped to the component
 * (not :root) so they never clash with Elementor's global kit variables.
 */

.shoppy-header {
    --shoppy-header-text: #112a46;
    --shoppy-header-muted: #4b5563;
    --shoppy-header-subtle: #9ca3af;
    --shoppy-header-accent: #f4989c;
    --shoppy-header-accent-hover: #e8858a;
    --shoppy-header-accent-soft: rgba(244, 152, 156, 0.1);
    --shoppy-header-bg: #ffffff;
    --shoppy-header-bg-secondary: #f4f5fa;
    --shoppy-header-hover: #f9fafb;
    --shoppy-header-border: #e5e7eb;
    --shoppy-header-border-light: #f3f4f6;
    --shoppy-header-border-strong: #94a3b8;
    --shoppy-header-shadow-card: 0 1px 3px rgba(17, 42, 70, 0.08), 0 4px 12px rgba(17, 42, 70, 0.04);
    --shoppy-header-shadow-hover: 0 4px 16px rgba(17, 42, 70, 0.12), 0 8px 24px rgba(17, 42, 70, 0.06);
    --shoppy-header-font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

    /*
     * CTA button tokens, matching the shoppy.is "Prenota una demo" button.
     * The colour comes from the Elementor global kit; the fallback applies
     * only on pages where the kit variable is not defined.
     */
    --shoppy-header-cta-brand: var(--e-global-color-59f0387, #112a46);
    --shoppy-header-cta-bg: var(--shoppy-header-cta-brand);
    --shoppy-header-cta-color: #ffffff;
    --shoppy-header-cta-bg-hover: var(--shoppy-header-cta-bg);
    --shoppy-header-cta-color-hover: var(--shoppy-header-cta-color);
    --shoppy-header-cta-font-family: "Inter", sans-serif;
    --shoppy-header-cta-font-size: 16px;
    --shoppy-header-cta-font-weight: 500;
    --shoppy-header-cta-line-height: 1em;
    --shoppy-header-cta-letter-spacing: normal;
    --shoppy-header-cta-text-transform: none;
    --shoppy-header-cta-padding: 12px 24px;
    --shoppy-header-cta-radius: 8px;
    --shoppy-header-cta-border: 1px solid var(--shoppy-header-cta-brand);
    --shoppy-header-cta-border-color-hover: var(--shoppy-header-cta-brand);
    --shoppy-header-cta-shadow: none;
    --shoppy-header-cta-shadow-hover: none;
    --shoppy-header-cta-lift-hover: 0px;
    --shoppy-header-max-width: 1200px;
    --shoppy-header-gutter: 24px;
    --shoppy-header-logo-height: 40px;
    --shoppy-header-bar-height: 80px;

    position: relative;
    width: 100%;
    font-family: var(--shoppy-header-font);
    color: var(--shoppy-header-text);
    -webkit-font-smoothing: antialiased;
}

.shoppy-header *,
.shoppy-header *::before,
.shoppy-header *::after {
    box-sizing: border-box;
}

.shoppy-header__inner {
    display: flex;
    align-items: center;
    gap: 28px;
    width: 100%;
    max-width: var(--shoppy-header-max-width);
    margin-inline: auto;
    padding-inline: var(--shoppy-header-gutter);
}

/* ---------- Primary bar ---------- */

.shoppy-header__primary {
    position: relative;
    z-index: 2;
    background: var(--shoppy-header-bg);
    border-bottom: 1px solid var(--shoppy-header-border-light);
}

.shoppy-header__primary > .shoppy-header__inner {
    min-height: var(--shoppy-header-bar-height);
}

.shoppy-header__logo {
    display: inline-flex;
    flex: none;
    align-items: center;
    border-radius: 4px;
    text-decoration: none;
}

.shoppy-header .shoppy-header__logo-image {
    display: block;
    width: auto;
    max-width: none;
    height: var(--shoppy-header-logo-height);
}

.shoppy-header__logo-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--shoppy-header-text);
}

.shoppy-header__nav {
    flex: 1;
    min-width: 0;
}

.shoppy-header .shoppy-header__menu {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.shoppy-header .shoppy-header__menu > li {
    margin: 0;
    padding: 0;
}

.shoppy-header .shoppy-header__menu a {
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--shoppy-header-text);
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.shoppy-header .shoppy-header__menu a:hover {
    background: var(--shoppy-header-hover);
    color: var(--shoppy-header-text);
}

/* Active state: accent at 10% opacity, never a solid fill. */
.shoppy-header .shoppy-header__menu .current-menu-item > a,
.shoppy-header .shoppy-header__menu .current-menu-ancestor > a,
.shoppy-header .shoppy-header__menu .current-menu-parent > a,
.shoppy-header .shoppy-header__menu .current_page_parent > a,
.shoppy-header .shoppy-header__menu .current-page-ancestor > a {
    background: var(--shoppy-header-accent-soft);
}

.shoppy-header__actions {
    display: flex;
    flex: none;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.shoppy-header .shoppy-header__cta {
    display: inline-flex;
    align-items: center;
    padding: var(--shoppy-header-cta-padding);
    border: var(--shoppy-header-cta-border);
    border-radius: var(--shoppy-header-cta-radius);
    background: var(--shoppy-header-cta-bg);
    box-shadow: var(--shoppy-header-cta-shadow);
    font-family: var(--shoppy-header-cta-font-family);
    font-size: var(--shoppy-header-cta-font-size);
    font-weight: var(--shoppy-header-cta-font-weight);
    line-height: var(--shoppy-header-cta-line-height);
    letter-spacing: var(--shoppy-header-cta-letter-spacing);
    text-transform: var(--shoppy-header-cta-text-transform);
    color: var(--shoppy-header-cta-color);
    fill: var(--shoppy-header-cta-color);
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.shoppy-header .shoppy-header__cta:hover {
    border-color: var(--shoppy-header-cta-border-color-hover);
    background: var(--shoppy-header-cta-bg-hover);
    box-shadow: var(--shoppy-header-cta-shadow-hover);
    color: var(--shoppy-header-cta-color-hover);
    fill: var(--shoppy-header-cta-color-hover);
    transform: translateY(var(--shoppy-header-cta-lift-hover));
}

.shoppy-header__toggle {
    display: none;
}

/* ---------- Breadcrumb bar ---------- */

.shoppy-header__secondary {
    position: relative;
    z-index: 1;
    background: var(--shoppy-header-bg-secondary);
    border-bottom: 1px solid var(--shoppy-header-border);
}

.shoppy-header__inner--secondary {
    gap: 12px;
    padding-block: 10px;
}

.shoppy-header .shoppy-header__back {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--shoppy-header-border);
    border-radius: 6px;
    background: var(--shoppy-header-bg);
    color: var(--shoppy-header-text);
    text-decoration: none;
    transition: border-color 0.2s ease;
}

.shoppy-header .shoppy-header__back:hover {
    border-color: var(--shoppy-header-border-strong);
    color: var(--shoppy-header-text);
}

.shoppy-header__breadcrumb {
    min-width: 0;
}

.shoppy-header .shoppy-header__crumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 13px;
    line-height: 1.4;
}

.shoppy-header .shoppy-header__crumb {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin: 0;
    padding: 0;
}

.shoppy-header__crumb-separator {
    color: var(--shoppy-header-subtle);
}

.shoppy-header .shoppy-header__crumb-link {
    color: var(--shoppy-header-muted);
    text-decoration: none;
    white-space: nowrap;
}

.shoppy-header .shoppy-header__crumb-link:hover {
    color: var(--shoppy-header-text);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.shoppy-header__crumb-current {
    overflow: hidden;
    font-weight: 600;
    color: var(--shoppy-header-text);
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- Keyboard focus ---------- */

.shoppy-header a:focus-visible,
.shoppy-header button:focus-visible {
    outline: 2px solid var(--shoppy-header-text);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(244, 152, 156, 0.3);
}

/* ---------- Tablet and mobile ---------- */

@media (max-width: 1024px) {
    .shoppy-header {
        --shoppy-header-gutter: 16px;
        --shoppy-header-bar-height: 68px;
        --shoppy-header-logo-height: 34px;
    }

    .shoppy-header__inner {
        gap: 16px;
    }

    /* Without JavaScript the menu stays visible and wraps under the logo. */
    .shoppy-header:not(.is-enhanced) .shoppy-header__primary > .shoppy-header__inner {
        flex-wrap: wrap;
        padding-block: 12px;
    }

    .shoppy-header:not(.is-enhanced) .shoppy-header__nav {
        order: 3;
        flex-basis: 100%;
    }

    .shoppy-header.is-enhanced .shoppy-header__toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        padding: 0;
        border: 1px solid var(--shoppy-header-border);
        border-radius: 6px;
        background: var(--shoppy-header-bg);
        color: var(--shoppy-header-text);
        cursor: pointer;
    }

    .shoppy-header__toggle-bars,
    .shoppy-header__toggle-bars::before,
    .shoppy-header__toggle-bars::after {
        display: block;
        width: 16px;
        height: 2px;
        border-radius: 2px;
        background: currentColor;
        transition: transform 0.2s ease, background-color 0.2s ease;
    }

    .shoppy-header__toggle-bars {
        position: relative;
    }

    .shoppy-header__toggle-bars::before,
    .shoppy-header__toggle-bars::after {
        position: absolute;
        left: 0;
        content: "";
    }

    .shoppy-header__toggle-bars::before {
        top: -5px;
    }

    .shoppy-header__toggle-bars::after {
        top: 5px;
    }

    .shoppy-header__toggle[aria-expanded="true"] .shoppy-header__toggle-bars {
        background: transparent;
    }

    .shoppy-header__toggle[aria-expanded="true"] .shoppy-header__toggle-bars::before {
        transform: translateY(5px) rotate(45deg);
    }

    .shoppy-header__toggle[aria-expanded="true"] .shoppy-header__toggle-bars::after {
        transform: translateY(-5px) rotate(-45deg);
    }

    .shoppy-header.is-enhanced .shoppy-header__nav {
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        display: none;
        padding: 8px var(--shoppy-header-gutter) 16px;
        background: var(--shoppy-header-bg);
        border-bottom: 1px solid var(--shoppy-header-border);
        box-shadow: var(--shoppy-header-shadow-card);
    }

    .shoppy-header.is-enhanced.is-open .shoppy-header__nav {
        display: block;
    }

    .shoppy-header.is-enhanced .shoppy-header__menu {
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
    }

    .shoppy-header.is-enhanced .shoppy-header__menu a {
        padding: 12px;
        font-size: 15px;
    }
}

@media (max-width: 640px) {
    .shoppy-header {
        --shoppy-header-logo-height: 30px;
    }

    .shoppy-header .shoppy-header__back {
        width: 32px;
        height: 32px;
    }

    /* Keep the trail on one line: show only the parent and the current page. */
    .shoppy-header .shoppy-header__crumb:not(:nth-last-child(-n + 2)) {
        display: none;
    }

    .shoppy-header .shoppy-header__crumb:nth-last-child(2):not(:first-child) .shoppy-header__crumb-separator {
        display: none;
    }
}

@media (max-width: 400px) {
    .shoppy-header {
        --shoppy-header-cta-padding: 10px 14px;
        --shoppy-header-cta-font-size: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .shoppy-header *,
    .shoppy-header *::before,
    .shoppy-header *::after {
        transition: none !important;
    }

    .shoppy-header .shoppy-header__cta:hover {
        transform: none;
    }
}
