/* =========================================================================
 * TradeButtons Dashboard-Customizer (Ati 24.09.2026)
 * Farben/Radien aus dashboard.css (:root --tbdw-*). Die alte Symbolleiste
 * bleibt im DOM (ihre Logik wird weiterverwendet), ist aber ausgeblendet.
 * ========================================================================= */

/* ---- alte Symbolleiste: nur noch der neue Einstieg sichtbar ---------- */
html.tbdw-cz-an .tbdw-side-rail > :not(.tbdw-cz-einstieg) {
    display: none !important;
}

/* ---- Einstieg in der Fensterecke --------------------------------------- */
.tbdw-cz-einstieg {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 12px 0 10px;
    border-radius: 999px;
    border: 1px solid rgba(45, 212, 191, .45);
    background: rgba(11, 15, 22, .88);
    color: var(--tbdw-text, #e2e8f0);
    font: 600 12.5px/1 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    letter-spacing: .01em;
    cursor: pointer;
    transition: border-color .16s, background .16s, color .16s;
}
.tbdw-cz-einstieg:hover,
.tbdw-cz-einstieg:focus-visible {
    border-color: var(--tbdw-accent, #2dd4bf);
    background: rgba(45, 212, 191, .16);
    color: #f8fafc;
    outline: none;
}
.tbdw-cz-einstieg-ic { color: var(--tbdw-accent, #2dd4bf); font-size: 14px; }
html.tbdw-cz-offen .tbdw-cz-einstieg { display: none; }

/* ---- Hinweisleiste im Bearbeitungsmodus ------------------------------ */
.tbdw-cz-banner {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 0 0 10px;
    padding: 10px 14px;
    border: 1px solid rgba(45, 212, 191, .35);
    border-left: 3px solid var(--tbdw-accent, #2dd4bf);
    border-radius: var(--tbdw-radius, 10px);
    background: rgba(45, 212, 191, .07);
}
.tbdw-wrap.tbdw-edit-mode .tbdw-cz-banner { display: flex; }
.tbdw-cz-banner-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tbdw-cz-banner-text strong {
    font-size: 11.5px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--tbdw-accent, #2dd4bf);
}
.tbdw-cz-banner-text span { font-size: 12.5px; color: var(--tbdw-text-muted, #94a3b8); }
.tbdw-cz-griff-symbol {
    display: inline-block;
    width: 22px;
    height: 12px;
    vertical-align: -1px;
    border-radius: 6px;
    background-color: rgba(45, 212, 191, .14);
    background-image: radial-gradient(rgba(45, 212, 191, .85) 1px, transparent 1px);
    background-size: 5px 5px;
    background-position: 3px 2px;
    border: 1px solid rgba(45, 212, 191, .32);
}

/* ---- Panel ------------------------------------------------------------ */
.tbdw-cz {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 340px;
    max-width: 100vw;
    z-index: 999000;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform .2s ease, visibility 0s linear .2s;
    background: rgba(11, 15, 22, .97);
    border-left: 1px solid rgba(45, 212, 191, .22);
    box-shadow: -14px 0 34px rgba(0, 0, 0, .45);
    color: var(--tbdw-text, #e2e8f0);
    font: 400 13px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.tbdw-cz.is-offen {
    transform: translateX(0);
    visibility: visible;
    transition: transform .2s ease;
}
.tbdw-cz.is-offen.is-eingeklappt { transform: translateX(100%); }
.tbdw-cz *, .tbdw-cz *::before, .tbdw-cz *::after { box-sizing: border-box; }

.tbdw-cz-innen {
    height: 100%;
    overflow-y: auto;
    padding: 16px 16px 0;
    display: flex;
    flex-direction: column;
}

/* Lasche zum Ein-/Ausklappen: bleibt auch eingeklappt am Rand sichtbar */
.tbdw-cz-klappe {
    position: absolute;
    left: -26px;
    top: 50%;
    width: 26px;
    height: 56px;
    margin-top: -28px;
    border: 1px solid rgba(45, 212, 191, .35);
    border-right: 0;
    border-radius: 8px 0 0 8px;
    background: rgba(11, 15, 22, .95);
    color: var(--tbdw-accent, #2dd4bf);
    font-size: 18px;
    cursor: pointer;
}
.tbdw-cz-klappe:hover { background: rgba(45, 212, 191, .14); }

.tbdw-cz-kopf {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--tbdw-border, #1f2633);
}
.tbdw-cz-titel { font-size: 15px; font-weight: 700; color: #f8fafc; letter-spacing: .01em; }
.tbdw-cz-ansicht { font-size: 11.5px; color: var(--tbdw-text-muted, #94a3b8); margin-top: 2px; }

.tbdw-cz-rund {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, .3);
    background: transparent;
    color: var(--tbdw-text, #e2e8f0);
    font-weight: 700;
    cursor: pointer;
}
.tbdw-cz-rund:hover { border-color: var(--tbdw-accent, #2dd4bf); color: var(--tbdw-accent, #2dd4bf); }

.tbdw-cz-speichern-block { padding: 14px 0 4px; }

.tbdw-cz-status {
    font-size: 12.5px;
    font-weight: 600;
    margin-bottom: 8px;
    min-height: 18px;
}
.tbdw-cz-status.is-sauber   { color: #5eead4; }
.tbdw-cz-status.is-offen    { color: #fbbf24; }
.tbdw-cz-status.is-speichert{ color: #93c5fd; }
.tbdw-cz-status.is-fehler   { color: #f87171; }

.tbdw-cz-abschnitt {
    padding: 14px 0 12px;
    border-top: 1px solid var(--tbdw-border, #1f2633);
    margin-top: 10px;
}
.tbdw-cz-abschnitt h3 {
    margin: 0 0 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--tbdw-text-muted, #94a3b8);
}
.tbdw-cz-hinweis { margin: 0 0 10px; font-size: 12px; color: var(--tbdw-text-muted, #94a3b8); }
.tbdw-cz-abschnitt .tbdw-cz-hinweis:last-child { margin: 8px 0 0; }
.tbdw-cz-zahl { margin-top: 10px; font-size: 11.5px; color: var(--tbdw-text-muted, #94a3b8); }

/* ---- Knoepfe ---------------------------------------------------------- */
.tbdw-cz-knopf {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, .28);
    background: rgba(255, 255, 255, .03);
    color: var(--tbdw-text, #e2e8f0);
    font: 600 13px/1.2 inherit;
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
}
.tbdw-cz-knopf:hover { border-color: rgba(45, 212, 191, .55); background: rgba(45, 212, 191, .10); }
.tbdw-cz-knopf:disabled { opacity: .55; cursor: default; }
.tbdw-cz-knopf--primaer {
    background: var(--tbdw-accent, #2dd4bf);
    border-color: var(--tbdw-accent, #2dd4bf);
    color: #042f2b;
}
.tbdw-cz-knopf--primaer:hover { background: #5eead4; border-color: #5eead4; color: #042f2b; }
.tbdw-cz-knopf--warnung { color: #fca5a5; border-color: rgba(248, 113, 113, .45); }
.tbdw-cz-knopf--warnung:hover { background: rgba(248, 113, 113, .12); border-color: #f87171; }
.tbdw-cz-voll { width: 100%; }

.tbdw-cz-link {
    display: block;
    margin: 8px 0 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--tbdw-text-muted, #94a3b8);
    font-size: 12px;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
.tbdw-cz-link:hover { color: var(--tbdw-accent, #2dd4bf); }

/* ---- Schalter "Luecken schliessen" (Einrasten) ------------------------ */
.tbdw-cz-schalter {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 12px;
    cursor: pointer;
}
.tbdw-cz-schalter input { position: absolute; opacity: 0; pointer-events: none; }
.tbdw-cz-schalter-bahn {
    flex: 0 0 34px;
    height: 20px;
    margin-top: 1px;
    border-radius: 999px;
    background: #1e293b;
    border: 1px solid rgba(148, 163, 184, .35);
    position: relative;
    transition: background .15s, border-color .15s;
}
.tbdw-cz-schalter-bahn::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #cbd5e1;
    transition: transform .15s;
}
.tbdw-cz-schalter input:checked + .tbdw-cz-schalter-bahn {
    background: rgba(45, 212, 191, .35);
    border-color: var(--tbdw-accent, #2dd4bf);
}
.tbdw-cz-schalter input:checked + .tbdw-cz-schalter-bahn::after {
    transform: translateX(14px);
    background: var(--tbdw-accent, #2dd4bf);
}
.tbdw-cz-schalter input:focus-visible + .tbdw-cz-schalter-bahn { outline: 2px solid var(--tbdw-accent, #2dd4bf); outline-offset: 2px; }
.tbdw-cz-schalter-text { font-size: 13px; font-weight: 600; display: flex; flex-direction: column; }
.tbdw-cz-schalter-text small { font-weight: 400; font-size: 11.5px; color: var(--tbdw-text-muted, #94a3b8); }

/* ---- Layouts ---------------------------------------------------------- */
.tbdw-cz-layouts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tbdw-cz-layout {
    position: relative;
    display: flex;
    align-items: stretch;
    border: 1px solid var(--tbdw-border, #1f2633);
    border-radius: 8px;
    background: rgba(255, 255, 255, .02);
    transition: border-color .15s, background .15s;
}
.tbdw-cz-layout:hover { border-color: rgba(45, 212, 191, .4); }
.tbdw-cz-layout.is-aktiv {
    border-color: rgba(45, 212, 191, .7);
    background: rgba(45, 212, 191, .08);
}
.tbdw-cz-layout-laden {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    padding: 0 8px 0 10px;
    border: 0;
    background: none;
    color: inherit;
    font: 500 13px/1.2 inherit;
    text-align: left;
    cursor: pointer;
}
.tbdw-cz-layout-nr {
    flex: 0 0 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid rgba(148, 163, 184, .4);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--tbdw-text-muted, #94a3b8);
}
.tbdw-cz-layout.is-aktiv .tbdw-cz-layout-nr {
    border-color: var(--tbdw-accent, #2dd4bf);
    background: var(--tbdw-accent, #2dd4bf);
    color: #042f2b;
}
.tbdw-cz-layout-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbdw-cz-marke {
    flex: 0 0 auto;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--tbdw-accent, #2dd4bf);
    border: 1px solid rgba(45, 212, 191, .45);
    border-radius: 999px;
    padding: 2px 7px;
}
.tbdw-cz-layout-menue {
    flex: 0 0 32px;
    border: 0;
    border-left: 1px solid var(--tbdw-border, #1f2633);
    background: none;
    color: var(--tbdw-text-muted, #94a3b8);
    font-size: 16px;
    cursor: pointer;
    border-radius: 0 8px 8px 0;
}
.tbdw-cz-layout-menue:hover { color: #f8fafc; background: rgba(45, 212, 191, .10); }
.tbdw-cz-leer { font-size: 12px; color: var(--tbdw-text-muted, #94a3b8); padding: 6px 2px; }

.tbdw-cz-menue {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 5;
    min-width: 160px;
    padding: 4px;
    border: 1px solid rgba(45, 212, 191, .3);
    border-radius: 8px;
    background: #0b1220;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .5);
    display: flex;
    flex-direction: column;
}
.tbdw-cz-menue button {
    text-align: left;
    padding: 8px 10px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--tbdw-text, #e2e8f0);
    font: 500 13px/1.2 inherit;
    cursor: pointer;
}
.tbdw-cz-menue button:hover { background: rgba(45, 212, 191, .12); }
.tbdw-cz-menue .tbdw-cz-menue-gefahr { color: #fca5a5; }
.tbdw-cz-menue .tbdw-cz-menue-gefahr:hover { background: rgba(248, 113, 113, .12); }

.tbdw-cz-eingabe {
    min-height: 34px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, .3);
    background: #0b1220;
    color: var(--tbdw-text, #e2e8f0);
    font: 400 13px/1.2 inherit;
}
.tbdw-cz-eingabe:focus { outline: none; border-color: var(--tbdw-accent, #2dd4bf); }
.tbdw-cz-eingabe.is-fehlt { border-color: #f87171; }
.tbdw-cz-umbenennen { flex: 1; margin: 2px; }
.tbdw-cz-neu { display: flex; gap: 6px; margin-top: 10px; }
.tbdw-cz-neu .tbdw-cz-eingabe { flex: 1; min-width: 0; }

.tbdw-cz-fuss {
    position: sticky;
    bottom: 0;
    margin-top: auto;
    padding: 12px 0 16px;
    background: linear-gradient(to top, rgba(11, 15, 22, 1) 70%, rgba(11, 15, 22, 0));
}

/* ---- Schmal (Einspalten-Modus): nur Hinweis + Layouts laden ----------- */
.tbdw-cz-nur-schmal { display: none; }
.tbdw-cz.is-schmal .tbdw-cz-nur-breit { display: none !important; }
.tbdw-cz.is-schmal .tbdw-cz-nur-schmal {
    display: block;
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(251, 191, 36, .35);
    background: rgba(251, 191, 36, .07);
    font-size: 12.5px;
    color: #fde68a;
}
.tbdw-cz.is-schmal .tbdw-cz-nur-schmal p { margin: 0 0 6px; }
.tbdw-cz.is-schmal .tbdw-cz-nur-schmal p:last-child { margin: 0; }

/* ---- Rueckfrage ------------------------------------------------------- */
.tbdw-cz-dialog {
    position: fixed;
    inset: 0;
    z-index: 999500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(2, 6, 15, .62);
}
.tbdw-cz-dialog-karte {
    width: 100%;
    max-width: 400px;
    padding: 18px 18px 16px;
    border-radius: 12px;
    border: 1px solid rgba(45, 212, 191, .3);
    background: #0b1220;
    box-shadow: 0 18px 44px rgba(0, 0, 0, .55);
    color: var(--tbdw-text, #e2e8f0);
    font: 400 13px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.tbdw-cz-dialog-titel { font-size: 15px; font-weight: 700; color: #f8fafc; margin-bottom: 6px; }
.tbdw-cz-dialog-text { color: var(--tbdw-text-muted, #94a3b8); margin-bottom: 16px; }
.tbdw-cz-dialog-text b { color: var(--tbdw-text, #e2e8f0); }
.tbdw-cz-dialog-knoepfe { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

/* ---- Kurzanleitung ---------------------------------------------------- */
.tbdw-cz-anleitung {
    position: fixed;
    right: 360px;
    top: 90px;
    z-index: 999600;
    width: 320px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(45, 212, 191, .55);
    background: #0b1220;
    box-shadow: 0 18px 44px rgba(0, 0, 0, .55), 0 0 0 4px rgba(45, 212, 191, .06);
    color: var(--tbdw-text, #e2e8f0);
    font: 400 13px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.tbdw-cz-anleitung-kopf { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.tbdw-cz-anleitung-schritt { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--tbdw-accent, #2dd4bf); font-weight: 700; }
.tbdw-cz-anleitung-titel { font-size: 15px; font-weight: 700; color: #f8fafc; margin-bottom: 4px; }
.tbdw-cz-anleitung p { margin: 0 0 14px; color: var(--tbdw-text-muted, #94a3b8); }
.tbdw-cz-anleitung-fuss { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tbdw-cz-anleitung-fuss > div:last-child { display: flex; gap: 6px; }
.tbdw-cz-punkte { display: flex; gap: 5px; }
.tbdw-cz-punkte span { width: 6px; height: 6px; border-radius: 50%; background: rgba(148, 163, 184, .35); }
.tbdw-cz-punkte span.is-an { background: var(--tbdw-accent, #2dd4bf); }

/* ---- Widget-Katalog: Suche + "aktiv"-Marke ---------------------------- */
.tbdw-cz-suche {
    display: block;
    width: calc(100% - 32px);
    margin: 4px 16px 10px;
    min-height: 36px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, .3);
    background: #0b1220;
    color: var(--tbdw-text, #e2e8f0);
    font-size: 13px;
}
.tbdw-cz-suche:focus { outline: none; border-color: var(--tbdw-accent, #2dd4bf); }
.tbdw-widget-choice { position: relative; }
.tbdw-cz-imlayout {
    display: inline-block;
    margin-top: 4px;
    font-size: 10px;
    font-weight: 700;
    color: var(--tbdw-accent, #2dd4bf);
    letter-spacing: .03em;
}

/* ---- Tablet / Touch --------------------------------------------------- */
@media (pointer: coarse) {
    .tbdw-cz-knopf, .tbdw-cz-layout-laden, .tbdw-cz-layout-menue, .tbdw-cz-einstieg, .tbdw-cz-rund { min-height: 44px; }
    .tbdw-cz-rund { min-width: 44px; }
    .tbdw-cz-layout-menue { flex-basis: 44px; }
}
@media (max-width: 1100px) {
    .tbdw-cz-anleitung { right: 16px; top: auto; bottom: 16px; left: 16px; width: auto; max-width: 420px; margin-left: auto; }
}

/* ---- Handy: unteres Blatt statt Seitenpanel --------------------------- */
@media (max-width: 768px) {
    .tbdw-cz {
        top: auto;
        left: 0;
        width: 100%;
        height: 78vh;
        border-left: 0;
        border-top: 1px solid rgba(45, 212, 191, .3);
        border-radius: 14px 14px 0 0;
        transform: translateY(100%);
    }
    .tbdw-cz.is-offen { transform: translateY(0); }
    .tbdw-cz.is-offen.is-eingeklappt { transform: translateY(0); }
    .tbdw-cz-klappe { display: none; }
    .tbdw-cz-banner { flex-direction: column; align-items: stretch; }
}

@media (prefers-reduced-motion: reduce) {
    .tbdw-cz, .tbdw-cz-knopf, .tbdw-cz-schalter-bahn, .tbdw-cz-schalter-bahn::after { transition: none; }
}

/* ---- Markierung des echten Bedienelements in der Anleitung (24.09.2026) - */
.tbdw-cz-markierung {
    position: fixed;
    z-index: 999550;
    pointer-events: none;
    border: 2px solid var(--tbdw-accent, #2dd4bf);
    border-radius: 10px;
    box-shadow: 0 0 0 4px rgba(45, 212, 191, .18), 0 0 22px rgba(45, 212, 191, .45);
    animation: tbdwCzPuls 1.4s ease-in-out infinite;
}
@keyframes tbdwCzPuls {
    0%, 100% { box-shadow: 0 0 0 4px rgba(45, 212, 191, .18), 0 0 22px rgba(45, 212, 191, .45); }
    50%      { box-shadow: 0 0 0 7px rgba(45, 212, 191, .10), 0 0 30px rgba(45, 212, 191, .60); }
}
.tbdw-cz-link--mitte { margin: 0 0 10px; text-align: center; width: 100%; }
@media (prefers-reduced-motion: reduce) {
    .tbdw-cz-markierung { animation: none; }
}
