/* ==========================================================================
   Shakebug Top Navigation Styles (US Developer Tool Information Architecture)
   Header structure: header > .logo + #mobilemenu + .headright(.custnav .menus + .rheader)
   ========================================================================== */

/* Header base wrapper */
header:not(.docs-header):not(.docs-fixed-header) {
    background: #ffffff !important;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8) !important;
    box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05) !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    transition: all 0.2s ease;
}

/* Desktop layout (1200px and up) */
@media (min-width: 1200px) {
    header:not(.docs-header):not(.docs-fixed-header) {
        padding: 14px 48px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    header:not(.docs-header):not(.docs-fixed-header) .logo {
        flex: 0 0 auto;
        float: none !important;
        margin: 0;
    }

    header .logo a {
        display: inline-block;
        vertical-align: middle;
    }

    header .logo img {
        width: 185px !important;
        height: auto;
        display: block;
    }

    .headright {
        flex: 1 1 auto;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        margin-left: 36px;
        float: none !important;
    }

    /* Primary Navigation */
    .custnav {
        position: static !important;
        transform: none !important;
        -webkit-transform: none !important;
        -moz-transform: none !important;
        float: none !important;
        margin: 0 !important;
        width: auto !important;
    }

    .custnav .menus {
        display: flex !important;
        align-items: center !important;
        margin: 0 !important;
        padding: 0 !important;
        list-style: none !important;
        gap: 6px;
    }

    .custnav .menus > li {
        position: relative !important;
        float: none !important;
        padding: 0 !important;
        margin: 0;
    }

    .custnav .menus > li > a {
        display: inline-flex !important;
        align-items: center !important;
        padding: 8px 14px !important;
        font-family: 'Nunito Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
        font-size: 15px !important;
        font-weight: 700 !important;
        color: #1e293b !important;
        text-decoration: none !important;
        border-radius: 8px;
        transition: color 0.15s ease, background-color 0.15s ease !important;
        white-space: nowrap;
        border: none !important;
        line-height: 1.4 !important;
    }

    .custnav .menus > li > a:hover,
    .custnav .menus > li.has-mega:hover > a {
        color: #0b8a96 !important;
        background-color: rgba(29, 211, 227, 0.08) !important;
    }

    /* Desktop Caret indicator */
    .nav-caret {
        display: inline-block;
        width: 6px;
        height: 6px;
        margin-left: 7px;
        margin-top: -3px;
        border-right: 2px solid #64748b;
        border-bottom: 2px solid #64748b;
        transform: rotate(45deg);
        transition: transform 0.2s ease, border-color 0.2s ease;
        vertical-align: middle;
    }

    .custnav .menus > li.has-mega:hover > a .nav-caret {
        transform: rotate(-135deg);
        margin-top: 3px;
        border-color: #0b8a96;
    }

    /* Dropdown Mega Card */
    .menus li.has-mega > .mega {
        position: absolute !important;
        top: calc(100% + 6px) !important;
        left: 0 !important;
        min-width: 330px !important;
        background: #ffffff !important;
        border: 1px solid rgba(226, 232, 240, 0.95) !important;
        border-radius: 14px !important;
        box-shadow: 0 20px 40px -12px rgba(15, 23, 42, 0.16), 0 4px 12px rgba(15, 23, 42, 0.06) !important;
        padding: 10px !important;
        margin: 0 !important;
        list-style: none !important;
        display: none !important;
        z-index: 1050 !important;
    }

    /* Invisible hover bridge between parent and dropdown to prevent flickering */
    .menus li.has-mega > .mega::before {
        content: "";
        position: absolute;
        top: -12px;
        left: 0;
        right: 0;
        height: 14px;
        background: transparent;
    }

    .menus li.has-mega:hover > .mega,
    .menus li.has-mega:focus-within > .mega {
        display: block !important;
        animation: navDropdownFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    @keyframes navDropdownFadeIn {
        from {
            opacity: 0;
            transform: translateY(6px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .menus li.has-mega .mega li {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
        float: none !important;
        width: 100% !important;
        border: none !important;
    }

    .menus li.has-mega .mega li a {
        display: flex !important;
        flex-direction: column !important;
        padding: 10px 14px !important;
        border-radius: 9px !important;
        text-decoration: none !important;
        background: transparent !important;
        transition: all 0.15s ease !important;
        border: none !important;
    }

    .menus li.has-mega .mega li a:hover {
        background-color: #f0fbfc !important;
    }

    .menus li.has-mega .mega li a .nav-item-title {
        display: block !important;
        font-size: 14.5px !important;
        font-weight: 700 !important;
        color: #1e293b !important;
        line-height: 1.35 !important;
        transition: color 0.15s ease;
    }

    .menus li.has-mega .mega li a:hover .nav-item-title {
        color: #0b8a96 !important;
    }

    .menus li.has-mega .mega li a .nav-item-desc {
        display: block !important;
        font-size: 12.5px !important;
        font-weight: 400 !important;
        color: #64748b !important;
        line-height: 1.4 !important;
        margin-top: 3px !important;
        white-space: normal !important;
        transition: color 0.15s ease;
    }

    .menus li.has-mega .mega li a:hover .nav-item-desc {
        color: #475569 !important;
    }

    /* Right Action CTAs */
    .rheader {
        flex: 0 0 auto;
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
        margin: 0 0 0 24px !important;
        float: none !important;
    }

    .rheader a {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-family: 'Nunito Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
        font-size: 14.5px !important;
        font-weight: 700 !important;
        height: 42px !important;
        line-height: 42px !important;
        padding: 0 22px !important;
        border-radius: 999px !important;
        text-decoration: none !important;
        white-space: nowrap !important;
        margin: 0 !important;
        width: auto !important;
        transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }

    /* Secondary CTA: Sign In */
    .rheader a.bbtn {
        background: #ffffff !important;
        border: 1.5px solid #cbd5e1 !important;
        color: #334155 !important;
    }

    .rheader a.bbtn:hover {
        border-color: #1dd3e3 !important;
        color: #0b8a96 !important;
        background: #f0fbfc !important;
        transform: translateY(-1px);
    }

    /* Primary CTA: Start Free */
    .rheader a.cbtn {
        background: #1dd3e3 !important;
        border: 1.5px solid #1dd3e3 !important;
        color: #ffffff !important;
        box-shadow: 0 4px 14px rgba(29, 211, 227, 0.38) !important;
    }

    .rheader a.cbtn:hover {
        background: #15bed0 !important;
        border-color: #15bed0 !important;
        box-shadow: 0 6px 20px rgba(29, 211, 227, 0.5) !important;
        transform: translateY(-1px);
        color: #ffffff !important;
    }
}

/* Compact desktop screens (1200px - 1400px) */
@media (min-width: 1200px) and (max-width: 1400px) {
    header:not(.docs-header):not(.docs-fixed-header) {
        padding: 12px 24px !important;
    }

    .headright {
        margin-left: 18px;
    }

    .custnav .menus {
        gap: 2px;
    }

    .custnav .menus > li > a {
        padding: 8px 9px !important;
        font-size: 14px !important;
    }

    .rheader {
        gap: 8px !important;
        margin-left: 14px !important;
    }

    .rheader a {
        padding: 0 16px !important;
        font-size: 13.5px !important;
        height: 38px !important;
        line-height: 38px !important;
    }
}

/* Mobile & Tablet Drawer (below 1200px) */
@media (max-width: 1199px) {
    header:not(.docs-header):not(.docs-fixed-header) {
        padding: 12px 18px !important;
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    header:not(.docs-header):not(.docs-fixed-header) .logo {
        flex: 0 0 auto;
        float: none !important;
    }

    header .logo img {
        width: 155px !important;
    }

    /* Hamburger toggle button */
    #mobilemenu {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        margin: 0;
        cursor: pointer;
        border-radius: 8px;
        background: #f1f5f9;
        transition: background-color 0.2s ease;
    }

    #mobilemenu:hover {
        background: #e2e8f0;
    }

    #mobilemenu::before {
        content: "\2630";
        font-size: 24px;
        line-height: 1;
        color: #0f172a;
    }

    #mobilemenu.open::before {
        content: "\2715";
        font-size: 22px;
        color: #0b8a96;
    }

    /* Mobile collapsible panel */
    .headright {
        display: none;
        float: none !important;
        width: 100% !important;
        flex-basis: 100% !important;
        order: 3;
        margin-top: 12px;
        padding-top: 8px;
        border-top: 1px solid #eef2f6;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
    }

    .headright.mnav-open {
        display: block !important;
        animation: mobileMenuSlideDown 0.2s ease forwards;
    }

    @keyframes mobileMenuSlideDown {
        from {
            opacity: 0;
            transform: translateY(-8px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .custnav {
        position: static !important;
        transform: none !important;
        width: 100% !important;
        margin: 0 !important;
        float: none !important;
    }

    .custnav .menus {
        display: block !important;
        float: none !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        list-style: none !important;
    }

    .custnav .menus > li {
        float: none !important;
        display: block !important;
        width: 100% !important;
        padding: 0 !important;
        border-top: 1px solid #f1f5f9;
    }

    .custnav .menus > li:first-child {
        border-top: none;
    }

    .custnav .menus > li > a {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 13px 4px !important;
        font-size: 16px !important;
        font-weight: 700 !important;
        color: #1e293b !important;
        text-decoration: none !important;
        border: none !important;
    }

    /* Mobile Caret */
    .custnav .menus > li.has-mega > a .nav-caret {
        display: inline-block;
        width: 8px;
        height: 8px;
        border-right: 2px solid #94a3b8;
        border-bottom: 2px solid #94a3b8;
        transform: rotate(45deg);
        transition: transform 0.2s ease;
        margin-right: 4px;
    }

    .custnav .menus > li.has-mega.mega-open > a .nav-caret {
        transform: rotate(-135deg);
        border-color: #0b8a96;
    }

    /* Mobile Submenu Accordion */
    .menus li.has-mega > .mega {
        display: none !important;
        position: static !important;
        box-shadow: none !important;
        border: none !important;
        border-left: 2px solid #1dd3e3 !important;
        background: #f8fafc !important;
        border-radius: 0 8px 8px 0 !important;
        padding: 6px 8px !important;
        margin: 2px 0 10px 8px !important;
        min-width: 0 !important;
        list-style: none !important;
    }

    .menus li.has-mega.mega-open > .mega {
        display: block !important;
    }

    .menus li.has-mega .mega li {
        display: block !important;
        width: 100% !important;
        border: none !important;
        padding: 0 !important;
    }

    .menus li.has-mega .mega li a {
        display: flex !important;
        flex-direction: column !important;
        padding: 10px 8px !important;
        text-decoration: none !important;
        border-radius: 6px;
    }

    .menus li.has-mega .mega li a:active,
    .menus li.has-mega .mega li a:hover {
        background-color: #f1f5f9 !important;
    }

    .menus li.has-mega .mega li a .nav-item-title {
        display: block;
        font-size: 14.5px !important;
        font-weight: 700 !important;
        color: #1e293b !important;
    }

    .menus li.has-mega .mega li a .nav-item-desc {
        display: block;
        font-size: 12px !important;
        color: #64748b !important;
        margin-top: 2px;
        line-height: 1.35;
    }

    /* Mobile CTAs */
    .rheader {
        float: none !important;
        display: flex !important;
        gap: 10px !important;
        padding: 18px 0 10px !important;
        border-top: 1px solid #f1f5f9;
        margin-top: 6px;
    }

    .rheader a {
        flex: 1 1 0 !important;
        width: 100% !important;
        margin: 0 !important;
        height: 44px !important;
        line-height: 44px !important;
        text-align: center !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 14.5px !important;
        font-weight: 700 !important;
        border-radius: 999px !important;
    }

    .rheader a.bbtn {
        background: #ffffff !important;
        border: 1.5px solid #cbd5e1 !important;
        color: #334155 !important;
    }

    .rheader a.cbtn {
        background: #1dd3e3 !important;
        border: 1.5px solid #1dd3e3 !important;
        color: #ffffff !important;
    }
}
