/*
 * account.css — shared chrome for the registered-user account area
 * (hub.html, library.html, and the reskinned auth/account/admin pages).
 *
 * Layered ON TOP of the existing --rc-* token system from remote-control.css
 * (which derives every accent from --color-primary across the 4 themes, the
 * dark theme being the neon-green app identity). NO hard-coded brand hex here —
 * everything references --rc-* / --color-* custom properties so all themes get
 * a coherent personality automatically.
 *
 * Account-local tokens (kept scoped so they cannot leak into the control SPA).
 */

:root {
    --acc-topbar-height: 60px;
    --acc-maxw: 1080px;
    --acc-gap: 16px;
}

/* ---- Top bar ---------------------------------------------------------- */

.acc-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--acc-topbar-height);
    padding: 8px 16px;
    background: var(--rc-card-bg);
    border-bottom: 1px solid var(--rc-card-border);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.acc-topbar__brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    letter-spacing: 0.2px;
    color: var(--color-text);
    text-decoration: none;
    white-space: nowrap;
}

.acc-topbar__brand .acc-spark {
    color: var(--rc-accent);
}

.acc-topbar__back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    min-height: 44px;
    border-radius: var(--rc-radius-button, 14px);
    color: var(--color-text);
    text-decoration: none;
    border: 1px solid transparent;
    transition: border-color 0.12s ease, background 0.12s ease;
}

.acc-topbar__back:hover {
    border-color: var(--rc-card-border);
    background: var(--rc-accent-tint);
}

.acc-topbar__spacer {
    flex: 1 1 auto;
}

.acc-topbar__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.acc-iconbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 6px 10px;
    border-radius: var(--rc-radius-button, 14px);
    border: 1px solid var(--rc-card-border);
    background: transparent;
    color: var(--color-text);
    cursor: pointer;
    font: inherit;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.acc-iconbtn:hover {
    background: var(--rc-accent-tint);
    border-color: var(--rc-accent);
}

/* Account menu (proper menu, keyboard operable) */
.acc-menu {
    position: relative;
}

.acc-menu__toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 6px 12px;
    border-radius: var(--rc-radius-pill, 999px);
    border: 1px solid var(--rc-card-border);
    background: var(--rc-accent-tint);
    color: var(--color-text);
    cursor: pointer;
    font: inherit;
    font-weight: 600;
}

/* The account name is user data of up to 50 characters (USERNAME_MAX_LENGTH): it ends in an ellipsis instead of
   widening the bar past the screen, which would grow the layout viewport and push the fixed, centred notifier
   off-centre. The phone block below hides it altogether. */
.acc-menu__toggle > span:not(.acc-menu__avatar) {
    max-width: 18ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.acc-menu__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--rc-accent);
    color: var(--color-background);
    font-weight: 800;
    font-size: 0.85rem;
}

/* On a phone the bar's content (brand word, back link, three controls, the account
   name) is wider than the screen, which grows the layout viewport and pushes every
   fixed, centred element (the notifier) off-centre. The brand word and the account
   name drop out of sight but stay in the accessibility tree: the spark and the
   avatar remain as the visible mark of the same two controls. */
@media (max-width: 560px) {

    .acc-topbar {
        gap: 8px;
        padding: 8px 12px;
    }

    .acc-topbar__actions {
        gap: 6px;
    }

    .acc-topbar__brand > span:not(.acc-spark),
    .acc-menu__toggle > span:not(.acc-menu__avatar) {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
        border: 0;
    }
}

.acc-menu__list {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 220px;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: var(--color-surface);
    border: 1px solid var(--rc-card-border);
    border-radius: var(--rc-radius-card, 18px);
    box-shadow: var(--rc-shadow-card);
    display: none;
}

.acc-menu__list[data-open="true"] {
    display: block;
}

.acc-menu__item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    min-height: 44px;
    border: none;
    background: transparent;
    color: var(--color-text);
    text-decoration: none;
    border-radius: 10px;
    cursor: pointer;
    font: inherit;
}

