/* ==========================================================================
   Button Styles
   ========================================================================== */

/* Primary buttons and the active nav pill: the theme hardcodes #333 (with
   #292929/#2b2b2b for hover/active) instead of reading --bs-primary, so they
   stayed grey when the dark surfaces went petrol (#700). */
.btn-primary {
    --bs-btn-color: var(--app-on-primary);
    --bs-btn-hover-color: var(--app-on-primary);
    --bs-btn-active-color: var(--app-on-primary);
    --bs-btn-disabled-color: var(--app-on-primary);
    --bs-btn-bg: var(--app-primary-bg);
    --bs-btn-border-color: var(--app-primary-bg);
    --bs-btn-hover-bg: var(--app-primary-bg-hover);
    --bs-btn-hover-border-color: var(--app-primary-bg-hover);
    --bs-btn-focus-shadow-rgb: var(--app-ink-rgb);
    --bs-btn-active-bg: var(--app-primary-bg-hover);
    --bs-btn-active-border-color: var(--app-primary-bg-hover);
    --bs-btn-disabled-bg: var(--app-primary-bg);
    --bs-btn-disabled-border-color: var(--app-primary-bg);
}

.btn-outline-primary {
    --bs-btn-color: var(--app-ink);
    --bs-btn-hover-color: var(--app-on-primary);
    --bs-btn-active-color: var(--app-on-primary);
    --bs-btn-border-color: var(--app-ink);
    --bs-btn-hover-bg: var(--app-primary-bg);
    --bs-btn-hover-border-color: var(--app-ink);
    --bs-btn-focus-shadow-rgb: var(--app-ink-rgb);
    --bs-btn-active-bg: var(--app-primary-bg);
    --bs-btn-active-border-color: var(--app-ink);
    --bs-btn-disabled-color: var(--app-ink);
    --bs-btn-disabled-border-color: var(--app-ink);
}

/* Success buttons: Bootswatch backt Bootstrap 4s Gruen hinein, statt
   --bs-success zu lesen. Die Zustaende kamen bis #706 obendrein aus dem
   *alten* Gruen (#19c176) — der Knopf wechselte unter dem Zeiger den
   Farbton. Jetzt sind sie Mischungen der Rolle: 85/80 beim Hover,
   80/75 beim Druecken, wie bei jeder anderen Rolle auch. */
.btn-success {
    --bs-btn-bg: var(--bs-success);
    --bs-btn-border-color: var(--bs-success);
    --bs-btn-hover-bg: color-mix(in srgb, var(--bs-success) 85%, rgb(var(--app-black-rgb)));
    --bs-btn-hover-border-color: color-mix(in srgb, var(--bs-success) 80%, rgb(var(--app-black-rgb)));
    --bs-btn-focus-shadow-rgb: var(--bs-success-rgb);
    --bs-btn-active-bg: color-mix(in srgb, var(--bs-success) 80%, rgb(var(--app-black-rgb)));
    --bs-btn-active-border-color: color-mix(in srgb, var(--bs-success) 75%, rgb(var(--app-black-rgb)));
    --bs-btn-disabled-bg: var(--bs-success);
    --bs-btn-disabled-border-color: var(--bs-success);
}

.btn-outline-success {
    --bs-btn-color: var(--bs-success);
    --bs-btn-border-color: var(--bs-success);
    --bs-btn-hover-bg: var(--bs-success);
    --bs-btn-hover-border-color: var(--bs-success);
    --bs-btn-focus-shadow-rgb: var(--bs-success-rgb);
    --bs-btn-active-bg: var(--bs-success);
    --bs-btn-active-border-color: var(--bs-success);
    --bs-btn-disabled-color: var(--bs-success);
    --bs-btn-disabled-border-color: var(--bs-success);
}

.nav-pills {
    --bs-nav-pills-link-active-bg: var(--app-primary-bg);
    --bs-nav-pills-link-active-color: var(--app-on-primary);
}

