﻿/* Grundstil von CommonTools. In der App in wwwroot/index.html einbinden:
   <link rel="stylesheet" href="_content/CommonTools/commontools.css" />
   Farben über die Variablen unten; eine App kann sie in ihrer eigenen CSS-Datei überschreiben. */
:root {
    --ct-blue: #1e5fbf;
    --ct-blue-dark: #174c99;
    --ct-blue-light: #eaf1fb;
    --ct-green: #2e9d57;
    --ct-red: #c62828;
    --ct-text: #222;
    --ct-muted: #777;
    /* Schrift der CommonTools-Teile (Leiste, Menüs, Fenster, Fußzeile); eine App kann sie überschreiben */
    --ct-font: "Segoe UI", Arial, sans-serif;
}

/* ===== Schrift: überall gleich, unabhängig von der Schrift der Seite ===== */
.ct-menubar,
.ct-menu,
.ct-dialog,
.ct-footer {
    font-family: var(--ct-font);
}

/* ===== Knöpfe ===== */
.ct-btn {
    display: inline-block;
    border: 1px solid var(--ct-blue);
    background: white;
    color: var(--ct-blue);
    border-radius: 8px;
    padding: 7px 14px;
    font: inherit;
    text-decoration: none;
    cursor: pointer;
}

.ct-btn--primary {
    background: var(--ct-blue);
    color: white;
    font-weight: 600;
}

    .ct-btn--primary:hover {
        background: var(--ct-blue-dark);
    }

.ct-btn--danger {
    background: var(--ct-red);
    border-color: var(--ct-red);
    color: white;
}

.ct-hint {
    font-size: 0.8rem;
    color: var(--ct-muted);
}

/* ===== Titel der App (AppTitle): Knopf ohne eigenes Aussehen; :where = Klassen der App haben Vorrang ===== */
:where(.ct-title) {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

/* ===== Sprach-Umschalter (LanguageSwitch): nur die Flagge der anderen Sprache ===== */
.ct-lang {
    display: flex;
    align-items: center;
    background: none;
    border: none;
    padding: 4px 6px;
    border-radius: 6px;
    cursor: pointer;
}

    .ct-lang:hover {
        background: rgba(255, 255, 255, 0.18);
    }

    .ct-lang svg {
        width: 26px;
        height: 14px;
        border: 1px solid rgba(255, 255, 255, 0.6);
        display: block;
    }

/* ===== Fußzeile (AppFooter) ===== */
.ct-footer {
    text-align: right;
    font-size: 0.75rem;
    color: #888;
    padding: 8px 16px;
}

/* ===== Menü-Leiste (MenuBar, MenuBarMenu, Menu…) ===== */
.ct-menubar {
    position: relative;
    z-index: 30;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    background: var(--ct-blue);
    color: white;
    border-radius: 8px;
    padding: 4px 10px;
}

.ct-menubar__title {
    background: none;
    border: none;
    color: white;
    font: inherit;
    font-weight: 700;
    font-size: 1.05rem;
    padding: 6px 4px;
    margin-right: 14px;
    white-space: nowrap;
    cursor: pointer;
}

.ct-menubar__item {
    position: relative;
}

.ct-menubar__btn {
    background: transparent;
    border: none;
    color: white;
    font: inherit;
    font-size: 0.95rem;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
}

    .ct-menubar__btn:hover,
    .ct-menubar__btn--open {
        background: rgba(255, 255, 255, 0.18);
    }

.ct-menubar__right {
    margin-left: auto;
    display: flex;
    align-items: center;
}

.ct-menubar__backdrop {
    position: fixed;
    inset: 0;
    z-index: 29;
}

.ct-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 230px;
    background: white;
    color: var(--ct-text);
    border: 1px solid #ccd;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    padding: 4px 0;
    display: flex;
    flex-direction: column;
}

    .ct-menu[hidden] {
        display: none;
    }