.acc-menu__item:hover,
.acc-menu__item:focus-visible {
    background: var(--rc-accent-tint);
    outline: none;
}

.acc-menu__sep {
    height: 1px;
    margin: 6px 4px;
    background: var(--rc-divider);
}

/* ---- Page shell ------------------------------------------------------ */

.acc-page {
    max-width: var(--acc-maxw);
    margin: 0 auto;
    padding: 24px 16px 64px;
}

.acc-h1 {
    font-weight: 800;
    font-size: clamp(1.5rem, 4vw, 2.1rem);
    margin: 8px 0 4px;
    color: var(--color-text);
    /* The hub greets the account by name: a 50-character name without a break must wrap, not widen the page. */
    overflow-wrap: anywhere;
}

.acc-sub {
    color: var(--color-text-muted);
    margin-bottom: 24px;
}

/* ---- Hub launchpad cards --------------------------------------------- */

.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--acc-gap);
    margin-bottom: 28px;
}

.hub-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 22px;
    min-height: 168px;
    text-align: left;
    text-decoration: none;
    color: var(--color-text);
    background: var(--rc-card-bg);
    border: 1px solid var(--rc-card-border);
    border-radius: var(--rc-radius-card, 18px);
    box-shadow: var(--rc-shadow-card);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.18s var(--rc-easing, ease),
        box-shadow 0.18s var(--rc-easing, ease),
        border-color 0.18s var(--rc-easing, ease);
}

.hub-card[aria-disabled="true"] {
    cursor: default;
    opacity: 0.7;
}

.hub-card__icon {
    font-size: 1.6rem;
    color: var(--rc-accent);
}

.hub-card__title {
    font-weight: 800;
    font-size: 1.05rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.hub-card__meta {
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

.hub-card__cta {
    margin-top: auto;
    color: var(--rc-accent);
    font-weight: 700;
}

.hub-card__badge {
    align-self: flex-start;
    margin-top: auto;
    padding: 2px 10px;
    border-radius: var(--rc-radius-pill, 999px);
    background: var(--rc-accent-tint-strong);
    color: var(--color-text-muted);
    font-size: 0.8rem;
}

@media (prefers-reduced-motion: no-preference) {
    .hub-card:not([aria-disabled="true"]):hover {
        transform: translateY(-3px);
        box-shadow: var(--rc-shadow-card-hover);
        border-color: var(--rc-accent);
    }

    .hub-card.is-igniting {
        animation: acc-ignite 0.28s var(--rc-easing-spring, ease) both;
    }
}

@keyframes acc-ignite {
    0% {
        box-shadow: var(--rc-shadow-card);
        transform: scale(1);
    }
    60% {
        box-shadow: 0 0 0 3px var(--rc-accent-glow), var(--rc-shadow-card-hover);
        transform: scale(1.03);
    }
    100% {
        box-shadow: var(--rc-shadow-card);
        transform: scale(1);
    }
}

/* ---- Toolbar + bulk bar --------------------------------------------- */

.lib-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.lib-toolbar__search {
    flex: 1 1 200px;
    min-width: 160px;
}

.lib-bulkbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 12px;
    border-radius: var(--rc-radius-button, 14px);
    background: var(--rc-accent-tint);
    border: 1px solid var(--rc-card-border);
}

.lib-bulkbar[hidden] {
    display: none;
}

/* ---- Generic controls ----------------------------------------------- */

.acc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 16px;
    border-radius: var(--rc-radius-button, 14px);
    border: 1px solid var(--rc-card-border);
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}

.acc-btn:hover {
    border-color: var(--rc-accent);
    background: var(--rc-accent-tint);
}

.acc-btn:active {
    transform: translateY(1px);
}

.acc-btn--primary {
    background: var(--rc-accent);
    border-color: var(--rc-accent);
    color: var(--color-background);
}

.acc-btn--primary:hover {
    background: var(--rc-accent-strong, var(--rc-accent));
    box-shadow: 0 0 0 3px var(--rc-accent-glow);
}

