/* PERMATA757 - ROYAL SAPPHIRE UNIFIED NAV AND BUTTONS V2
   Only loaded when active_template = royal-sapphire-gold.
   Public pages only; no game URLs, click handlers, positioning or DOM changes.
   Note: no global 'button' or 'a' selector to protect controls and game cards.
*/

:root {
    --rsv2-blue-edge: rgba(83, 162, 255, .64);
    --rsv2-blue-light: rgba(30, 116, 255, .27);
    --rsv2-blue-hover: rgba(61, 137, 255, .42);
    --rsv2-gold-edge: rgba(255, 221, 128, .64);
}

/* One unified frame for each top icon strip; links remain separate click targets,
   but without individual luminous boxes. Keep original image/size/scroll behavior. */
body.is-chaosapiv2 nav.app-menu.app-menu--d,
body.is-chaosapi nav.app-menu {
    border-radius: 12px !important;
    box-shadow: inset 0 0 0 1px var(--rsv2-blue-edge),
                0 0 12px rgba(30, 114, 255, .19),
                0 5px 15px rgba(0, 6, 28, .32) !important;
    background-color: rgba(5, 18, 48, .29);
}

body.is-chaosapiv2 nav.app-menu.app-menu--d > ul,
body.is-chaosapi nav.app-menu > ul {
    border-radius: 12px;
}

/* Cancel V1 single-link frames inside the shared top frame. */
body.is-chaosapiv2 nav.app-menu.app-menu--d .app-menu__item > a,
body.is-chaosapi nav.app-menu .app-menu__item > a {
    background-image: none !important;
    box-shadow: none !important;
    border-radius: 8px !important;
    transition: background-color .22s ease, color .22s ease,
                box-shadow .22s ease !important;
}

/* Mild active state stays legible and doesn't look like a separate card. */
body.is-chaosapiv2 nav.app-menu.app-menu--d .app-menu__item > a.app-link--active,
body.is-chaosapi nav.app-menu .app-menu__item > a.app-link--active {
    background-color: rgba(42, 110, 230, .16) !important;
}

/* Desktop's existing header image, provider menu scrolling and icon sizing remain. */
@media (hover: hover) and (pointer: fine) {
    body.is-chaosapiv2 nav.app-menu.app-menu--d .app-menu__item > a:hover,
    body.is-chaosapi nav.app-menu .app-menu__item > a:hover {
        background-color: rgba(59, 123, 236, .20) !important;
        box-shadow: inset 0 0 0 1px rgba(130, 189, 255, .30) !important;
    }
}

/* On phones the original menu is 1rem wider and shifted left; putting the frame
   back inside the container prevents its rounded edges from being clipped. */
@media (max-width: 1023.98px) {
    body.is-chaosapi nav.app-menu {
        left: 0;
        width: 100%;
        box-sizing: border-box;
    }
}

/* Small text navigation links, including the mobile header breadcrumbs,
   are intentionally separate rounded pills as requested. */
body.is-chaosapiv2 nav.app-breadcrumbs .nav-item:not(.nav-item--fill) > a,
body.is-chaosapi nav.app-breadcrumbs .nav-item:not(.nav-item--fill) > a {
    border-radius: 8px !important;
    background: linear-gradient(180deg, rgba(28, 75, 163, .29), rgba(5, 23, 65, .25)) !important;
    box-shadow: inset 0 0 0 1px rgba(107, 164, 252, .32) !important;
    transition: background-color .2s ease, box-shadow .2s ease !important;
}

body.is-chaosapiv2 nav.app-breadcrumbs .nav-item > a.app-link--active,
body.is-chaosapi nav.app-breadcrumbs .nav-item > a.app-link--active {
    box-shadow: inset 0 0 0 1px var(--rsv2-gold-edge),
                0 0 8px rgba(230, 179, 70, .15) !important;
}

@media (max-width: 1023.98px) {
    body.is-chaosapi .app-header__extra .app-breadcrumbs ul { gap: 3px; }
}

/* Consistent buttons on all public pages: homepage, registration, game categories,
   support, profile, payments. Excludes circular/icon and Play-overlay buttons. */
