/*
 * JouteTrack — theme-shell-sidebar.css
 * App shell, sidebar, topbar mobile, pages publiques (header compact).
 */

:root {
    --jt-shell-sidebar-width: 15.5rem;
    --jt-shell-inline: 1.25rem;
    --jt-shell-col-gap: 1.25rem;
}

.jt-body--shell {
    margin: 0;
    min-height: 100vh;
}

.jt-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.jt-sidebar-toggle {
    position: fixed;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.jt-app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #0a0a0a;
}

.jt-shell-topbar-mobile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem var(--jt-shell-inline);
    background: var(--bg-darker);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 180;
}

.jt-shell-topbar-mobile-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1;
}

.jt-sidebar-burger {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    margin: 0;
    padding: 0;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.jt-sidebar-burger:hover {
    background: #252d3f;
}

.jt-sidebar-burger:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.jt-shell-grid {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    min-width: 0;
    min-height: 0;
    gap: var(--jt-shell-col-gap);
}

.jt-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 160;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    cursor: pointer;
}

.jt-shell-main {
    flex: 1;
    min-width: 0;
    padding: var(--jt-shell-inline);
    padding-bottom: 2rem;
}

.jt-shell-main .container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
    background: transparent;
}

/* Sidebar colonne */
.jt-shell-sidebar {
    flex: 0 0 var(--jt-shell-sidebar-width);
    width: var(--jt-shell-sidebar-width);
    max-width: var(--jt-shell-sidebar-width);
    box-sizing: border-box;
}

.jt-sidebar-inner {
    padding: 0.65rem 0.75rem 1rem;
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(18, 22, 32, 0.96) 0%, rgba(14, 18, 28, 0.94) 100%);
    border: 1px solid rgba(100, 116, 140, 0.28);
    height: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.jt-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.15rem 0.1rem 0.35rem;
    text-decoration: none;
    color: inherit;
    border-radius: 8px;
}