/* Gesperrt: derselbe Button, auf halber Kraft. Die Variante bleibt erkennbar,
   so sieht man weiterhin, *welche* Handlung gerade nicht geht. Gilt in allen
   Modi — vorher stand das unter [data-bs-theme=dark], also hinter einem
   Nachfahren-Selektor, der in verschachtelten Modi danebengreift (#706). */
.btn {
    --bs-btn-disabled-opacity: 0.5;
}

/* Dark mode: --app-ink is the muted ink here, so the outline takes the full
   light ink instead — as strong as the border of a form field, the way the
   dark ink draws it in the light mode. */
[data-bs-theme=dark] .btn-outline-primary {
    --bs-btn-color: var(--bs-body-color);
    --bs-btn-disabled-color: var(--bs-body-color);
    --bs-btn-border-color: var(--bs-body-color);
    --bs-btn-hover-border-color: var(--bs-body-color);
    --bs-btn-active-border-color: var(--bs-body-color);
    --bs-btn-disabled-border-color: var(--bs-body-color);
}

/* Der neutrale Button: abbrechen, zurueck, blaettern — und nach dem Wegfall
   der Outline-Varianten die haeufigste Schaltflaeche der App. Eine ruhige
   graue Flaeche mit sehr dunkler Schrift; der Hover rueckt nur einen Ton
   nach, statt die Farbe zu wechseln.

   Bewusst ohne [data-bs-theme=dark] davor: das waere ein Nachfahren-Selektor
   und wuerde auch in einem hellen Teilbaum unter einer dunklen Seite greifen —
   genau so stand hier helle Schrift auf hellem Grau. Custom Properties enden
   am naechsten Modus, Selektoren nicht (#706). */
.btn-secondary {
    --bs-btn-color: var(--app-btn-neutral-ink);
    --bs-btn-bg: var(--app-btn-neutral-bg);
    --bs-btn-border-color: var(--app-btn-neutral-bg);
    --bs-btn-hover-color: var(--app-btn-neutral-ink);
    --bs-btn-hover-bg: var(--app-btn-neutral-bg-hover);
    --bs-btn-hover-border-color: var(--app-btn-neutral-bg-hover);
    --bs-btn-focus-shadow-rgb: var(--app-ink-rgb);
    --bs-btn-active-color: var(--app-btn-neutral-ink);
    --bs-btn-active-bg: var(--app-btn-neutral-bg-hover);
    --bs-btn-active-border-color: var(--app-btn-neutral-bg-hover);
    --bs-btn-disabled-color: var(--app-btn-neutral-ink);
    --bs-btn-disabled-bg: var(--app-btn-neutral-bg);
    --bs-btn-disabled-border-color: var(--app-btn-neutral-bg);
}

/* Bootswatch compiles the warning button with white text, which on the amber
   is a contrast of 2.4 — the same mistake as `.text-bg-*` one component over.
   It also bakes its own #ffc107 in rather than reading the variable, so the
   role's colour would not reach it either (#706). */
.btn-warning {
    --bs-btn-color: var(--app-ink-on-fill);
    --bs-btn-bg: var(--bs-warning);
    --bs-btn-border-color: var(--bs-warning);
    --bs-btn-hover-color: var(--app-ink-on-fill);
    --bs-btn-hover-bg: color-mix(in srgb, var(--bs-warning) 85%, rgb(var(--app-black-rgb)));
    --bs-btn-hover-border-color: color-mix(in srgb, var(--bs-warning) 80%, rgb(var(--app-black-rgb)));
    --bs-btn-focus-shadow-rgb: var(--bs-warning-rgb);
    --bs-btn-active-color: var(--app-ink-on-fill);
    --bs-btn-active-bg: color-mix(in srgb, var(--bs-warning) 80%, rgb(var(--app-black-rgb)));
    --bs-btn-active-border-color: color-mix(in srgb, var(--bs-warning) 75%, rgb(var(--app-black-rgb)));
    --bs-btn-disabled-color: var(--app-ink-on-fill);
    --bs-btn-disabled-bg: var(--bs-warning);
    --bs-btn-disabled-border-color: var(--bs-warning);
}

