/*
 * Gemeinsame Farben. Akzent für Wortmarke, Symbole, Fokus-Ring und Hover-Rahmen; alles Übrige
 * kommt aus Bootstrap.
 */
:root {
    --ss-akzent: #1f5fbf;
    --ss-symbol-grund: #eaeff7;
}

/* Ein Fokus-Ring für alle eigenen Bedienelemente, nur bei Tastaturbedienung. */
.wortmarke:focus-visible,
.btn-ruhig:focus-visible,
.zurueck:focus-visible,
.kachel:focus-visible {
    outline: 3px solid var(--ss-akzent);
    outline-offset: 3px;
}

/* Strich-Symbole (Inline-SVG); Farbe über currentColor vom Elternelement. */
.symbol {
    flex: none;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Seitenkopf (fragments/layout.html :: seitenkopf) – auf allen Seiten gleich. */
.kopfleiste {
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.wortmarke {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    min-height: 44px;
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--bs-body-color);
    text-decoration: none;
    border-radius: 0.5rem;
}

.wortmarke-zeichen {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 0.5rem;
    color: #fff;
    background: var(--ss-akzent);
}

.btn-ruhig {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0 1rem;
    font-size: 0.9375rem;
    color: var(--bs-body-color);
    background: transparent;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
}

.btn-ruhig:hover {
    background: var(--ss-symbol-grund);
}

.zurueck {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-height: 44px;
    margin-left: -0.25rem;
    padding: 0 0.25rem;
    font-weight: 500;
    color: var(--ss-akzent);
    text-decoration: none;
    border-radius: 0.375rem;
}

.zurueck:hover {
    text-decoration: underline;
}

.seitentitel {
    margin-bottom: 0.25rem;
    font-size: 1.875rem;
    font-weight: 600;
}

/*
 * Kacheln der Übersichtsseiten. Bootstrap bringt für Karten keinen Hover-Zustand mit, ohne ihn
 * wirkt eine anklickbare Karte aber nicht wie ein Bedienelement.
 */
.kachel {
    border-radius: 0.75rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.kachel:hover,
.kachel:focus-visible {
    transform: translateY(-2px);
    border-color: var(--ss-akzent);
    box-shadow: 0 0.5rem 1.25rem rgba(16, 24, 40, 0.1);
}

.kachel .card-title {
    margin-bottom: 0.25rem;
}

.kachel-symbol {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 0.625rem;
    color: var(--ss-akzent);
    background: var(--ss-symbol-grund);
}

.kachel-symbol .symbol {
    width: 22px;
    height: 22px;
    stroke-width: 1.8;
}

.kachel-pfeil {
    width: 20px;
    height: 20px;
    margin-top: 0.75rem;
    color: var(--bs-secondary-color);
    transition: transform 0.15s ease;
}

.kachel:hover .kachel-pfeil {
    transform: translateX(3px);
}

.kachel-etikett {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    vertical-align: middle;
    color: var(--bs-secondary-color);
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
}

/*
 * Bei ungerader Kachelzahl nimmt die letzte Kachel die volle Breite, damit keine Lücke rechts
 * bleibt. Zählt nur, was Thymeleaf per th:if tatsächlich ausgegeben hat. Auf der Übersicht weicht die
 * Anzeige- von der DOM-Reihenfolge ab (CSS "order"), dort setzen Server und dashboard.js .kachel-breit.
 */
@media (min-width: 576px) {
    .kachelraster:not(.kachelraster-sortiert) > .col:last-child:nth-child(odd),
    .kachelraster-sortiert > .kachel-breit {
        width: 100%;
    }
}

/* Reihenfolge bearbeiten (Übersicht, dashboard.js). */
.reihenfolge-leiste {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin: -0.5rem 0 1rem;
}

.reihenfolge-hinweis {
    margin-right: auto;
}

.btn-ruhig-primaer {
    color: #fff;
    background: var(--ss-akzent);
    border-color: var(--ss-akzent);
}

.btn-ruhig-primaer:hover {
    background: #194d9b;
}

.btn-ruhig:disabled {
    opacity: 0.6;
}

.kachelraster.bearbeiten > .col {
    position: relative;
}

.kachelraster.bearbeiten .kachel {
    pointer-events: none;
    border-style: dashed;
}

.kachelraster.bearbeiten .card-body {
    padding-right: 4.25rem;
}

.kachelraster.bearbeiten .kachel-pfeil {
    display: none;
}

.kachel-schieber {
    position: absolute;
    top: 50%;
    right: calc(var(--bs-gutter-x) * 0.5 + 0.5rem);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    transform: translateY(-50%);
}

.btn-schieben {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    color: var(--ss-akzent);
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
}

.btn-schieben:hover:not(:disabled) {
    background: var(--ss-symbol-grund);
}

.btn-schieben:disabled {
    opacity: 0.35;
}

.btn-schieben:focus-visible {
    outline: 3px solid var(--ss-akzent);
    outline-offset: 2px;
}

/* Einklappbarer Zertifikatsstatus auf Schul-Boards (natives <details>, kein JavaScript). */
.zertifikat-leiste > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 32px;
    cursor: pointer;
    list-style: none;
    border-radius: 0.375rem;
}

.zertifikat-leiste > summary::-webkit-details-marker {
    display: none;
}

.zertifikat-leiste > summary:focus-visible {
    outline: 3px solid var(--ss-akzent);
    outline-offset: 3px;
}

.zertifikat-pfeil {
    transition: transform 0.15s ease;
}

.zertifikat-leiste[open] .zertifikat-pfeil {
    transform: rotate(180deg);
}

/* Nutzer mit "prefers-reduced-motion" bekommen die Hervorhebung ohne Bewegung. */
@media (prefers-reduced-motion: reduce) {
    .kachel,
    .kachel-pfeil,
    .zertifikat-pfeil {
        transition: none;
    }

    .kachel:hover,
    .kachel:focus-visible,
    .kachel:hover .kachel-pfeil {
        transform: none;
    }
}
