/*
 * Symbol für die Navigationsgruppe „Portal“. Contao liefert Symbole nur für die
 * eigenen Gruppen (Klasse group-<name>). Maße und Farben wie bei den
 * Kern-Symbolen: hell #6c7174, dunkel #9fa4a8.
 */

:root {
    --icon-compusense-portal: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2213%22%20height%3D%2213%22%20fill%3D%22none%22%20stroke%3D%22%236c7174%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20stroke-width%3D%222%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20d%3D%22M21.42%2010.92a1%201%200%200%200-.02-1.84L12.83%205.18a2%202%200%200%200-1.66%200L2.6%209.08a1%201%200%200%200%200%201.83l8.57%203.91a2%202%200%200%200%201.66%200z%22%2F%3E%3Cpath%20d%3D%22M22%2010v6%22%2F%3E%3Cpath%20d%3D%22M6%2012.5V16a6%203%200%200%200%2012%200v-3.5%22%2F%3E%3C%2Fsvg%3E");
}

html[data-color-scheme="dark"] {
    --icon-compusense-portal: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2213%22%20height%3D%2213%22%20fill%3D%22none%22%20stroke%3D%22%239fa4a8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20stroke-width%3D%222%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20d%3D%22M21.42%2010.92a1%201%200%200%200-.02-1.84L12.83%205.18a2%202%200%200%200-1.66%200L2.6%209.08a1%201%200%200%200%200%201.83l8.57%203.91a2%202%200%200%200%201.66%200z%22%2F%3E%3Cpath%20d%3D%22M22%2010v6%22%2F%3E%3Cpath%20d%3D%22M6%2012.5V16a6%203%200%200%200%2012%200v-3.5%22%2F%3E%3C%2Fsvg%3E");
}

#tl_navigation .group-compusense_portal {
    background: var(--icon-compusense-portal) 3px 2px no-repeat;
}

/* Frontendrechte */

.cs-rights-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1em 2em;
    /* 1em Rand + 15px Innenabstand von Contaos tl_listing_container: dieselbe
       Linie wie die Tabelle. */
    padding: .7em calc(1em + 15px);
    margin-top: 0;
}

/* Innenabstand statt Außenabstand, damit die Trennlinie von Rand zu Rand
   läuft. Farben wie im Backend (#f3f3f5 / #e0e0e2). */
.cs-rights-tabs {
    display: flex;
    gap: 2px;
    margin: 0;
    padding: 0 calc(1em + 15px);
    border-bottom: 1px solid #e0e0e2;
}

.cs-rights-tab {
    padding: .55em 1.2em;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    color: #6a6a6a;
    text-decoration: none;
}

.cs-rights-tab:hover {
    background: #f3f3f5;
    color: #222;
}

/* Der gewählte Reiter deckt die Linie der Leiste ab. */
.cs-rights-tab.is-active {
    margin-bottom: -1px;
    padding-bottom: calc(.55em + 1px);
    border-color: #e0e0e2;
    background: #fff;
    color: #222;
    font-weight: 600;
}

.cs-rights-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1em;
    width: 100%;
}

.cs-rights-filter {
    display: flex;
    align-items: center;
    gap: .5em;
}

.cs-rights-filter span {
    color: #6a6a6a;
}

.cs-rights-filter input {
    width: 13em;
    margin: 0;
}

.cs-rights-count {
    margin-left: auto;
    color: #6a6a6a;
    font-size: .85em;
    white-space: nowrap;
}

/* 1em + 15px wie oben: Ändert Contao den Innenabstand von
   tl_listing_container, muss er hier mit. */
.cs-rights-note {
    margin: 1.2em 1em .8em;
    padding: 0 15px;
    color: #4a4a4a;
}

.cs-rights {
    /* Eigener Rollbereich, damit nicht die ganze Seite seitlich wandert. */
    overflow: auto;
    max-height: 75vh;
    margin: 0 1em 1em;
}

.cs-rights-table {
    border-collapse: separate;
    border-spacing: 0;
    /* Den Überschuss bei wenigen Gruppen nimmt die Namensspalte auf. */
    width: 100%;
}

.cs-rights-table th,
.cs-rights-table td {
    border-bottom: 1px solid #e5e5e5;
    border-right: 1px solid #eee;
    padding: .3em .45em;
    background: #fff;
}

/* Namensspalte und Kopfzeile bleiben beim Rollen stehen. */
.cs-rights-name {
    /* Mindestbreite: siehe .cs-rights-namebox */
    width: 100%;
    position: sticky;
    left: 0;
    z-index: 2;
    text-align: left;
    font-weight: 400;
    white-space: nowrap;
    border-right: 1px solid #ddd;
}

.cs-rights-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f7f7f7;
    vertical-align: bottom;
    border-bottom: 1px solid #ccc;
}

.cs-rights-table thead .cs-rights-name {
    z-index: 4;
}

/* Feste Mindestbreite und kein Umbruch, damit alle Zeilen gleich hoch sind. */
.cs-rights-namebox {
    display: flex;
    align-items: center;
    gap: .6em;
    width: 100%;
    min-width: 34em;
}

.cs-rights-code {
    flex: 0 0 5.5em;
    font-weight: 600;
}

.cs-rights-title {
    /* flex-basis 0: Der längste Titel soll die Spaltenbreite nicht bestimmen. */
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cs-rights-flag {
    display: inline-block;
    width: 1.35em;
    height: 1.35em;
    margin-left: .4em;
    border-radius: 50%;
    background: #f0ad4e;
    color: #fff;
    font-weight: 700;
    text-align: center;
    line-height: 1.35em;
    text-decoration: none;
    cursor: help;
}

.cs-rights-group {
    padding: .5em .15em;
}

.cs-rights-group span {
    display: block;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    /* Längere Namen werden abgeschnitten (voll im title). */
    max-height: 13em;
    overflow: hidden;
    white-space: nowrap;
}

.cs-rights-cell {
    text-align: center;
}

.cs-rights-cell input {
    margin: 0;
    cursor: pointer;
}

.cs-rights-toggle {
    /* Rechtsbündig neben den Haken, erst beim Überfahren der Zeile deutlich. */
    flex: 0 0 auto;
    margin-left: auto;
    width: 1.8em;
    opacity: .25;
    padding: 0;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: #f7f7f7;
    font-size: 1em;
    line-height: 1.5;
    cursor: pointer;
}

.cs-rights-table tbody tr:hover .cs-rights-toggle {
    opacity: 1;
}

.cs-rights-toggle:hover,
.cs-rights-toggle:focus {
    border-color: #f47c00;
    opacity: 1;
}

/* Kreuz-Hervorhebung von Zeile und Spalte */
.cs-rights-table tbody tr:hover > th,
.cs-rights-table tbody tr:hover > td {
    background: #fff8e6;
}

.cs-rights-table td.is-column,
.cs-rights-table tbody th.is-column {
    background: #fff8e6;
}

.cs-rights-table thead th.is-column {
    background: #ffeec2;
}

.cs-rights-table tbody tr.is-saving > th,
.cs-rights-table tbody tr.is-saving > td {
    opacity: .45;
}

@keyframes cs-rights-saved {
    from { background: #cdeacd; }
    to   { background: #fff; }
}

.cs-rights-table tbody tr.is-saved > th,
.cs-rights-table tbody tr.is-saved > td {
    animation: cs-rights-saved 1.4s ease-out;
}

.cs-rights-status {
    position: sticky;
    bottom: 0;
    margin-top: 1em;
    padding: .7em 1em;
    border-radius: 3px;
    background: #c33;
    color: #fff;
    font-weight: 600;
}