/* Bootstrap bakes #17a2b8 into the info buttons instead of reading --bs-info.
   Since #706 the accent is one value for both modes, so this override is no
   longer scoped to dark — without it the light-mode call to action kept the
   theme's dull teal while everything else moved. */
.btn-info {
    --bs-btn-bg: var(--bs-info);
    --bs-btn-border-color: var(--bs-info);
    --bs-btn-hover-bg: var(--app-accent-hover);
    --bs-btn-hover-border-color: var(--app-accent-hover);
    --bs-btn-focus-shadow-rgb: var(--bs-info-rgb);
    --bs-btn-active-bg: var(--app-accent-hover);
    --bs-btn-active-border-color: var(--app-accent-hover);
    --bs-btn-disabled-bg: var(--bs-info);
    --bs-btn-disabled-border-color: var(--bs-info);
}

.btn-outline-info {
    --bs-btn-color: var(--bs-info);
    --bs-btn-border-color: var(--bs-info);
    --bs-btn-hover-bg: var(--bs-info);
    --bs-btn-hover-border-color: var(--bs-info);
    --bs-btn-focus-shadow-rgb: var(--bs-info-rgb);
    --bs-btn-active-bg: var(--bs-info);
    --bs-btn-active-border-color: var(--bs-info);
    --bs-btn-disabled-color: var(--bs-info);
    --bs-btn-disabled-border-color: var(--bs-info);
}

/* Dark mode: Sketchy's secondary and dark buttons are #555 grey, which all but
   vanishes on the dark petrol surface. */
[data-bs-theme=dark] .btn-outline-secondary,
[data-bs-theme=dark] .btn-outline-dark {
    --bs-btn-color: var(--app-btn-quiet-ink);
    --bs-btn-border-color: var(--app-btn-quiet-ink);
    --bs-btn-hover-color: var(--app-ground);
    --bs-btn-hover-bg: var(--app-btn-quiet-ink);
    --bs-btn-hover-border-color: var(--app-btn-quiet-ink);
    --bs-btn-focus-shadow-rgb: var(--app-btn-quiet-ink-rgb);
    --bs-btn-active-color: var(--app-ground);
    --bs-btn-active-bg: var(--app-btn-quiet-ink);
    --bs-btn-active-border-color: var(--app-btn-quiet-ink);
    --bs-btn-disabled-color: var(--app-btn-quiet-ink);
    --bs-btn-disabled-border-color: var(--app-btn-quiet-ink);
}

[data-bs-theme=dark] .btn-dark {
    --bs-btn-bg: var(--app-primary-bg);
    --bs-btn-border-color: var(--app-ink);
    --bs-btn-hover-bg: var(--app-primary-bg-hover);
    --bs-btn-hover-border-color: var(--app-ink);
    --bs-btn-active-bg: var(--app-primary-bg-hover);
    --bs-btn-active-border-color: var(--app-ink);
}

/* Section tabs (`partials/sectionTabs.js`): the strip that picks a section on a
   sub-page. Never scrolls sideways — that hid the last tab in half the
   languages and clipped the hand-drawn border. */
.section-tabs {
    max-width: 100%;
    min-width: 0;
}

/* The icon sits above the label, so the tabs stay narrow enough to share a
   phone's width; the badge stays beside the label. */
.section-tabs > .btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    white-space: nowrap;
}

.section-tabs__icon {
    font-size: 1.125rem;
    line-height: 1;
}

/* On a phone the strip spans the width and the tabs share it evenly; a label
   too long for its share ("Meine Angebote", "Матчи чемпионата") breaks onto a
   second line inside its tab. Bootstrap's 0.75rem side padding would leave
   no room for that at 390px. */