.acc-btn--danger {
    color: var(--rc-danger);
    border-color: var(--rc-danger-soft);
}

.acc-btn--danger:hover {
    background: var(--rc-danger-soft);
    border-color: var(--rc-danger);
}

.acc-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.acc-input,
.acc-select {
    min-height: 44px;
    padding: 8px 12px;
    border-radius: var(--rc-radius-button, 12px);
    border: 1px solid var(--rc-card-border);
    background: var(--color-background);
    color: var(--color-text);
    font: inherit;
    width: 100%;
}

.acc-input:focus,
.acc-select:focus {
    outline: 2px solid var(--rc-accent);
    outline-offset: 1px;
}

.acc-field {
    margin-bottom: 12px;
}

.acc-field label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    color: var(--color-text);
}

.acc-field textarea.acc-input {
    min-height: 96px;
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---- Team list ------------------------------------------------------- */

.lib-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lib-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--rc-card-bg);
    border: 1px solid var(--rc-card-border);
    border-radius: var(--rc-radius-button, 14px);
    box-shadow: var(--rc-shadow-card);
}

.lib-row__check {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.lib-row__main {
    flex: 1 1 auto;
    min-width: 0;
}

.lib-row__name {
    font-weight: 700;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lib-row__meta {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.lib-row__actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ---- Empty / loading / skeleton ------------------------------------- */

.acc-empty {
    text-align: center;
    padding: 48px 16px;
    color: var(--color-text-muted);
}

.acc-empty__icon {
    font-size: 2.4rem;
    color: var(--rc-accent);
    margin-bottom: 8px;
}

.acc-empty__actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 16px;
}

.acc-skeleton {
    height: 60px;
    border-radius: var(--rc-radius-button, 14px);
    background: linear-gradient(90deg,
            var(--rc-accent-tint) 25%,
            var(--rc-accent-soft) 37%,
            var(--rc-accent-tint) 63%);
    background-size: 400% 100%;
}

@media (prefers-reduced-motion: no-preference) {
    .acc-skeleton {
        animation: acc-shimmer 1.3s ease infinite;
    }
}

@keyframes acc-shimmer {
    0% {
        background-position: 100% 0;
    }
    100% {
        background-position: 0 0;
    }
}

/* ---- Modal / sheet --------------------------------------------------- */

.acc-modal {
    position: fixed;
    inset: 0;
    z-index: 1060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(2, 8, 23, 0.6);
}

.acc-modal[hidden] {
    display: none;
}

.acc-modal__card {
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 22px;
    background: var(--color-surface);
    border: 1px solid var(--rc-card-border);
    border-radius: var(--rc-radius-card, 18px);
    box-shadow: var(--rc-shadow-card-hover);
}

.acc-modal__card--wide {
    max-width: 820px;
}

.acc-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.acc-modal__title {
    font-weight: 800;
    font-size: 1.2rem;
    margin: 0;
}

.acc-modal__foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* ---- Import conflict table ------------------------------------------ */

.imp-dropzone {
    border: 2px dashed var(--rc-card-border);
    border-radius: var(--rc-radius-card, 18px);
    padding: 28px;
    text-align: center;
    color: var(--color-text-muted);
    background: var(--rc-accent-tint);
}

.imp-dropzone.is-drag {
    border-color: var(--rc-accent);
    background: var(--rc-accent-soft);
}

.imp-table {
    width: 100%;
    border-collapse: collapse;
}

.imp-table th,
.imp-table td {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid var(--rc-divider);
    vertical-align: middle;
}

.imp-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: var(--rc-radius-pill, 999px);
    font-size: 0.85rem;
    font-weight: 600;
}

.imp-status--new {
    background: var(--rc-success-soft);
    color: var(--rc-success);
}

.imp-status--changed,
.imp-status--duplicate {
    background: var(--rc-accent-tint-strong);
    color: var(--color-text);
}

.imp-status--invalid {
    background: var(--rc-danger-soft);
    color: var(--rc-danger);
}

.imp-bulk {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 12px 0;
}

.imp-result-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--rc-divider);
}