body.is-chaosapiv2 :is(.btn, .card__see-all):not(.btn--round):not(.btn--sm-round):not(.btn--round--sm):not(.btn--demo-play),
body.is-chaosapi :is(.btn, .card__see-all):not(.btn--round):not(.btn--sm-round):not(.btn--round--sm):not(.btn--demo-play) {
    border-radius: 10px !important;
    box-shadow: inset 0 0 0 1px rgba(108, 168, 255, .48),
                0 3px 10px rgba(0, 10, 35, .32),
                0 0 9px rgba(51, 124, 255, .20) !important;
    transition: background-color .2s ease, box-shadow .2s ease,
                border-color .2s ease !important;
}

/* Gold buttons keep the gold treatment rather than inheriting a blue frame. */
body.is-chaosapiv2 .btn.btn--brand:not(.btn--round):not(.btn--sm-round),
body.is-chaosapi .btn.btn--brand:not(.btn--round):not(.btn--sm-round) {
    box-shadow: inset 0 0 0 1px var(--rsv2-gold-edge),
                0 3px 12px rgba(105, 74, 20, .34),
                0 0 10px rgba(214, 166, 69, .24) !important;
}

@media (hover: hover) and (pointer: fine) {
    body.is-chaosapiv2 :is(.btn, .card__see-all):not(.btn--round):not(.btn--sm-round):not(.btn--round--sm):not(.btn--demo-play):not(:disabled):hover,
    body.is-chaosapi :is(.btn, .card__see-all):not(.btn--round):not(.btn--sm-round):not(.btn--round--sm):not(.btn--demo-play):not(:disabled):hover {
        box-shadow: inset 0 0 0 1px rgba(170, 216, 255, .84),
                    0 4px 13px rgba(26, 95, 239, .36),
                    0 0 14px var(--rsv2-blue-hover) !important;
    }
    body.is-chaosapiv2 .btn.btn--brand:not(.btn--round):not(.btn--sm-round):not(:disabled):hover,
    body.is-chaosapi .btn.btn--brand:not(.btn--round):not(.btn--sm-round):not(:disabled):hover {
        box-shadow: inset 0 0 0 1px rgba(255, 228, 156, .95),
                    0 4px 15px rgba(184, 123, 23, .35),
                    0 0 15px rgba(231, 184, 72, .28) !important;
    }
}

body.is-chaosapiv2 :is(.btn, .card__see-all):disabled,
body.is-chaosapi :is(.btn, .card__see-all):disabled {
    box-shadow: none !important;
}

body.is-chaosapiv2 :is(.btn, .card__see-all, .app-menu__item > a, .app-breadcrumbs .nav-item > a):focus-visible,
body.is-chaosapi :is(.btn, .card__see-all, .app-menu__item > a, .app-breadcrumbs .nav-item > a):focus-visible {
    outline: 2px solid #f4d077 !important;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    body.is-chaosapiv2 :is(.btn, .card__see-all, .app-menu__item > a, .app-breadcrumbs .nav-item > a),
    body.is-chaosapi :is(.btn, .card__see-all, .app-menu__item > a, .app-breadcrumbs .nav-item > a) {
        transition: none !important;
    }
}

/* PERMATA757 - ROYAL SAPPHIRE FRAME GLOW V4
   Refinement: align top strips to the content width, add inner separators,
   and make homepage section cards darker so the glow frame is more visible
   on both desktop and mobile.
*/

:root {
    --rsv2-shell-max: 1169px;
    --rsv2-shell-radius: 18px;
    --rsv2-frame-bg: linear-gradient(180deg, rgba(20, 56, 132, .94) 0%, rgba(7, 21, 63, .97) 100%);
    --rsv2-frame-bg-dark: linear-gradient(180deg, rgba(9, 26, 76, .96) 0%, rgba(4, 12, 38, .99) 100%);
    --rsv2-frame-border: rgba(82, 160, 255, .55);
    --rsv2-frame-glow: rgba(42, 131, 255, .22);
    --rsv2-divider: linear-gradient(180deg, rgba(141, 197, 255, .06) 0%, rgba(124, 187, 255, .42) 20%, rgba(99, 163, 255, .68) 50%, rgba(124, 187, 255, .42) 80%, rgba(141, 197, 255, .06) 100%);
}