@media (max-width: 767px) {
    .section-tabs {
        width: 100%;
    }

    .section-tabs > .btn {
        flex: 1 1 0;
        min-width: 0;
        padding-left: 0.375rem;
        padding-right: 0.375rem;
        font-size: 0.875rem;
        line-height: 1.2;
        white-space: normal;
        overflow-wrap: anywhere;
        hyphens: auto;
    }
}

.fa-button {
    margin: 0 1rem;
    font-size: 20px;
}

.fa-button:hover {
    transform: scale(1.1);
    cursor: pointer;
}

/* Navigation Settings Button */
.nav-settings-btn {
    color: rgb(var(--app-white-rgb));
    padding: 0.5rem;
}

.nav-settings-btn:hover {
    color: rgba(var(--app-white-rgb), 0.8);
}

.nav-settings-btn .fa-cog {
    transition: transform 0.3s ease;
}

.nav-settings-btn:hover .fa-cog {
    transform: rotate(90deg);
}

.nav-avatar-btn {
    padding: 0.25rem;
    line-height: 0;
}

.nav-right-actions {
    align-items: center;
    gap: 0.5rem;
}

.nav-search-btn {
    font-size: 1.1rem;
    transition: transform 0.2s ease;
}

.nav-search-btn:hover {
    transform: scale(1.1);
}

.nav-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(var(--app-white-rgb), 0.4);
    transition: border-color 0.2s ease;
    display: block;
    margin-top: -4px;
}

.nav-avatar-btn:hover .nav-avatar {
    border-color: rgba(var(--app-white-rgb), 0.9);
}

.nav-avatar--default {
    background-color: rgba(var(--app-white-rgb), 0.1);
}

.native-avatar-btn {
    padding: 0;
    line-height: 0;
    display: inline-flex;
    align-items: center;
}

.native-avatar-btn .nav-avatar {
    width: 28px;
    height: 28px;
    border-width: 1.5px;
}

.nav-pills .nav-link i.fa {
    display: block;
    font-size: 16px;
}

/* The "Actions" tab's icon is an svg (client/lib/actionCardsIcon.js), not a
   glyph, so the rule above does not reach it and it used to sit inline, next to
   its label instead of above it like every other tab. Block plus `margin: auto`
   — a block box ignores the pill's `text-align: center`. Its 20px box matches
   the optical size of an fa glyph at 16px (the card art fills only the middle of
   the 24x24 canvas); the -2px pulls the row back to the 16px the glyphs occupy,
   over the icon's own empty margin, so the label stays level with its siblings'. */
.nav-pills .nav-link .action-cards-icon {
    display: block;
    width: 20px;
    height: 20px;
    margin: -2px auto;
    vertical-align: baseline;
}

/* Nav Pills

   Der ruhende Reiter ist dieselbe Flaeche wie der neutrale Knopf — beide
   sagen „hier passiert gerade nichts", und seit die ausgewaehlte Flaeche in
   beiden Modi dunkel ist, muss der ruhende dieselbe Richtung nehmen. Auf
   --app-surface-muted lag er im Dark Mode ueber dem Grund der Seite,
   waehrend der ausgewaehlte darunter liegt. */
.nav-pills .nav-link {
    position: relative;
    white-space: nowrap;
    background: var(--app-btn-neutral-bg);
    color: var(--app-btn-neutral-ink);
    text-align: center;
    margin-bottom: 1rem;
    margin-right: 1rem;
    letter-spacing: -0;
}

/* Unread-count badge on a tab pill (e.g. new action cards). The pill itself is
 * the containing block — without one the badge resolves against the initial
 * containing block and stays put while the tab pane scrolls underneath it.
 * It may bleed over the pill's right edge (there is a 1rem gap there) but never
 * over its top edge: the mobile tab bar is a scroll container and would clip it. */
