/* =========================================================
   NEXOARENA PRO - EPIC 08A.6B
   Mobile-first UI Motion & Interaction Polish
   ========================================================= */

:root {
    --na-motion-instant: 80ms;
    --na-motion-fast: 140ms;
    --na-motion-base: 220ms;
    --na-motion-slow: 360ms;
    --na-ease-out: cubic-bezier(.16, 1, .3, 1);
    --na-ease-in-out: cubic-bezier(.65, 0, .35, 1);
    --na-ease-emphasized: cubic-bezier(.22, 1, .36, 1);
    --na-touch-target: 44px;
    --na-bottom-nav-safe-area: calc(84px + env(safe-area-inset-bottom));
}

.na-button,
.na-nav-link,
.na-card,
.na-notice,
.na-status-pill,
.na-user-button,
.na-flow-card,
.na-runtime-card,
.na-map-card {
    transition-duration: var(--na-motion-base);
    transition-timing-function: var(--na-ease-out);
}

.na-button {
    min-height: var(--na-touch-target);
    transform-origin: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.na-button:active {
    transform: scale(.97);
}

.na-button:disabled,
.na-button[disabled] {
    cursor: not-allowed;
    opacity: .52;
    transform: none;
    box-shadow: none;
}

.na-nav-link {
    min-height: var(--na-touch-target);
    transform-origin: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.na-nav-link:active {
    transform: scale(.98);
}

.na-card {
    transform-origin: center top;
}

@media (hover: hover) and (pointer: fine) {
    .na-card:hover {
        border-color: rgba(255, 255, 255, .16);
        transform: translateY(-2px);
    }

    .na-nav-link:hover,
    .na-button:hover {
        transition-duration: var(--na-motion-fast);
    }
}

.na-motion-enter {
    animation: na-motion-enter var(--na-motion-slow) var(--na-ease-emphasized) both;
}

.na-motion-rise {
    animation: na-motion-rise var(--na-motion-base) var(--na-ease-out) both;
}

@keyframes na-motion-enter {
    from {
        opacity: 0;
        transform: translateY(10px) scale(.985);
        filter: blur(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

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

.na-notice {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: start;
    width: min(100%, 560px);
    padding: 14px 14px 14px 16px;
    border: 1px solid var(--na-line-strong);
    border-radius: var(--na-radius-lg);
    background: rgba(12, 12, 18, .88);
    box-shadow: var(--na-shadow-soft);
    backdrop-filter: blur(16px);
    animation: na-motion-enter var(--na-motion-slow) var(--na-ease-emphasized) both;
}

.na-notice-title {
    display: block;
    margin: 0 0 4px;
    font-family: var(--na-font-display);
    font-size: .9rem;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.na-notice-body {
    color: var(--na-muted);
    line-height: 1.55;
}

.na-notice-close {
    display: inline-grid;
    place-items: center;
    width: var(--na-touch-target);
    height: var(--na-touch-target);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 999px;
    color: var(--na-white);
    background: rgba(255, 255, 255, .045);
    cursor: pointer;
    transition: transform var(--na-motion-fast) var(--na-ease-out), border-color var(--na-motion-fast) var(--na-ease-out), background var(--na-motion-fast) var(--na-ease-out);
    -webkit-tap-highlight-color: transparent;
}

.na-notice-close:active {
    transform: scale(.94);
}

.na-notice-info {
    border-color: rgba(0, 212, 255, .34);
}

.na-notice-success {
    border-color: rgba(57, 255, 136, .34);
}

.na-notice-warning {
    border-color: rgba(248, 193, 74, .38);
}

.na-notice-danger {
    border-color: rgba(255, 77, 109, .42);
}

.na-safe-bottom {
    padding-bottom: var(--na-bottom-nav-safe-area);
}

@media (max-width: 760px) {
    html {
        scroll-padding-bottom: var(--na-bottom-nav-safe-area);
    }

    .na-shell {
        padding-bottom: var(--na-bottom-nav-safe-area);
    }

    .na-content {
        padding-bottom: var(--na-bottom-nav-safe-area);
    }

    .na-page-header h2 {
        font-size: clamp(2.2rem, 14vw, 3.9rem);
    }

    .na-page-actions,
    .na-landing-actions {
        width: 100%;
    }

    .na-page-actions .na-button,
    .na-landing-actions .na-button {
        width: 100%;
    }

    .na-sidebar {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: calc(10px + env(safe-area-inset-bottom));
        z-index: 90;
        height: auto;
        max-height: 76px;
        padding: 8px;
        border: 1px solid rgba(255, 255, 255, .12);
        border-radius: 24px;
        background: rgba(7, 7, 12, .82);
        box-shadow: 0 22px 70px rgba(0, 0, 0, .52);
        backdrop-filter: blur(18px);
        overflow: hidden;
    }

    .na-brand,
    .na-sidebar-footer,
    .na-nav-divider {
        display: none;
    }

    .na-nav {
        display: flex;
        grid-template-columns: none;
        gap: 8px;
        width: 100%;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        padding: 0 2px;
    }

    .na-nav::-webkit-scrollbar {
        display: none;
    }

    .na-nav-link {
        flex: 0 0 auto;
        min-height: 56px;
        padding: 0 14px;
        border-radius: 18px;
        scroll-snap-align: center;
        white-space: nowrap;
    }

    .na-dev-link {
        display: none;
    }

    .na-notice {
        width: 100%;
        grid-template-columns: minmax(0, 1fr) auto;
        border-radius: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 1ms !important;
    }

    .na-button:active,
    .na-nav-link:active,
    .na-card:hover {
        transform: none !important;
    }
}

/* =========================================================
   EPIC 08A.6C - License-aware compact navigation
   ========================================================= */

.na-sidebar-compact {
    gap: 14px;
}

.na-nav-loading {
    color: var(--na-muted);
    font-size: .78rem;
    font-weight: 800;
    padding: 10px 12px;
}

.na-nav-grouped {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    overflow-y: auto;
    padding-right: 2px;
}

.na-nav-group {
    border: 1px solid rgba(255, 255, 255, .065);
    border-radius: 16px;
    background: rgba(255, 255, 255, .025);
    overflow: clip;
}

.na-nav-group summary {
    min-height: 38px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 8px 11px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.na-nav-group summary::-webkit-details-marker {
    display: none;
}

.na-nav-group summary::after {
    content: "⌄";
    color: var(--na-muted);
    font-size: .72rem;
    transform: rotate(-90deg);
    transition: transform var(--na-motion-fast) var(--na-ease-out);
}

.na-nav-group[open] summary::after {
    transform: rotate(0);
}

.na-nav-group summary span {
    color: var(--na-white);
    font-size: .72rem;
    font-weight: 950;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.na-nav-group summary small {
    grid-column: 1 / -1;
    margin-top: -4px;
    color: var(--na-muted);
    font-size: .66rem;
    font-weight: 700;
}

.na-nav-group-items {
    display: grid;
    gap: 4px;
    padding: 0 6px 7px;
}

.na-nav-copy {
    min-width: 0;
    display: grid;
    gap: 1px;
}

.na-nav-copy strong {
    overflow: hidden;
    color: inherit;
    font-size: .8rem;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.na-nav-copy small {
    overflow: hidden;
    color: var(--na-muted);
    font-size: .64rem;
    font-weight: 700;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.na-nav-icon {
    display: inline-grid;
    place-items: center;
    width: 18px !important;
}

.na-nav-link em {
    min-width: 22px;
    height: 22px;
    display: inline-grid;
    place-items: center;
    margin-left: auto;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 999px;
    color: var(--na-white);
    background: rgba(255, 255, 255, .045);
    font-size: .62rem;
    font-style: normal;
    font-weight: 900;
}

.na-nav-link-locked {
    opacity: .58;
    cursor: not-allowed;
    filter: grayscale(.2);
}

.na-nav-link-locked:hover {
    color: var(--na-muted);
    background: transparent;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .045);
}

.na-nav-link-locked .na-nav-icon {
    color: var(--na-muted);
}

@media (min-width: 761px) {
    .na-nav-grouped .na-nav-link {
        min-height: 38px;
        padding: 0 9px;
        border-radius: 11px;
        gap: 9px;
    }
}

@media (max-width: 760px) {
    .na-sidebar-compact {
        max-height: 76px;
    }

    .na-nav-grouped {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0 2px;
    }

    .na-nav-group {
        flex: 0 0 auto;
        border: 0;
        background: transparent;
        overflow: visible;
    }

    .na-nav-group summary {
        display: none;
    }

    .na-nav-group-items {
        display: flex;
        gap: 8px;
        padding: 0;
    }

    .na-nav-copy small,
    .na-nav-link em,
    .na-nav-link-locked {
        display: none;
    }

    .na-nav-copy strong {
        font-size: .78rem;
    }
}

/* EPIC 08A.8 - Permission-aware access feedback */
.na-access-card {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    padding: 16px 18px;
    background: rgba(255, 255, 255, 0.045);
    color: rgba(255, 255, 255, 0.82);
    min-height: 48px;
}

.na-access-card-denied {
    border-color: rgba(255, 45, 141, 0.36);
    background: rgba(255, 45, 141, 0.08);
}

/* =========================================================
   EPIC 08A.8B - Discord sign-in entry + access debug
   ========================================================= */

.na-auth-button,
.na-auth-logout {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 999px;
    color: var(--na-white);
    background: linear-gradient(135deg, rgba(0, 212, 255, .14), rgba(255, 45, 141, .16));
    font-size: .76rem;
    font-weight: 950;
    letter-spacing: .02em;
    text-decoration: none;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.na-auth-button:active,
.na-auth-logout:active {
    transform: scale(.97);
}

.na-auth-button-warning {
    border-color: rgba(248, 193, 74, .34);
    background: rgba(248, 193, 74, .10);
}

.na-auth-logout {
    min-height: 34px;
    padding: 0 12px;
    color: var(--na-muted);
    background: rgba(255, 255, 255, .035);
}

.na-user-chip {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 4px 10px 4px 4px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 999px;
    background: rgba(255, 255, 255, .045);
}

.na-user-avatar {
    width: 30px;
    height: 30px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    color: white;
    background: linear-gradient(135deg, var(--na-primary), var(--na-secondary));
    font-size: .72rem;
    font-weight: 950;
}

.na-user-meta {
    min-width: 0;
    display: grid;
    line-height: 1.05;
}

.na-user-meta strong {
    max-width: 140px;
    overflow: hidden;
    color: var(--na-white);
    font-size: .76rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.na-user-meta small {
    color: var(--na-muted);
    font-size: .64rem;
    font-weight: 800;
}

.na-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.na-settings-card {
    display: grid;
    gap: 12px;
}

.na-settings-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
}

.na-access-dl {
    display: grid;
    gap: 8px;
    margin: 0;
}

.na-access-dl div {
    display: grid;
    grid-template-columns: 128px minmax(0, 1fr);
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .065);
}

.na-access-dl dt {
    color: var(--na-muted);
    font-size: .7rem;
    font-weight: 900;
    text-transform: uppercase;
}

.na-access-dl dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--na-white);
    font-size: .86rem;
    font-weight: 800;
}

.na-permission-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.na-permission-cloud span {
    padding: 7px 10px;
    border: 1px solid rgba(0, 212, 255, .22);
    border-radius: 999px;
    color: var(--na-info);
    background: rgba(0, 212, 255, .065);
    font-size: .68rem;
    font-weight: 900;
}

.na-muted-copy {
    color: var(--na-muted);
}

.na-settings-checklist {
    display: grid;
    gap: 8px;
}

.na-settings-checklist div {
    padding: 10px 12px;
    border-radius: 14px;
    color: var(--na-muted);
    background: rgba(255, 255, 255, .045);
    font-weight: 850;
}

.na-settings-checklist .ok {
    color: var(--na-success);
    background: rgba(57, 255, 136, .08);
}

.na-settings-checklist .fail {
    color: var(--na-danger);
    background: rgba(255, 77, 109, .08);
}

@media (max-width: 760px) {
    .na-topbar-actions {
        width: 100%;
        align-items: stretch;
        flex-wrap: wrap;
    }

    .na-auth-button,
    .na-auth-logout,
    .na-user-chip,
    .na-status-pill {
        width: 100%;
    }

    .na-user-chip {
        justify-content: flex-start;
    }

    .na-settings-grid {
        grid-template-columns: 1fr;
    }

    .na-settings-actions .na-button {
        width: 100%;
    }

    .na-access-dl div {
        grid-template-columns: 1fr;
        gap: 3px;
    }
}

/* =========================================================
   EPIC 08A.8C - Sidebar readability fix
   ========================================================= */

.na-sidebar-compact .na-nav-link {
    width: 100%;
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) auto;
    align-items: center;
}

.na-sidebar-compact .na-nav-link .na-nav-icon {
    width: 20px !important;
    min-width: 20px;
}

.na-sidebar-compact .na-nav-link .na-nav-copy {
    width: auto !important;
    min-width: 0;
    max-width: 100%;
    display: grid;
    gap: 2px;
}

.na-sidebar-compact .na-nav-link .na-nav-copy strong,
.na-sidebar-compact .na-nav-link .na-nav-copy small {
    width: auto !important;
    min-width: 0;
    max-width: 100%;
    display: block;
}

.na-sidebar-compact .na-nav-link em {
    justify-self: end;
    margin-left: 4px;
}

.na-sidebar-compact .na-nav-link-locked em {
    min-width: 32px;
    height: 18px;
    padding: 0 6px;
    font-size: .55rem;
}

@media (min-width: 761px) {
    .na-sidebar-compact .na-nav-grouped .na-nav-link {
        min-height: 42px;
        padding: 5px 8px;
    }

    .na-sidebar-compact .na-nav-copy strong {
        font-size: .78rem;
        line-height: 1.05;
    }

    .na-sidebar-compact .na-nav-copy small {
        font-size: .61rem;
        line-height: 1.15;
    }
}

@media (max-width: 760px) {
    .na-sidebar-compact .na-nav-link {
        display: inline-flex;
        width: auto;
    }

    .na-sidebar-compact .na-nav-link .na-nav-copy {
        display: block;
    }
}

.na-access-bootstrap-card {
    border-color: rgba(255, 45, 141, .35);
    background:
        radial-gradient(circle at top left, rgba(255, 45, 141, .18), transparent 34%),
        radial-gradient(circle at bottom right, rgba(0, 212, 255, .14), transparent 38%),
        rgba(12, 12, 18, .88);
}

.na-inline-status {
    margin: 14px 0;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,.12);
    font-weight: 800;
    font-size: .86rem;
}

.na-inline-status.ok {
    color: #7CF7C8;
    background: rgba(124, 247, 200, .10);
    border-color: rgba(124, 247, 200, .30);
}

.na-inline-status.fail {
    color: #FF5C93;
    background: rgba(255, 92, 147, .10);
    border-color: rgba(255, 92, 147, .30);
}

/* EPIC 08A.9 - Route and action guard cards */
.na-route-guard-card {
    width: min(760px, calc(100vw - 32px));
    margin: clamp(32px, 8vw, 96px) auto;
    padding: clamp(22px, 4vw, 38px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 28px;
    background:
        radial-gradient(circle at 0% 0%, rgba(139, 92, 246, 0.22), transparent 34%),
        radial-gradient(circle at 100% 100%, rgba(0, 212, 255, 0.16), transparent 34%),
        rgba(13, 13, 18, 0.88);
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
}

.na-route-guard-card.denied {
    border-color: rgba(255, 45, 141, 0.34);
}

.na-route-guard-card > span {
    display: inline-flex;
    margin-bottom: 12px;
    color: #00d4ff;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.na-route-guard-card h1 {
    margin: 0 0 12px;
    color: #fff;
    font-size: clamp(2rem, 7vw, 4.4rem);
    line-height: 0.9;
    text-transform: uppercase;
}

.na-route-guard-card p {
    max-width: 58ch;
    margin: 0;
    color: rgba(255, 255, 255, 0.72);
    line-height: 1.55;
}

.na-route-guard-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.na-route-guard-tags strong {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    border: 1px solid rgba(0, 212, 255, 0.34);
    border-radius: 999px;
    background: rgba(0, 212, 255, 0.08);
    color: #fff;
    font-size: 0.76rem;
}

.na-route-guard-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.na-route-guard-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 999px;
    background: linear-gradient(135deg, #8b5cf6, #ff2d8d);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 900;
    text-decoration: none;
    text-transform: uppercase;
}

.na-route-guard-actions a.secondary {
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.05);
}

.na-access-card {
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.045);
    color: rgba(255, 255, 255, 0.78);
}

.na-access-card-denied {
    border-color: rgba(255, 45, 141, 0.32);
    background: rgba(255, 45, 141, 0.08);
}

@media (max-width: 720px) {
    .na-route-guard-card {
        width: calc(100vw - 24px);
        margin: 22px auto 96px;
        border-radius: 22px;
    }

    .na-route-guard-actions a {
        width: 100%;
    }
}