@media (prefers-reduced-motion: no-preference) {
    .imp-result-row {
        animation: acc-checkin 0.3s var(--rc-easing, ease) both;
    }
}

@keyframes acc-checkin {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Inline error banner -------------------------------------------- */

.acc-banner {
    padding: 10px 14px;
    border-radius: var(--rc-radius-button, 12px);
    margin-bottom: 12px;
    background: var(--rc-danger-soft);
    border: 1px solid var(--rc-danger);
    color: var(--color-text);
}

.acc-banner[hidden] {
    display: none;
}

/* Stacked card list for the conflict table on small screens */
@media (max-width: 768px) {

    .imp-table thead {
        display: none;
    }

    .imp-table,
    .imp-table tbody,
    .imp-table tr,
    .imp-table td {
        display: block;
        width: 100%;
    }

    .imp-table tr {
        margin-bottom: 12px;
        border: 1px solid var(--rc-card-border);
        border-radius: var(--rc-radius-button, 14px);
        padding: 8px 10px;
    }

    .imp-table td {
        border-bottom: none;
        padding: 4px 0;
    }
}

/* ============================================================
   Account ↔ Control, Phase 2 — "Meine Stadien" list + cards, and the
   shared sheet form used by the add-link / unlock sheets. All tokenised
   on --rc-* so every theme inherits a coherent personality.
   ============================================================ */
.stadium-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 14px;
}
.stadium-card {
    background: var(--rc-card-bg);
    border: 1px solid var(--rc-card-border);
    border-radius: var(--rc-radius-card, 18px);
    box-shadow: var(--rc-shadow-card);
    padding: 16px 18px;
    display: grid;
    gap: 10px;
    transition: transform 0.18s var(--rc-easing, ease),
        box-shadow 0.18s var(--rc-easing, ease),
        border-color 0.18s var(--rc-easing, ease);
}
.stadium-card:hover {
    box-shadow: var(--rc-shadow-card-hover);
    border-color: var(--rc-accent);
}
.stadium-card__head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
}
.stadium-card__name {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--color-text);
}
.stadium-card__sub {
    color: color-mix(in srgb, var(--color-text) 60%, transparent);
    font-size: 0.85rem;
}
.stadium-card__badge {
    margin-left: auto;
    font-size: 0.78rem;
    padding: 3px 9px;
    border-radius: var(--rc-radius-pill, 999px);
    background: var(--rc-accent-tint-strong);
    color: var(--rc-accent);
    border: 1px solid var(--rc-card-border);
}
.stadium-card__meta {
    font-size: 0.84rem;
    color: color-mix(in srgb, var(--color-text) 55%, transparent);
}
.stadium-card__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Sheet form (add-link + unlock) */
.acc-form {
    display: grid;
    gap: 14px;
}
/* A sheet holds the credential form, a vault-passphrase form of its own and the
   error line after them: keep the same rhythm between them as inside a form. */
.acc-form + .acc-form,
.acc-form + .acc-form__hint {
    margin-top: 14px;
}
.acc-form__row {
    display: grid;
    gap: 6px;
}
.acc-form__label {
    font-size: 0.85rem;
    font-weight: 600;
    color: color-mix(in srgb, var(--color-text) 80%, transparent);
}
.acc-form__intro,
.acc-form__note {
    margin: 0;
    font-size: 0.88rem;
    color: color-mix(in srgb, var(--color-text) 70%, transparent);
}
.acc-form__note {
    font-size: 0.8rem;
    font-style: italic;
}
.acc-form__hint {
    margin: 0;
    color: var(--rc-danger);
    font-size: 0.85rem;
}
.acc-banner--error {
    border-color: var(--rc-danger);
    color: var(--rc-danger);
}
.acc-banner--success {
    border-color: var(--rc-accent);
    color: var(--rc-accent);
}
.acc-empty__hint {
    font-size: 0.88rem;
    color: color-mix(in srgb, var(--color-text) 60%, transparent);
}