.nav-pill-badge {
    position: absolute;
    top: 0;
    right: 0;
    transform: translateX(35%);
    padding: 0.35em 0.5em;
    font-size: 10px;
    line-height: 1;
    text-align: center;
}

/* Tab bar entrance scroll is driven from JS via requestAnimationFrame so it
 * works in iOS WKWebView too. Leave `scroll-behavior` at the default so the
 * initial snap-to-right-edge is instant and does not fight the JS animation. */

/* Settings Overlay Content */
.settings-overlay-content {
    min-width: 250px;
}

.settings-overlay-content .form-label {
    font-size: 1.15rem;
    font-weight: 600;
}

/* Account overlay friends list */
.account-friends-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

a.account-friend-row {
    color: inherit;
    text-decoration: none;
    border-bottom: 2px solid var(--app-ink);
}

a.account-friend-row:last-child {
    margin-bottom: 0.5rem;
}

a.account-friend-row:hover {
    text-decoration: underline;
}

.account-friend-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.account-friend-avatar--default {
    opacity: 0.7;
    background-color: rgba(var(--bs-body-color-rgb), 0.05);
}

.browse-user-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
    margin-right: 0.25rem;
    border: 1.5px solid rgba(var(--app-black-rgb), 0.1);
}

.browse-user-avatar--default {
    opacity: 0.6;
    background-color: rgba(var(--bs-body-color-rgb), 0.05);
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 0;
    }
}

@media screen and (max-width: 768px) {
    .nav.nav-pills {
        margin: -2rem -2rem 0;
        display: flex;
        flex-wrap: nowrap;
        width: calc(100% + 4rem);
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding: 1rem 2rem 0;
        animation: fade-in 0.1s ease-out;
    }

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

    .nav-pills .nav-link {
        font-size: 12px;
        text-align: center;
        margin-right: 0.5rem;
        align-content: center;
    }

    /* ----------------------------------------------------------------------
       The page's own tab strip docks under the info bar (#658)

       It used to scroll away with the page, so on a long squad list there was
       no way back to "Youth Team" without scrolling to the top first. Only
       the strip a page owns gets this — a nested one (the action-card
       market's) would otherwise dock as a second bar underneath.
       ---------------------------------------------------------------------- */
    .nav.nav-pills.sub-tab-bar {
        position: sticky;
        /* Where the content starts under the fixed navbar and info bar — the
           same number `.game-layout` pads by in layout.css, so the two move
           together. In the app the scrollport is the pane itself and the
           offset is 0 (see native-app.css). */
        top: var(--sub-tab-sticky-top, 6rem);
        /* Straight against the bar above it: the 1rem the strip carried was
           the gap the ticket is about, and the 2px left after it still showed
           as a sliver above the active tab. */
        padding-top: 0;
        padding-bottom: 2px;

        /* Opaque, or the page slides visibly through the tabs. */
        background: rgba(var(--app-surface-rgb), 0.8);
        backdrop-filter: blur(5px);

        /* Under the info bar (z-index 99), whose 2px border overlaps the top
           edge of this one, and over the page content. */
        z-index: 5;
    }

    /* No gaps: on mobile the strip is a tab bar, not a row of pills. */
    .sub-tab-bar .nav-link {
        flex: 1 0 auto;
        margin-right: 0;
        margin-bottom: 0;
        background: transparent;
        border: none;
        padding-right: 2px;
        padding-left: 2px;
        /* The tabs meet the bar's straight top edge — Sketchy's round pill
           corners left a wedge of background beside the active one. */
        border-top-left-radius: 0;
        border-top-right-radius: 0;
    }
}

/* The sandbox banner pushes the navbar and the info bar down by 2rem, and
   `.game-layout` its padding with them. */
body:has(> #sandbox-banner) {
    --sub-tab-sticky-top: 11rem;
}