.ct-menu__entry {
    display: block;
    text-align: left;
    background: none;
    border: none;
    font: inherit;
    font-size: 0.9rem;
    color: var(--ct-text);
    padding: 7px 14px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

    .ct-menu__entry:hover:not(:disabled) {
        background: var(--ct-blue-light);
    }

    /* Nicht verfügbar */
    .ct-menu__entry:disabled {
        color: #aaa;
        cursor: default;
    }

    .ct-menu__entry input[type=checkbox] {
        margin-right: 6px;
    }

.ct-menu__sub {
    font-weight: 600;
}

.ct-menu__subentries {
    display: flex;
    flex-direction: column;
}

    .ct-menu__subentries .ct-menu__entry {
        padding-left: 30px;
    }

.ct-menu__keep {
    display: flex;
    flex-direction: column;
}

.ct-menu__sep {
    border: 0;
    border-top: 1px solid #eee;
    margin: 4px 0;
    width: 100%;
}

/* ===== Dialog-Fenster (Dialog, AboutDialog, StorageDialog) ===== */
.ct-shade {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(0, 0, 0, 0.25);
}

.ct-dialog {
    position: fixed;
    z-index: 41;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    box-sizing: border-box;
    /* höchstens so hoch wie der Bildschirm; der Inhalt scrollt */
    max-height: calc(100vh - 100px);
    max-height: calc(100dvh - 100px);
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--ct-text);
}

/* Kopf: blauer Verlauf, Titel, Untertitel, ✕ oben rechts */
.ct-dialog__head {
    position: relative;
    background: linear-gradient(135deg, var(--ct-blue), #3d8bfd);
    color: white;
    padding: 18px 48px 16px 22px;
}

    .ct-dialog__head h2 {
        margin: 0;
        font-size: 1.4rem;
    }

.ct-dialog__sub {
    font-size: 0.8rem;
    opacity: 0.85;
}

.ct-dialog__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 1rem;
    cursor: pointer;
}

    .ct-dialog__close:hover {
        background: rgba(255, 255, 255, 0.3);
    }

/* Kopf und Knöpfe behalten ihre Höhe, nur der Inhalt scrollt */
.ct-dialog__head,
.ct-dialog__actions {
    flex-shrink: 0;
}

.ct-dialog__body {
    padding: 16px 22px 8px;
    /* langer Inhalt (z. B. Bilder) scrollt im Fenster, Kopf und Knöpfe bleiben sichtbar */
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.ct-dialog__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 0 22px 20px;
}

/* Kärtchen im Fenster "Über …" (AboutCard) */
.ct-card {
    position: relative;
    border-radius: 10px;
    padding: 10px 14px 10px 46px;
    margin-bottom: 12px;
}

.ct-card__icon {
    position: absolute;
    left: 13px;
    top: 9px;
    font-size: 1.25rem;
}

