/* Cloudpedia store browsing navigation (#447, approved color inversion).
   Preserve the accepted shared table content width. Inactive Group cards
   are solid blue with bold white labels/icons; the active card is white
   with bold blue labels/icons and checkmark.
   Scope: Product Catalog, cart.php?a=add&domain=register and
   cart.php?a=add&domain=transfer only, gated on .cp-store-browsing (set by
   header.tpl when the backend hook reports cpStoreBrowsing). Every rule is
   scoped to .cp-sn-* or the browsing content so later-loaded stage
   stylesheets (order-form common.tpl) cannot repaint it at equal weight, and
   no rule leaks onto configuration/Cart Review/Checkout or managed pages.
   Token-only colors, no priority flags, no Bootstrap 5 hooks, no CDN. */

/* ---- Browsing tabs: Products link + Domains disclosure ---- */
.cp-sn-nav {
    display: flex;
    align-items: center;
    gap: 0;
    border-bottom: 1px solid var(--cp-border-neutral);
    margin-bottom: 16px;
    position: relative;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

.cp-sn-products,
.cp-sn-summary {
    padding: 12px 16px;
    border-bottom: 2px solid transparent;
    display: block;
    font-weight: 500;
    font-size: 14px;
    color: var(--cp-gray-900);
    text-decoration: none;
    white-space: nowrap;
}

.cp-sn-products:hover,
.cp-sn-summary:hover {
    color: var(--cp-primary-500);
    text-decoration: none;
}

.cp-sn-nav .active {
    color: var(--cp-primary-500);
    border-bottom-color: var(--cp-primary-500);
    font-weight: 600;
}

.cp-sn-domains {
    position: relative;
}

.cp-sn-summary {
    list-style: none;
    cursor: pointer;
}

.cp-sn-summary::-webkit-details-marker {
    display: none;
}

.cp-sn-summary::marker {
    content: '';
}

.cp-sn-chevron {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-left: 8px;
    border-right: 2px solid var(--cp-gray-600);
    border-bottom: 2px solid var(--cp-gray-600);
    transform: rotate(45deg) translateY(-2px);
}

.cp-sn-domains:not([open]) > .cp-sn-menu {
    display: none;
}

.cp-sn-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 224px;
    max-width: calc(100vw - 32px);
    background: var(--cp-surface);
    border: 1px solid var(--cp-border-neutral);
    border-radius: 8px;
    box-shadow: 0 12px 32px var(--cp-shadow-pop);
    padding: 6px;
    z-index: 5;
}

.cp-sn-menu-link {
    display: block;
    padding: 10px 12px;
    border-radius: 4px;
    font-size: 13px;
    color: var(--cp-gray-900);
    text-decoration: none;
    white-space: nowrap;
}

.cp-sn-menu-link:hover,
.cp-sn-menu-link:focus-visible {
    background: var(--cp-surface-muted);
    text-decoration: none;
}

.cp-sn-menu-link.active {
    color: var(--cp-primary-500);
    font-weight: 600;
}

.cp-sn-products:focus-visible,
.cp-sn-summary:focus-visible,
.cp-sn-menu-link:focus-visible,
.cp-sn-group-card:focus-visible {
    outline: 2px solid var(--cp-primary-500);
    outline-offset: 3px;
}

/* ---- Product Group card panel (catalogs only) ---- */
.cp-sn-groups {
    background: var(--cp-surface);
    border: 1px solid var(--cp-border-neutral);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    color: var(--cp-gray-900);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

.cp-sn-groups-title {
    display: block;
    font-family: inherit;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 2px;
    color: var(--cp-gray-900);
}

/* CloudX forces headings toward Poppins normal; the h2 keeps semantics
   while the inner label carries the visual weight (same pattern as the
   domain popular-extensions label). No priority flags. */
.cp-sn-groups-title .cp-sn-groups-title-text {
    font-weight: 700;
}

.cp-sn-groups-desc {
    display: block;
    color: var(--cp-gray-600);
    font-size: 13px;
    margin: 0 0 18px;
}

.cp-sn-group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.cp-sn-group-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    min-height: 56px;
    border: 1px solid var(--cp-primary-500);
    border-radius: 10px;
    background: var(--cp-primary-500);
    color: var(--cp-surface);
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
}

.cp-sn-group-card:hover,
.cp-sn-group-card:focus-visible {
    background: var(--cp-primary-600);
    border-color: var(--cp-primary-600);
    color: var(--cp-surface);
    text-decoration: none;
}

.cp-sn-group-card.active,
.cp-sn-group-card.active:hover,
.cp-sn-group-card.active:focus-visible {
    position: relative;
    padding-right: 32px;
    background: var(--cp-surface);
    border-color: var(--cp-primary-500);
    color: var(--cp-primary-500);
}

.cp-sn-group-card.active::after {
    content: '✓';
    position: absolute;
    right: 10px;
    top: 10px;
    color: var(--cp-primary-500);
    font-size: 14px;
}