/* ==========================================================================
   Der Knopf ohne Fuellung (`new IconButton({ plain: true })`, #706)

   Keine siebte Rolle und keine Outline durch die Hintertuer: die Rolle bleibt,
   was sie ist, nur traegt sie hier die Tinte statt der Flaeche. Fuer das
   Zeichen, das keine Schaltflaeche sein will — das X im Kopf einer Karte wog
   als graue Kachel schwerer als die Ueberschrift, die es zumacht.

   Der neutrale Fall nimmt die Tinte seines Modus (--bs-body-color), statt eine
   eigene Farbe mitzubringen: so stimmt er auf der Karte, im Dark Mode und auf
   jeder Flaeche, die ihren Modus nennt — die App-Schublade, die
   Season-Review-Karte, der App-Streifen, der hell bleibt. `inherit` waere das
   Elternelement statt des Modus und haette in der Schublade die dunkle Tinte
   der hellen Seite geholt. Die Rollen mit einer Aussage behalten ihre: die
   lesbare Form, nicht die volle Fuellfarbe.

   Alles ueber Bootstraps eigene Variablen — die Geometrie und damit das
   Tippziel bleiben, wie sie bei jedem anderen Knopf sind.
   ========================================================================== */
.btn-plain {
    --bs-btn-color: var(--bs-body-color);
    --bs-btn-bg: transparent;
    --bs-btn-border-color: transparent;
    --bs-btn-hover-color: var(--bs-body-color);
    --bs-btn-hover-bg: rgba(var(--bs-body-color-rgb), 0.08);
    --bs-btn-hover-border-color: transparent;
    --bs-btn-active-color: var(--bs-body-color);
    --bs-btn-active-bg: rgba(var(--bs-body-color-rgb), 0.14);
    --bs-btn-active-border-color: transparent;
    --bs-btn-disabled-color: var(--bs-body-color);
    --bs-btn-disabled-bg: transparent;
    --bs-btn-disabled-border-color: transparent;
    --bs-btn-focus-shadow-rgb: var(--bs-body-color-rgb);
}

.btn-plain.btn-info {
    --bs-btn-color: var(--bs-info-text-emphasis);
    --bs-btn-hover-color: var(--bs-info-text-emphasis);
    --bs-btn-active-color: var(--bs-info-text-emphasis);
    --bs-btn-disabled-color: var(--bs-info-text-emphasis);
    --bs-btn-hover-bg: var(--bs-info-bg-subtle);
    --bs-btn-active-bg: var(--bs-info-bg-subtle);
}

.btn-plain.btn-success {
    --bs-btn-color: var(--bs-success-text-emphasis);
    --bs-btn-hover-color: var(--bs-success-text-emphasis);
    --bs-btn-active-color: var(--bs-success-text-emphasis);
    --bs-btn-disabled-color: var(--bs-success-text-emphasis);
    --bs-btn-hover-bg: var(--bs-success-bg-subtle);
    --bs-btn-active-bg: var(--bs-success-bg-subtle);
}

.btn-plain.btn-warning {
    --bs-btn-color: var(--bs-warning-text-emphasis);
    --bs-btn-hover-color: var(--bs-warning-text-emphasis);
    --bs-btn-active-color: var(--bs-warning-text-emphasis);
    --bs-btn-disabled-color: var(--bs-warning-text-emphasis);
    --bs-btn-hover-bg: var(--bs-warning-bg-subtle);
    --bs-btn-active-bg: var(--bs-warning-bg-subtle);
}

.btn-plain.btn-danger {
    --bs-btn-color: var(--bs-danger-text-emphasis);
    --bs-btn-hover-color: var(--bs-danger-text-emphasis);
    --bs-btn-active-color: var(--bs-danger-text-emphasis);
    --bs-btn-disabled-color: var(--bs-danger-text-emphasis);
    --bs-btn-hover-bg: var(--bs-danger-bg-subtle);
    --bs-btn-active-bg: var(--bs-danger-bg-subtle);
}