/* 1) Desktop top menu strip aligns with the main content area. */
@media (min-width: 1024px) {
    body.is-chaosapiv2 nav.app-menu.app-menu--d {
        width: 100% !important;
        max-width: var(--rsv2-shell-max) !important;
        margin: 0.4rem auto 0.7rem !important;
        overflow: hidden;
        box-sizing: border-box;
    }
}

/* Source-verified desktop classes (header.blade.php).
   Remove the original 1rem margin on every item: 12 margins made the
   centered navigation overflow while its frame was narrower than .container. */
@media (min-width: 1024px) {
    body.is-chaosapiv2 nav.app-menu.app-menu--d > ul {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
        justify-content: space-between !important;
        padding: 0 !important;
    }
    body.is-chaosapiv2 nav.app-menu.app-menu--d > ul > li.app-menu__item {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    body.is-chaosapiv2 nav.app-menu.app-menu--d > ul > li.app-menu__item > a {
        min-width: 0;
        padding-inline: 3px !important;
        box-sizing: border-box;
    }
    body.is-chaosapiv2 nav.app-menu.app-menu--d .app-menu__item > a > span {
        white-space: nowrap;
        max-width: 100%;
        font-size: clamp(11px, .85vw, 14px);
    }
}

/* 2) Shared outer frame for both desktop and mobile icon strips. */
body.is-chaosapiv2 nav.app-menu.app-menu--d,
body.is-chaosapi nav.app-menu {
    border-radius: 16px !important;
    background: linear-gradient(180deg, rgba(8, 27, 77, .95) 0%, rgba(4, 16, 46, .98) 100%) !important;
    box-shadow:
        inset 0 0 0 1px rgba(87, 164, 255, .72),
        inset 0 0 18px rgba(58, 132, 255, .12),
        0 0 18px rgba(29, 118, 255, .20),
        0 10px 24px rgba(0, 8, 34, .36) !important;
}

body.is-chaosapiv2 nav.app-menu.app-menu--d > ul,
body.is-chaosapi nav.app-menu > ul {
    border-radius: 16px;
    overflow: hidden;
    align-items: stretch;
}

/* 3) Each top icon item stays inside the same frame with vertical separators. */
body.is-chaosapiv2 nav.app-menu.app-menu--d .app-menu__item,
body.is-chaosapi nav.app-menu .app-menu__item {
    position: relative;
    display: flex;
    align-items: stretch;
}

body.is-chaosapiv2 nav.app-menu.app-menu--d .app-menu__item + .app-menu__item::before,
body.is-chaosapi nav.app-menu .app-menu__item + .app-menu__item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 1px;
    background: var(--rsv2-divider);
    pointer-events: none;
}

body.is-chaosapiv2 nav.app-menu.app-menu--d .app-menu__item > a,
body.is-chaosapi nav.app-menu .app-menu__item > a {
    width: 100%;
    height: 100%;
    border-radius: 0 !important;
    padding-inline: 14px !important;
    background: transparent !important;
}

body.is-chaosapiv2 nav.app-menu.app-menu--d .app-menu__item:first-of-type > a,
body.is-chaosapi nav.app-menu .app-menu__item:first-of-type > a {
    border-top-left-radius: 16px !important;
    border-bottom-left-radius: 16px !important;
}

body.is-chaosapiv2 nav.app-menu.app-menu--d .app-menu__item:last-of-type > a,
body.is-chaosapi nav.app-menu .app-menu__item:last-of-type > a {
    border-top-right-radius: 16px !important;
    border-bottom-right-radius: 16px !important;
}

body.is-chaosapiv2 nav.app-menu.app-menu--d .app-menu__item > a.app-link--active,
body.is-chaosapi nav.app-menu .app-menu__item > a.app-link--active {
    background: linear-gradient(180deg, rgba(37, 102, 219, .16), rgba(11, 40, 104, .22)) !important;
    box-shadow: inset 0 0 0 1px rgba(122, 182, 255, .18) !important;
}

