/*
 * Guides shared megamenu bridge — styles for the Laravel fragment panels.
 *
 * Every rule is scoped to `.qc-shared-panel`, the class the bridge JS adds to
 * panels it swaps in, so nothing here can affect the default ACF-rendered
 * header. Values are the app's design tokens resolved from the compiled
 * Laravel stylesheet (source of truth:
 * webapp/resources/scss/main-sass/components/ui/_header-nav-production-dropdown.scss).
 *
 * Panel positioning/open-close stays with the theme's own `.drop-menu-wide`
 * rules — the fragment reuses the same outer classes. This file covers what
 * the fragment markup needs beyond that:
 *   - guides panel: fragment has an <h3> and inline "View All" links the app
 *     hides on desktop, no chevron svg (the app draws it via ::after), and
 *     the theme's row-reverse category layout does not fit the app markup;
 *   - calculators panel: the fragment uses calc-card-* markup (not the
 *     theme's calc-card__* BEM), which the theme has no styles for.
 */

/* ── Shared ─────────────────────────────────────────────────────────────── */

/* The theme styles its own panels with several `!important` rules
   (h3 display, panel padding, child-items grid) — matching weight is
   required for the shared panel to take the app's geometry. */

#topnav .qc-shared-panel .d-none {
    display: none !important;
}

/* App panel padding: 40px top, 64px bottom, header inline padding.
   135px is the guest header token (--qc-space-header-padding-inline-guest);
   the authenticated app header uses 108px, but megamenus are a guest-facing
   surface and the delta only shifts content 27px on >1400px screens. */
#topnav .qc-shared-panel {
    padding: 40px 135px 64px !important;
}

@media (max-width: 1400px) {
    #topnav .qc-shared-panel {
        padding: 40px 32px 64px !important;
    }
}

#topnav .qc-shared-panel .qc-container {
    width: 100%;
    max-width: 1224px;
    margin: 0 auto;
    padding: 0;
}

/* ── Guides panel ───────────────────────────────────────────────────────── */

#topnav .qc-shared-panel h3 {
    display: none !important;
}

#topnav .qc-shared-panel .menu-big-inner {
    display: flex;
    flex-direction: row;
    gap: 32px;
    width: 100%;
    max-width: none;
}

#topnav .qc-shared-panel .parent-items {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    gap: 0;
    width: 370px;
    min-width: 370px;
    margin: 0;
    padding: 0;
    list-style: none;
    border-right: none;
}

#topnav .qc-shared-panel .parent-items li {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    padding: 16px 20px;
    border-radius: 8px;
    cursor: pointer;
}

#topnav .qc-shared-panel .parent-items li > svg {
    display: block;
    flex-shrink: 0;
    order: -1;
}

#topnav .qc-shared-panel .parent-items li > svg rect {
    fill: #f7f8fd;
}

#topnav .qc-shared-panel .parent-items li > svg path {
    stroke: #334ec8;
}

#topnav .qc-shared-panel .parent-items li > div {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

#topnav .qc-shared-panel .parent-items li > div h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 24px;
    color: #333333;
}

/* The app hides the per-category "View All" links on desktop. */
#topnav .qc-shared-panel .parent-items li > div a {
    display: none;
}

#topnav .qc-shared-panel .parent-items li::after {
    content: "";
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-left: auto;
    background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.5 15L12.5 10L7.5 5' stroke='%23333333' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

#topnav .qc-shared-panel .parent-items li.active,
#topnav .qc-shared-panel .parent-items li:hover {
    background: #f7f8fd;
}

#topnav .qc-shared-panel .child-items {
    flex: 1;
    min-width: 0;
    padding-left: 0;
    max-height: calc(100vh - 72px - 64px);
    overflow: auto;
}

#topnav .qc-shared-panel .child-items > div {
    display: flex !important;
    gap: 16px !important;
    justify-content: flex-start;
}

/* Must outweigh the `display: flex !important` on the same element above. */
#topnav .qc-shared-panel .child-items > div.d-none {
    display: none !important;
}

#topnav .qc-shared-panel .child-items > div:has(ul:nth-child(2):last-child) ul {
    max-width: fit-content;
}

#topnav .qc-shared-panel .child-items > div ul {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

#topnav .qc-shared-panel .child-items li {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 0;
    padding: 8px 16px 8px 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
}

#topnav .qc-shared-panel .child-items li:hover {
    background: #f7f8fd;
    border-color: #b8c3ff;
}

#topnav .qc-shared-panel .child-items li svg {
    display: block;
    flex-shrink: 0;
}

#topnav .qc-shared-panel .child-items li svg rect {
    fill: #f7f8fd;
}

#topnav .qc-shared-panel .child-items li svg path {
    stroke: #334ec8;
}

/* Overrides the inline stroke on the IR35 logotype icon. */
#topnav .qc-shared-panel .child-items li svg.IRR35 path {
    stroke: none !important;
}

#topnav .qc-shared-panel .child-items li a {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

#topnav .qc-shared-panel .child-items li h4 {
    margin: 0;
    max-width: 100%;
    overflow: hidden;
    font-size: 16px;
    font-weight: 700;
    line-height: 24px;
    color: #333333;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#topnav .qc-shared-panel .child-items li p {
    margin: 0;
    max-width: 176px;
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
    color: #7f7f7f;
    /* Reserve two caption lines so row heights stay even. */
    min-height: 32px;
}

/* ── Calculators panel ──────────────────────────────────────────────────── */

#topnav .qc-shared-panel .calc-cards-wrapper {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 32px;
    width: 100%;
    max-width: 1224px;
    margin: 0 auto;
}

#topnav .qc-shared-panel .calc-card {
    box-sizing: border-box;
    display: flex;
    flex: 1;
    flex-direction: column;
    width: 270px;
    min-width: 0;
    min-height: 280px;
    padding: 16px;
    border: 1px solid transparent;
    border-radius: 16px;
    color: inherit;
    text-decoration: none;
}

#topnav .qc-shared-panel .calc-card:hover {
    background: #f7f8fd;
    border-color: #b8c3ff;
    text-decoration: none;
}

#topnav .qc-shared-panel .calc-card-inner {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 16px;
}

#topnav .qc-shared-panel .calc-card-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#topnav .qc-shared-panel .calc-card-header h4 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    line-height: 32px;
    color: #333333;
}

#topnav .qc-shared-panel .calc-card-header span {
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
    text-transform: uppercase;
    color: #333333;
}

#topnav .qc-shared-panel .calc-card-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#topnav .qc-shared-panel .calc-card-content p {
    margin: 0;
    font-size: 12px;
    font-weight: 500;
    line-height: 20px;
    color: #333333;
}

#topnav .qc-shared-panel .calc-checks {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#topnav .qc-shared-panel .calc-check-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

#topnav .qc-shared-panel .calc-check-icon {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 2px;
    background: #009951;
}

#topnav .qc-shared-panel .calc-check-item span {
    font-size: 12px;
    font-weight: 500;
    line-height: 20px;
    color: #333333;
}

#topnav .qc-shared-panel .calc-preview {
    box-sizing: border-box;
    display: flex;
    flex: 1;
    align-items: center;
    width: 270px;
    min-width: 0;
    min-height: 280px;
    padding-left: 16px;
    border-left: 1px solid #c7cfdd;
}

#topnav .qc-shared-panel .calc-preview img {
    max-width: 100%;
    height: auto;
}

/* Desktop panels never render inside the mobile drawer. */
@media (max-width: 991px) {
    #topnav .qc-shared-panel {
        display: none;
    }
}