.jt-sidebar-brand:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.jt-sidebar-brand-mark {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 9px;
    background: linear-gradient(145deg, color-mix(in srgb, var(--primary-color) 35%, #0a0e13), #1a1f2e);
    border: 1px solid color-mix(in srgb, var(--primary-color) 45%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--primary-color);
    flex-shrink: 0;
}

.jt-sidebar-brand-text {
    min-width: 0;
    line-height: 1.2;
}

.jt-sidebar-brand-title {
    display: block;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.jt-sidebar-brand-sub {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(180, 196, 214, 0.72);
    margin-top: 0.12rem;
}

.jt-sidebar-club-card {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.6rem;
    border-radius: 10px;
    background: color-mix(in srgb, var(--bg-darker) 88%, var(--primary-color) 6%);
    border: 1px solid color-mix(in srgb, var(--border-color) 85%, var(--primary-color) 15%);
    text-decoration: none;
    color: inherit;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.jt-sidebar-club-card:hover {
    background: color-mix(in srgb, var(--bg-card) 70%, var(--primary-color) 8%);
    border-color: color-mix(in srgb, var(--primary-color) 35%, var(--border-color));
}

.jt-sidebar-club-card:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.jt-sidebar-club-card--active {
    border-color: color-mix(in srgb, var(--primary-color) 45%, transparent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary-color) 20%, transparent) inset;
}

.jt-sidebar-club-logo {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

.jt-sidebar-club-logo--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.jt-sidebar-club-logo--placeholder svg {
    display: block;
    flex-shrink: 0;
}

.jt-sidebar-club-meta {
    flex: 1;
    min-width: 0;
}

.jt-sidebar-club-nom {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.jt-sidebar-club-role {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 0.05rem;
}

.jt-sidebar-club-edit {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
}

.jt-sidebar-club-edit svg {
    display: block;
    flex-shrink: 0;
}

.jt-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem;
}

.jt-sidebar-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.jt-sidebar-group-label {
    margin: 0;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: rgba(180, 196, 214, 0.72);
}

.jt-sidebar-badge {
    flex-shrink: 0;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    margin-left: auto;
}

.jt-sidebar-badge--warn {
    background: #eab308;
    box-shadow: 0 0 0 2px color-mix(in srgb, #eab308 35%, transparent);
}

.jt-sidebar-item--with-status-pill {
    align-items: center;
}

.jt-status-pill {
    flex-shrink: 0;
    min-width: 1.25rem;
    height: 1.25rem;
    margin-left: auto;
    padding: 0 0.35rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1.25rem;
    text-align: center;
    color: #0f172a;
    background: #94a3b8;
}

.jt-status-pill[data-jt-status-level='warning'] {
    background: #eab308;
    color: #1c1917;
}

.jt-status-pill[data-jt-status-level='blocking'] {
    background: #ef4444;
    color: #fff;
}

.jt-status-pill[data-jt-status-level='info'] {
    background: #38bdf8;
    color: #0c4a6e;
}

.jt-status-banner-region {
    margin-bottom: 0.75rem;
}

.jt-status-banner-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.jt-status-banner-item {
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    border: 1px solid transparent;
}

.jt-status-banner--warning {
    background: color-mix(in srgb, #eab308 18%, transparent);
    border-color: color-mix(in srgb, #eab308 45%, transparent);
}

.jt-status-banner--blocking {
    background: color-mix(in srgb, #ef4444 14%, transparent);
    border-color: color-mix(in srgb, #ef4444 40%, transparent);
}

.jt-status-banner--info {
    background: color-mix(in srgb, #38bdf8 16%, transparent);
    border-color: color-mix(in srgb, #38bdf8 40%, transparent);
}

.jt-status-banner-msg {
    margin: 0 0 0.35rem;
    font-weight: 600;
}

.jt-status-banner-action {
    margin: 0;
    font-size: 0.92rem;
}

.jt-sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    margin: 0;
    padding: 0.45rem 0.55rem;
    text-align: left;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    box-sizing: border-box;
    transition: color 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.jt-sidebar-item-icon {
    flex-shrink: 0;
    display: block;
    opacity: 0.92;
    box-sizing: content-box;
}

.jt-sidebar-item-label {
    flex: 1;
    min-width: 0;
}

.jt-sidebar-item:hover:not(:disabled):not(.jt-sidebar-item--disabled) {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.06);
}

.jt-sidebar-item:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.jt-sidebar-item--active {
    color: var(--primary-color);
    background: rgba(0, 184, 212, 0.08);
    border-color: rgba(0, 184, 212, 0.28);
}

.jt-sidebar-item--disabled,
.jt-sidebar-item:disabled {
    opacity: 0.38;
    cursor: not-allowed;
    pointer-events: none;
    color: rgba(180, 196, 214, 0.45);
}

.jt-sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: auto;
    padding-top: 0.65rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

a.jt-sidebar-item.jt-sidebar-footer-link {
    text-decoration: none;
}

a.jt-sidebar-item.jt-sidebar-footer-link--logout {
    color: rgba(231, 97, 90, 0.95);
    justify-content: center;
}

a.jt-sidebar-item.jt-sidebar-footer-link--logout:hover {
    color: #ffb4ae;
    background: rgba(231, 97, 90, 0.1);
    border-color: rgba(231, 97, 90, 0.28);
}

/* Mobile : sidebar hors écran + burger */
@media (max-width: 959px) {
    .jt-shell-topbar-mobile {
        display: flex;
    }

    .jt-shell-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 200;
        max-width: min(calc(100vw - 2.5rem), var(--jt-shell-sidebar-width) + 1rem);
        width: min(calc(100vw - 2.5rem), var(--jt-shell-sidebar-width) + 1rem);
        transform: translateX(-105%);
        transition: transform 0.22s ease;
        padding: var(--jt-shell-inline) var(--jt-shell-inline) var(--jt-shell-inline) var(--jt-shell-inline);
        background: transparent;
        pointer-events: none;
    }

    .jt-sidebar-inner {
        min-height: calc(100vh - 2 * var(--jt-shell-inline));
        max-height: calc(100vh - 2 * var(--jt-shell-inline));
        overflow: hidden;
    }

    .jt-sidebar-toggle:checked ~ .jt-app-shell .jt-shell-sidebar {
        transform: translateX(0);
        pointer-events: auto;
    }

    .jt-sidebar-toggle:checked ~ .jt-sidebar-backdrop {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    .jt-shell-main {
        width: 100%;
    }
}

@media (min-width: 960px) {
    .jt-shell-topbar-mobile {
        display: none;
    }

    .jt-sidebar-backdrop {
        display: none !important;
    }

    .jt-shell-sidebar {
        position: sticky;
        top: 0;
        align-self: stretch;
        min-height: 100vh;
        padding: var(--jt-shell-inline) 0 var(--jt-shell-inline) var(--jt-shell-inline);
    }

    .jt-sidebar-inner {
        position: sticky;
        top: var(--jt-shell-inline);
        max-height: calc(100vh - 2 * var(--jt-shell-inline));
        min-height: calc(100vh - 2 * var(--jt-shell-inline));
        overflow: hidden;
    }
}

/* Pages publiques : barre compacte */
.jt-header--public {
    background: var(--bg-darker);
    border-bottom: 2px solid var(--border-color);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.jt-header--public .jt-header-brand {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
}

.jt-header--public-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
}