@media (hover: hover) and (pointer: fine) {
    body.is-chaosapiv2 nav.app-menu.app-menu--d .app-menu__item > a:hover,
    body.is-chaosapi nav.app-menu .app-menu__item > a:hover {
        background: linear-gradient(180deg, rgba(46, 113, 230, .14), rgba(11, 40, 104, .20)) !important;
        box-shadow: inset 0 0 0 1px rgba(146, 201, 255, .16) !important;
    }
}

/* 4) Mobile icon strip stays aligned and wrapped inside the viewport neatly. */
@media (max-width: 1023.98px) {
    body.is-chaosapi nav.app-menu {
        left: 0 !important;
        width: 100% !important;
        margin: 10px 0 14px !important;
        overflow: hidden;
    }

    body.is-chaosapi nav.app-menu > ul {
        padding-inline: 2px;
    }

    body.is-chaosapi nav.app-menu .app-menu__item > a {
        min-width: 102px;
        padding-inline: 12px !important;
    }

    body.is-chaosapi nav.app-menu .app-menu__item + .app-menu__item::before {
        top: 10px;
        bottom: 10px;
    }
}

/* 5) Desktop and mobile homepage sections get darker fills + glow frames,
      so each homepage block looks separated and the glow is visible. */
body.is-chaosapiv2 section.home > article.card,
body.is-chaosapi section.home > article.card {
    position: relative;
    margin-bottom: 16px;
    border-radius: var(--rsv2-shell-radius) !important;
    overflow: hidden;
    background: var(--rsv2-frame-bg-dark) !important;
    box-shadow:
        inset 0 0 0 1px var(--rsv2-frame-border),
        inset 0 0 16px rgba(67, 141, 255, .10),
        0 0 16px var(--rsv2-frame-glow),
        0 10px 22px rgba(0, 7, 29, .32) !important;
}

body.is-chaosapiv2 section.home > article.card > .card__header,
body.is-chaosapi section.home > article.card > .card__header {
    background: linear-gradient(180deg, rgba(31, 76, 173, .95) 0%, rgba(19, 56, 136, .96) 100%) !important;
    border-bottom: 1px solid rgba(111, 175, 255, .28) !important;
}

body.is-chaosapiv2 section.home > article.card > .card__body,
body.is-chaosapi section.home > article.card > .card__body {
    background: rgba(5, 16, 48, .20) !important;
}

/* Special handling for the split cards on mobile so each homepage section still
   feels like a separate framed block, not fused with surrounding content. */
@media (max-width: 1023.98px) {
    /* Source-verified fix: royalty theme defines .home .card {margin-top:-20px}.
       Clear the overlap, then introduce a real visible gap between sections. */
    body.is-chaosapi section.home > article.card {
        margin-top: 0 !important;
        margin-bottom: 10px !important;
        padding-bottom: 10px !important;
        border-radius: 16px !important;
        isolation: isolate;
    }
}

/* 6) The small homepage nav (Beranda/Eksklusif/...) also gets a darker shell so
      it doesn't look brighter than the frame. */
body.is-chaosapiv2 nav.app-breadcrumbs.home--full-width.app-breadcrumbs--d,
body.is-chaosapi .app-header__extra .app-breadcrumbs,
body.is-chaosapi section.home nav.app-breadcrumbs {
    background: linear-gradient(180deg, rgba(8, 23, 68, .94) 0%, rgba(4, 14, 42, .98) 100%) !important;
    border-radius: 16px !important;
    box-shadow:
        inset 0 0 0 1px rgba(86, 158, 255, .48),
        inset 0 0 12px rgba(68, 137, 255, .10),
        0 0 12px rgba(34, 108, 255, .16) !important;
}

/* 7) On the homepage, keep the section backgrounds darker than the glow frame. */
body.is-chaosapiv2 section.home .card--light,
body.is-chaosapi section.home .card--light,
body.is-chaosapi section.home .card--primary,
body.is-chaosapi section.home .card--split {
    background-color: transparent !important;
}

/* 8) Prevent any framed homepage block from stretching visually wider than
      the intended centered content column on desktop. */
@media (min-width: 1024px) {
    body.is-chaosapiv2 section.home.home--d,
    body.is-chaosapiv2 section.home.home--d > * {
        max-width: 100%;
    }
}