.ct-card--blau { background: #eaf1fb; }
.ct-card--gruen { background: #e8f5ec; }
.ct-card--orange { background: #fff4e0; }
.ct-card--lila { background: #efe9fb; }

/* Tabelle im Fenster "Speicherbelegung" (StorageDialog) */
.ct-storage {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
}

    .ct-storage td {
        padding: 6px 4px;
        border-bottom: 1px solid #eee;
    }

        .ct-storage td:last-child {
            text-align: right;
            font-weight: 600;
            white-space: nowrap;
        }

/* ===== Rückfrage (Confirm) – Aussehen wie bisher in PFlow ===== */
.ct-confirm {
    background: #fdf0ef;
    border: 1px solid #c0392b;
    border-radius: 6px;
    padding: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

.ct-confirm__btn {
    border: 1px solid #ccc;
    background: white;
    border-radius: 6px;
    padding: 0.2rem 0.5rem;
    margin-right: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

/* Bestätigen bei Löschen/Verwerfen: rot umrandet */
.ct-confirm__btn--danger {
    border-color: #c0392b;
    color: #c0392b;
}

/* ===== Ziehen und Ablegen (DragSortService, js/dragSort.js) ===== */
.ct-drag-active {
    opacity: 0.5;
    cursor: grabbing;
}

.ct-drag-target {
    outline: 2px dashed var(--ct-blue);
    outline-offset: 2px;
}

/* ===== Info-Knopf für Apps ohne Menü-Leiste (InfoButton) ===== */
.ct-infobtn {
    position: relative;
    display: inline-flex;
}

:where(.ct-infobtn__btn) {
    background: transparent;
    border: none;
    color: inherit;
    font: inherit;
    font-size: 0.95rem;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
}

    :where(.ct-infobtn__btn):hover,
    :where(.ct-infobtn__btn)[aria-expanded="true"] {
        background: rgba(255, 255, 255, 0.18);
    }

.ct-infobtn__menu {
    z-index: 30;
    min-width: 190px;
}

/* eigene Einträge der App im Info-Menü, untereinander wie die übrigen */
.ct-infobtn__extra {
    display: flex;
    flex-direction: column;
}

/* ===== Link-Knöpfe (LinkButton, LinkBar); :where = Klassen der App haben Vorrang ===== */
:where(.ct-linkbtn) {
    width: 34px;
    height: 29px;
    box-sizing: border-box;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--ct-blue);
    border-radius: 8px;
    background: #dce8f8;
    color: var(--ct-blue);
    font: inherit;
    font-weight: 600;
    font-size: 0.8rem;
    text-decoration: none;
    cursor: pointer;
    flex-shrink: 0;
}

    :where(.ct-linkbtn):hover {
        background: var(--ct-blue-light);
    }

:where(.ct-linkbtn--empty) {
    border-style: dashed;
    background: white;
    color: #888;
}

.ct-linkbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
    row-gap: 0.4rem;
}

.ct-linkbar__slot {
    display: flex;
    cursor: grab;
    -webkit-touch-callout: none; /* kein Link-Menü beim langen Drücken */
    user-select: none;
}

/* ===== Formular (LinkForm) und Zeilen (LinkList) ===== */
.ct-form {
    background: white;
    border: 1.5px solid var(--ct-blue);
    border-radius: 8px;
    padding: 0.75rem;
    margin: 0.3rem 0;
}

.ct-form__label {
    display: block;
    font-size: 0.8rem;
    color: #666;
    margin: 0.5rem 0 0.2rem;
}

.ct-form__input {
    padding: 0.3rem 0.5rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.95rem;
}

.ct-form__actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.ct-form__btn {
    border: 1px solid #ccc;
    background: white;
    border-radius: 6px;
    padding: 0.2rem 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    flex-shrink: 0;
}

    .ct-form__btn svg {
        width: 1em;
        height: 1em;
        vertical-align: -0.125em;
    }

.ct-form__btn--danger {
    border-color: #c0392b;
    color: #c0392b;
}

.ct-form__hint {
    margin: 0.3rem 0;
    color: #c0392b;
    font-size: 0.9rem;
}

.ct-linkrow {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid #eee;
}

.ct-linkrow__name {
    font-weight: 600;
    min-width: 2rem;
}

.ct-linkrow__text {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

    .ct-linkrow__text small {
        color: #666;
        margin-left: 0.4rem;
    }

.ct-linkrow__action {
    border: none;
    background: transparent;
    color: inherit;
    font-size: 1rem;
    padding: 0 0.3rem;
    cursor: pointer;
}


/* LinkBar: nur so viele Knöpfe, wie in eine Zeile passen (Knopf 34 px + Abstand 8 px); die übrigen bleiben gespeichert
   und sind über "Links verwalten" erreichbar. Reines CSS (Container-Abfragen), kein JS. */
.ct-linkbar {
    container-type: inline-size;
    flex-wrap: nowrap;
}

@container (max-width: 1251.98px) {
    .ct-linkbar__slot:nth-child(n+30) {
        display: none;
    }
}

@container (max-width: 1209.98px) {
    .ct-linkbar__slot:nth-child(n+29) {
        display: none;
    }
}

@container (max-width: 1167.98px) {
    .ct-linkbar__slot:nth-child(n+28) {
        display: none;
    }
}

@container (max-width: 1125.98px) {
    .ct-linkbar__slot:nth-child(n+27) {
        display: none;
    }
}

@container (max-width: 1083.98px) {
    .ct-linkbar__slot:nth-child(n+26) {
        display: none;
    }
}

@container (max-width: 1041.98px) {
    .ct-linkbar__slot:nth-child(n+25) {
        display: none;
    }
}

@container (max-width: 999.98px) {
    .ct-linkbar__slot:nth-child(n+24) {
        display: none;
    }
}

@container (max-width: 957.98px) {
    .ct-linkbar__slot:nth-child(n+23) {
        display: none;
    }
}

@container (max-width: 915.98px) {
    .ct-linkbar__slot:nth-child(n+22) {
        display: none;
    }
}

@container (max-width: 873.98px) {
    .ct-linkbar__slot:nth-child(n+21) {
        display: none;
    }
}

@container (max-width: 831.98px) {
    .ct-linkbar__slot:nth-child(n+20) {
        display: none;
    }
}

@container (max-width: 789.98px) {
    .ct-linkbar__slot:nth-child(n+19) {
        display: none;
    }
}

@container (max-width: 747.98px) {
    .ct-linkbar__slot:nth-child(n+18) {
        display: none;
    }
}

@container (max-width: 705.98px) {
    .ct-linkbar__slot:nth-child(n+17) {
        display: none;
    }
}

@container (max-width: 663.98px) {
    .ct-linkbar__slot:nth-child(n+16) {
        display: none;
    }
}

@container (max-width: 621.98px) {
    .ct-linkbar__slot:nth-child(n+15) {
        display: none;
    }
}

@container (max-width: 579.98px) {
    .ct-linkbar__slot:nth-child(n+14) {
        display: none;
    }
}

@container (max-width: 537.98px) {
    .ct-linkbar__slot:nth-child(n+13) {
        display: none;
    }
}

@container (max-width: 495.98px) {
    .ct-linkbar__slot:nth-child(n+12) {
        display: none;
    }
}

@container (max-width: 453.98px) {
    .ct-linkbar__slot:nth-child(n+11) {
        display: none;
    }
}

@container (max-width: 411.98px) {
    .ct-linkbar__slot:nth-child(n+10) {
        display: none;
    }
}

@container (max-width: 369.98px) {
    .ct-linkbar__slot:nth-child(n+9) {
        display: none;
    }
}

@container (max-width: 327.98px) {
    .ct-linkbar__slot:nth-child(n+8) {
        display: none;
    }
}

@container (max-width: 285.98px) {
    .ct-linkbar__slot:nth-child(n+7) {
        display: none;
    }
}

@container (max-width: 243.98px) {
    .ct-linkbar__slot:nth-child(n+6) {
        display: none;
    }
}

@container (max-width: 201.98px) {
    .ct-linkbar__slot:nth-child(n+5) {
        display: none;
    }
}

@container (max-width: 159.98px) {
    .ct-linkbar__slot:nth-child(n+4) {
        display: none;
    }
}

@container (max-width: 117.98px) {
    .ct-linkbar__slot:nth-child(n+3) {
        display: none;
    }
}

@container (max-width: 75.98px) {
    .ct-linkbar__slot:nth-child(n+2) {
        display: none;
    }
}

@container (max-width: 33.98px) {
    .ct-linkbar__slot:nth-child(n+1) {
        display: none;
    }
}

/* ===== Bereich mit verstellbarer Breite (ResizablePanel) ===== */
.ct-resizable {
    position: relative;
    max-width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.ct-resizable__handle {
    position: absolute;
    top: 0;
    bottom: 0;
    right: -14px;
    width: 12px;
    cursor: ew-resize;
    touch-action: none;
    border-radius: 6px;
    /* über der Fläche beim Ziehen (.ct-resizable__drag, 60): beide Klicks eines Doppelklicks treffen den Rand */
    z-index: 61;
}

    .ct-resizable__handle::after {
        content: "";
        position: absolute;
        top: 50%;
        left: 4px;
        width: 4px;
        height: 48px;
        margin-top: -24px;
        border-radius: 2px;
        background: #c9d2e0;
    }

    .ct-resizable__handle:hover::after {
        background: var(--ct-blue);
    }

.ct-resizable__drag {
    position: fixed;
    inset: 0;
    z-index: 60;
    cursor: ew-resize;
    touch-action: none;
}

@media (max-width: 759px) {
    .ct-resizable {
        width: 100% !important;
    }

    .ct-resizable__handle {
        display: none;
    }
}