.cp-sn-group-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 8px;
    background: transparent;
    color: inherit;
}

.cp-sn-group-icon::before {
    content: '';
    width: 24px;
    height: 24px;
    background: currentColor;
    mask: var(--cp-sn-icon-file) center/contain no-repeat;
    -webkit-mask: var(--cp-sn-icon-file) center/contain no-repeat;
}

.cp-sn-group-icon[data-icon="browser"] {
    --cp-sn-icon-file: url('../img/cp-store-navigation/browser.svg');
}

.cp-sn-group-icon[data-icon="server"] {
    --cp-sn-icon-file: url('../img/cp-store-navigation/server.svg');
}

.cp-sn-group-icon[data-icon="database"] {
    --cp-sn-icon-file: url('../img/cp-store-navigation/database.svg');
}

.cp-sn-group-icon[data-icon="puzzle"] {
    --cp-sn-icon-file: url('../img/cp-store-navigation/puzzle.svg');
}

.cp-sn-group-icon[data-icon="shield-check"] {
    --cp-sn-icon-file: url('../img/cp-store-navigation/shield-check.svg');
}

.cp-sn-group-icon[data-icon="cloud"] {
    --cp-sn-icon-file: url('../img/cp-store-navigation/cloud.svg');
}

.cp-sn-group-name {
    min-width: 0;
}

/* ---- Shared table content width (#447 revision): nav, Group panel,
   catalog ROOTs and domain ROOTs join the same width as other table pages
   (.cp-services-wrap, .primary-content > .cp-section-tabs): full width
   capped at the shared token, centered. The inherited shell (container, row,
   primary-content, banner) is untouched. Only nested catalog caps are undone
   here; pricing-card internals and the global content token are untouched.
   Browsing selectors carry the browsing scope plus an ID where they must
   beat a later-loaded stage rule at any order. ---- */
.primary-content.cp-store-browsing .cp-sn-nav,
.primary-content.cp-store-browsing .cp-sn-groups,
.primary-content.cp-store-browsing #order-standard_cart.cphc-body,
.primary-content.cp-store-browsing #order-standard_cart.cpvc-body,
.primary-content.cp-store-browsing #order-standard_cart.cpsc-body,
.primary-content.cp-store-browsing #order-standard_cart.cpac-body,
.primary-content.cp-store-browsing #order-standard_cart.cp-ssl-body,
.primary-content.cp-store-browsing .cp-domain-search.cp-domain-register-vercel,
.primary-content.cp-store-browsing .cp-domain-search.cp-domain-transfer-vercel {
    width: 100%;
    max-width: var(--cp-content-max);
    margin-left: auto;
    margin-right: auto;
}

/* Native catalog roots keep their vertical rhythm but lose horizontal
   padding, so the uncapped wrappers below share the nav edges. */
.primary-content.cp-store-browsing #order-standard_cart.cphc-body,
.primary-content.cp-store-browsing #order-standard_cart.cpvc-body,
.primary-content.cp-store-browsing #order-standard_cart.cpsc-body,
.primary-content.cp-store-browsing #order-standard_cart.cpac-body,
.primary-content.cp-store-browsing #order-standard_cart.cp-ssl-body {
    padding-left: 0;
    padding-right: 0;
}

.primary-content.cp-store-browsing .cphc-products-wrapper,
.primary-content.cp-store-browsing .cpvc-products-wrapper,
.primary-content.cp-store-browsing .cpsc-products-wrapper,
.primary-content.cp-store-browsing .cpac-products-wrapper,
.primary-content.cp-store-browsing .cp-ssl-section {
    max-width: none;
}

/* Domain sections align to the capped domain ROOT, not their own cap. */
.primary-content.cp-store-browsing .cp-domain-register-vercel.cp-domain-search--register .cp-container,
.primary-content.cp-store-browsing .cp-domain-transfer-vercel .cp-container {
    max-width: none;
    padding-left: 0;
    padding-right: 0;
}

/* Email-verification banner container mirrors the table banner rule in
   sidebar.css (same 60px/15px geometry, so the capped inner card lands on
   the same edges). The :has() carries #main-body to beat the generic
   sidebar banner rule at any order. Scoped here so sidebar.css stays
   untouched. */
.cp-page-wrapper:has(#main-body .primary-content.cp-store-browsing) .email-verification .container {
    width: calc(100% - 60px);
    max-width: none;
    margin-left: 15px;
    margin-right: 0;
}

@media (max-width: 767px) {
    /* Anchor the open menu to the nav, not the trigger: after Products the
       trigger offset plus 224px would spill past 320px viewports. */
    .cp-sn-domains {
        position: static;
    }

    .cp-sn-groups {
        padding: 16px;
    }

    .cp-sn-group-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cp-sn-group-card {
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 8px;
        overflow-wrap: anywhere;
    }

    .cp-sn-groups-title {
        font-size: 20px;
    }
}
