/*
  ----------------------------------------
  Admin (superadmin shared layout)
  ----------------------------------------
*/

@layer styles {
    .admin {
        /* Day-of tournament operation tabs */
        .nav-tabs {
            display: flex;
            gap: var(--space-2xs);
            border-bottom: var(--border) solid var(--light);
            margin-bottom: var(--space-md);

            .nav-tab-link {
                padding: var(--space-xs) var(--space-sm);
                color: var(--midtone);
                border-bottom: 2px solid transparent;
                margin-bottom: -1px;
                font-weight: 500;
                text-decoration: none;
                transition: color 200ms ease;

                &:hover {
                    color: var(--foreground);
                }

                &.active {
                    color: var(--foreground);
                    border-bottom-color: var(--brand-1);
                }
            }
        }
    }
}

/* ----------------------------------------
   Sidebar Navigation
   ---------------------------------------- */

@layer styles {
    .app-header__sidebar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2.5rem;
        height: 2.5rem;
        padding: 0;
        border: 0;
        border-radius: var(--rounded-md);
        background: var(--white);
        color: var(--foreground);
        transition: background 150ms ease, color 150ms ease;
        outline: none;
        box-shadow: none;

        &:hover {
            background: var(--lighter);
            color: var(--brand-1);
        }

        &:focus,
        &:focus-visible,
        &:active {
            background: var(--white) !important;
            color: var(--foreground) !important;
            border-color: transparent !important;
            outline: none !important;
            box-shadow: none !important;
            -webkit-tap-highlight-color: transparent;
        }
    }

    .app-header__sidebar-toggle--mobile {
        display: none;
    }

    .app-header__sidebar-toggle-icon {
        display: none;
        line-height: 0;
    }

    body.admin:not(.admin--sidebar-mobile-open) .app-header__sidebar-toggle--mobile .app-header__sidebar-toggle-icon--menu,
    body.admin.admin--sidebar-mobile-open .app-header__sidebar-toggle--mobile .app-header__sidebar-toggle-icon--close {
        display: inline-flex;
    }

    .sidebar {
        width: 16rem;
        min-width: 16rem;
        flex-shrink: 0;
        background: var(--brand-1-900);
        border-right: var(--border) solid rgba(255, 255, 255, 0.08);
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    /* Scrollable nav area */
    .sidebar__nav-wrapper {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        padding: var(--space-sm) var(--space-sm) 0;
        display: flex;
        flex-direction: column;
        gap: var(--space-md);
    }

    /* Group of related nav items (with optional section label) */
    .sidebar__nav-group {
        display: flex;
        flex-direction: column;
        gap: var(--space-3xs);
    }

    /* Reset list styles for nav item lists */
    .sidebar__nav-list {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: var(--space-3xs);
    }

    /* Section label above a nav group */
    .sidebar__section-label {
        display: block;
        font-size: var(--text-sm);
        font-weight: 600;
        line-height: 1.5;
        color: var(--brand-3-light);
        padding: 0 var(--space-xs) var(--space-3xs);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Individual nav link */
    .sidebar__nav-item {
        display: flex;
        align-items: center;
        padding: 0 var(--space-sm);
        gap: var(--space-2xs);
        height: 3.375rem;
        width: 100%;
        min-width: 0;
        border-radius: var(--rounded-lg);
        text-decoration: none;
        color: var(--brand-3-light);
        font-size: 0.9375rem;
        font-weight: 500;
        line-height: 1.5;
        white-space: nowrap;
        transition: background 150ms ease, color 150ms ease;

        svg {
            width: 1.5rem;
            height: 1.5rem;
            flex-shrink: 0;
        }

        &:hover {
            background: var(--brand-1);
            color: var(--white);
        }

        &.active {
            background: var(--brand-1);
            color: var(--white);
        }
    }

    /* Stretches to fill remaining horizontal space */
    .sidebar__nav-label {
        flex: 1;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Count/notification badge beside a nav label */
    .sidebar__nav-badge {
        display: inline-flex;
        align-items: center;
        padding: var(--space-3xs) var(--space-2xs);
        background: var(--brand-3);
        border-radius: var(--rounded-full);
        font-size: var(--text-sm);
        font-weight: 500;
        color: var(--white);
        line-height: 1;
        flex-shrink: 0;
    }

    /* Pinned footer at bottom of sidebar */
    .sidebar__footer {
        padding: var(--space-sm);
        flex-shrink: 0;
    }

    @media (max-width: 56rem) { /* --bp-lg */
        .app-header__sidebar-toggle--mobile {
            display: inline-flex;
        }

        body.admin.admin--sidebar-mobile-open {
            overflow: hidden;
        }

        .sidebar {
            position: fixed;
            top: var(--height-lg);
            right: 0;
            bottom: 0;
            left: 0;
            z-index: 95;
            width: 100%;
            min-width: 0;
            border-right: 0;
            transform: translateX(-100%);
            visibility: hidden;
            pointer-events: none;
            transition:
                transform 150ms ease,
                visibility 0s 150ms;
        }

        body.admin.admin--sidebar-mobile-open .sidebar {
            transform: translateX(0);
            visibility: visible;
            pointer-events: auto;
            transition:
                transform 150ms ease,
                visibility 0s 0s;
        }
    }
}
