/* tb-d8me, KI-Dating-Demo
   Farbpalette: tief-dunkler Hintergrund, Pink-Akzent, Neon-Cyan, Lila */

.tb-d8me {
    --d8-bg:       #0a0a14;
    --d8-bg-card:  #14142a;
    --d8-border:   rgba(255, 61, 138, .25);
    --d8-pink:     #ff3d8a;
    --d8-pink-2:   #ff85b1;
    --d8-cyan:     #22d3ee;
    --d8-purple:   #a855f7;
    --d8-text:     #f1f1f5;
    --d8-text-mut: #9ca3af;
    --ring-hue:    310;
    --d8-radius:   16px;

    background: var(--d8-bg);
    color: var(--d8-text);
    padding: 0 0 3rem;
    margin: 0 0 2rem;
    --d8-inner: 1080px;
}

/* Innen-Sektionen bleiben lesbar zentriert; Hero darf voll bleiben.
   Wichtig: per-Sektion-Regeln dürfen kein margin-shorthand mit linkem Wert
   verwenden, sonst kippt das Zentrieren. */
.tb-d8me__section-title,
.tb-d8me__girls,
.tb-d8me__chat,
.tb-d8me__chat-placeholder,
.tb-d8me__notice,
.tb-d8me__advanced,
.tb-d8me__chat-footer {
    max-width: var(--d8-inner);
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box;
}

/* Hero in voller Viewport-Breite, sprengt jeden Container drumherum */
.tb-d8me__hero {
    position: relative;
    min-height: 420px;
    overflow: hidden;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    margin-top: 0;
    margin-bottom: 2rem;
}
.tb-d8me__hero-video {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    z-index: 1;
    filter: brightness(.55) saturate(1.05);
}
.tb-d8me__hero-overlay {
    position: absolute; inset: 0;
    background:
        radial-gradient(circle at 30% 40%, rgba(255, 61, 138, .35) 0%, transparent 50%),
        radial-gradient(circle at 70% 60%, rgba(168, 85, 247, .25) 0%, transparent 50%),
        linear-gradient(180deg, rgba(10, 10, 20, .3) 0%, rgba(10, 10, 20, .85) 100%);
    z-index: 2;
}
.tb-d8me__hero-content {
    position: relative;
    z-index: 3;
    padding: 4rem 1.5rem 3rem;
    text-align: center;
}
.tb-d8me__hero-title {
    margin: 0 0 .35rem;
    font-size: clamp(2.2rem, 6vw, 3.5rem);
    color: var(--d8-pink);
    text-shadow: 0 0 30px rgba(255, 61, 138, .8);
    letter-spacing: .04em;
}
.tb-d8me__hero-claim {
    margin: 0 0 .75rem;
    font-size: clamp(1rem, 2.5vw, 1.35rem);
    color: var(--d8-pink-2);
    font-weight: 600;
}
.tb-d8me__hero-sub {
    max-width: 540px;
    margin: 0 auto;
    color: var(--d8-text-mut);
    line-height: 1.55;
}

.tb-d8me__section-title {
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    padding: 0 1.5rem;
    color: var(--d8-text);
    font-size: 1.4rem;
    letter-spacing: .02em;
    text-align: center;
}

/* Mädchen-Grid */
.tb-d8me__girls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
    padding: 0 1.5rem;
    justify-content: center;
}
.tb-d8me__girl {
    background: var(--d8-bg-card);
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: var(--d8-radius);
    padding: 1.5rem;
    text-align: center;
    transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.tb-d8me__girl.is-selected,
.tb-d8me__girl:hover {
    transform: translateY(-3px);
    border-color: hsl(var(--ring-hue), 90%, 60%);
    box-shadow: 0 0 30px hsla(var(--ring-hue), 90%, 60%, .25);
}

/* Neon-Ring um Avatar */
.tb-d8me__girl-frame {
    width: 140px; height: 140px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    padding: 4px;
    background: hsl(var(--ring-hue), 90%, 60%);
    box-shadow:
        0 0 14px hsla(var(--ring-hue), 90%, 60%, .9),
        0 0 30px hsla(var(--ring-hue), 90%, 60%, .55);
    position: relative;
}
.tb-d8me__girl-img {
    width: 100%; height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.tb-d8me__girl-name {
    margin: 0;
    font-size: 1.25rem;
    color: var(--d8-text);
}
.tb-d8me__girl-tagline {
    margin: .25rem 0 .75rem;
    color: hsl(var(--ring-hue), 80%, 70%);
    font-size: .92em;
    font-weight: 600;
}
.tb-d8me__girl-bio {
    margin: 0 0 1rem;
    color: var(--d8-text-mut);
    font-size: .9em;
    line-height: 1.55;
}

/* Buttons */
.tb-d8me__btn {
    appearance: none;
    border: 0;
    border-radius: 999px;
    padding: .75rem 1.4rem;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
    letter-spacing: .02em;
}
.tb-d8me__btn--primary {
    background: linear-gradient(135deg, var(--d8-pink) 0%, var(--d8-purple) 100%);
    color: #fff;
    box-shadow: 0 6px 24px rgba(255, 61, 138, .35);
}
.tb-d8me__btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 30px rgba(255, 61, 138, .55);
}
.tb-d8me__btn--big { padding: .95rem 1.75rem; font-size: 1.05rem; }

/* Start-Formular */
.tb-d8me__start {
    padding: 0 1.5rem;
    margin-top: 2rem;
}
.tb-d8me__start-intro {
    color: var(--d8-text-mut);
    max-width: 640px;
}
.tb-d8me__start-intro a { color: var(--d8-pink-2); }
.tb-d8me__start-form {
    max-width: 540px;
    background: var(--d8-bg-card);
    padding: 1.5rem;
    border-radius: var(--d8-radius);
    border: 1px solid var(--d8-border);
}
.tb-d8me__field { display: flex; flex-direction: column; gap: .3rem; }
.tb-d8me__field > span { color: var(--d8-text-mut); font-size: .92em; font-weight: 600; }
.tb-d8me__field input {
    background: rgba(0, 0, 0, .3);
    color: var(--d8-text);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 8px;
    padding: .7rem .9rem;
    font: inherit;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    letter-spacing: .03em;
}
.tb-d8me__field input:focus {
    outline: 2px solid var(--d8-pink);
    border-color: transparent;
}
.tb-d8me__start-summary {
    margin: 1rem 0;
    color: var(--d8-text-mut);
}

/* Chat-Sicht */
.tb-d8me--chat {
    padding: 0;
    max-width: 720px;
    margin: 0 auto 3rem;
    border: 1px solid var(--d8-border);
}

.tb-d8me__chat-head {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #1a1a2e 0%, #2a1a3a 100%);
    border-bottom: 1px solid rgba(255, 255, 255, .05);
}
.tb-d8me__chat-avatar .tb-d8me__girl-frame {
    width: 64px; height: 64px;
    margin: 0;
    padding: 3px;
}
.tb-d8me__chat-name { margin: 0; font-size: 1.2rem; }
.tb-d8me__chat-tagline {
    margin: 0;
    color: hsl(var(--ring-hue), 80%, 70%);
    font-size: .85em;
    font-weight: 600;
}
.tb-d8me__chat-credits {
    text-align: right;
    display: flex; flex-direction: column;
    line-height: 1.1;
}
.tb-d8me__chat-credits-num {
    font-size: 1.4rem;
    color: var(--d8-pink-2);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.tb-d8me__chat-credits-label {
    font-size: .7em;
    color: var(--d8-text-mut);
    text-transform: uppercase;
    letter-spacing: .1em;
}
.tb-d8me__chat-time {
    font-size: .8em;
    color: var(--d8-text-mut);
    font-variant-numeric: tabular-nums;
    margin-top: .15rem;
}

.tb-d8me__chat-log {
    padding: 1.25rem;
    min-height: 280px;
    max-height: 480px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    background: var(--d8-bg);
}
.tb-d8me__chat-msg {
    padding: .65rem 1rem;
    border-radius: 14px;
    max-width: 80%;
    line-height: 1.55;
    white-space: pre-wrap;
}
.tb-d8me__chat-msg--user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--d8-pink) 0%, var(--d8-purple) 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.tb-d8me__chat-msg--bot {
    align-self: flex-start;
    background: var(--d8-bg-card);
    color: var(--d8-text);
    border: 1px solid rgba(255, 255, 255, .06);
    border-bottom-left-radius: 4px;
}
.tb-d8me__chat-msg--system {
    align-self: center;
    background: transparent;
    color: var(--d8-text-mut);
    font-size: .85em;
    font-style: italic;
}
.tb-d8me__chat-msg--cost {
    align-self: flex-start;
    background: transparent;
    color: var(--d8-text-mut);
    font-size: .72em;
    padding: 0 .5rem;
}

.tb-d8me__chat-form {
    display: flex;
    gap: .5rem;
    padding: .75rem;
    background: var(--d8-bg-card);
    border-top: 1px solid rgba(255, 255, 255, .05);
}
.tb-d8me__chat-input {
    flex: 1 1 0; min-width: 0;
    background: rgba(0, 0, 0, .35);
    color: var(--d8-text);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 999px;
    padding: .7rem 1rem;
    font: inherit;
}
.tb-d8me__chat-input:focus {
    outline: 2px solid var(--d8-pink);
    border-color: transparent;
}

.tb-d8me__chat-hint {
    color: var(--d8-text-mut);
    font-size: .8em;
    padding: 0 1.25rem;
    margin-top: 1rem;
}
.tb-d8me__chat-hint a { color: var(--d8-pink-2); }
.tb-d8me__chat-hint code {
    background: rgba(255, 255, 255, .08);
    padding: .1em .4em;
    border-radius: 4px;
    color: var(--d8-pink-2);
}

@media (max-width: 600px) {
    .tb-d8me__hero-content { padding: 2.5rem 1rem 2rem; }
    .tb-d8me__girls { padding: 0 1rem; }
    .tb-d8me__start { padding: 0 1rem; }
    .tb-d8me__chat-head { grid-template-columns: 1fr auto; }
    .tb-d8me__chat-avatar { display: none; }
}

/* Dark-Mode + Full-Width für die ganze Seite wenn d8me-Shortcode aktiv ist.
   Body-Klasse wird über body_class-Filter aus tb-d8me.php gesetzt. */
body.tb-d8me-page {
    background: #0a0a14;
    color: #f1f1f5;
}
body.tb-d8me-page .tb-container,
body.tb-d8me-page main,
body.tb-d8me-page .wp-block-post-content,
body.tb-d8me-page main > .wp-block-group {
    background: transparent;
    color: inherit;
    max-width: none;
    padding-inline: 0;
    padding-block: 0;
    overflow: visible;
}
body.tb-d8me-page .tb-d8me {
    max-width: none;
    margin: 0;
    border-radius: 0;
}
body.tb-d8me-page .tb-d8me .tb-d8me__hero { border-radius: 0; }
body.tb-d8me-page article > header,
body.tb-d8me-page .entry-header,
body.tb-d8me-page .wp-block-post-title {
    display: none;
}
body.tb-d8me-page .tb-footer { background: #06060c; color: #6b7280; }
body.tb-d8me-page .tb-footer a { color: #ff85b1; }
body.tb-d8me-page .tb-footer__title { color: #f1f1f5; }

/* Advanced-Toggle (Referenz manuell eingeben) */
.tb-d8me__advanced {
    margin-top: 2.5rem;
    background: rgba(0, 0, 0, .3);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: var(--d8-radius);
    padding: 1rem 1.25rem;
}
.tb-d8me__advanced summary {
    cursor: pointer;
    color: var(--d8-text-mut);
    font-weight: 600;
    list-style: none;
}
.tb-d8me__advanced summary::-webkit-details-marker { display: none; }
.tb-d8me__advanced summary::before {
    content: '▸ ';
    color: var(--d8-pink-2);
    transition: transform .15s ease;
    display: inline-block;
}
.tb-d8me__advanced[open] summary::before { content: '▾ '; }
.tb-d8me__advanced .tb-d8me__start-form {
    margin-top: 1rem;
    border: 0;
    padding: 0;
    background: transparent;
}
.tb-d8me__advanced select {
    background: rgba(0, 0, 0, .3);
    color: var(--d8-text);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 8px;
    padding: .7rem .9rem;
    font: inherit;
}

/* Girl-Switcher (Tab-Reihe oberhalb des Chats) */
.tb-d8me__switcher {
    display: flex;
    gap: .5rem;
    padding: .85rem 1rem;
    background: linear-gradient(180deg, #14142a 0%, #0f0f1f 100%);
    border-bottom: 1px solid rgba(255, 255, 255, .05);
    overflow-x: auto;
}
.tb-d8me__switcher-tab {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem .65rem .35rem .35rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, .35);
    border: 1px solid rgba(255, 255, 255, .08);
    color: var(--d8-text-mut);
    text-decoration: none;
    font-weight: 600;
    font-size: .92em;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
    flex: 0 0 auto;
}
.tb-d8me__switcher-tab:hover {
    border-color: hsl(var(--ring-hue), 90%, 60%);
    color: #fff;
}
.tb-d8me__switcher-tab.is-active {
    background: linear-gradient(135deg, hsla(var(--ring-hue), 90%, 60%, .25) 0%, hsla(var(--ring-hue), 90%, 50%, .15) 100%);
    border-color: hsl(var(--ring-hue), 90%, 60%);
    color: #fff;
    box-shadow: 0 0 16px hsla(var(--ring-hue), 90%, 60%, .35);
}
.tb-d8me__switcher-img {
    width: 32px; height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid hsl(var(--ring-hue), 90%, 60%);
}

/* Status-Sicht (pending/canceled/failed) */
.tb-d8me--status {
    padding: 4rem 2rem;
    text-align: center;
    max-width: 640px;
    margin: 2rem auto;
}
.tb-d8me__status-title { color: var(--d8-pink); margin: 0 0 1rem; }
.tb-d8me__status-body { color: var(--d8-text-mut); line-height: 1.6; }
.tb-d8me__status-meta { color: var(--d8-text-mut); font-size: .9em; margin-top: 1rem; }
.tb-d8me__status-meta code {
    background: rgba(0, 0, 0, .4);
    color: var(--d8-pink-2);
    padding: .2em .5em;
    border-radius: 4px;
}

/* ────────── Inline-Chat unterhalb der Karten ────────── */
.tb-d8me__chat {
    margin-top: 3rem;
    background: var(--d8-bg-card);
    border: 1px solid var(--d8-border);
    border-radius: var(--d8-radius);
    overflow: hidden;
    scroll-margin-top: 80px;
}
.tb-d8me__chat-placeholder {
    margin-top: 3rem;
    padding: 1.5rem 1.75rem;
    background: rgba(255, 255, 255, .03);
    border: 1px dashed rgba(255, 255, 255, .12);
    border-radius: var(--d8-radius);
    color: var(--d8-text-mut);
    line-height: 1.55;
}
.tb-d8me__chat-placeholder strong {
    display: block;
    color: var(--d8-pink-2);
    margin-bottom: .35rem;
}

/* Hinweis-Boxen (pending/canceled/failed) */
.tb-d8me__notice {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    border-radius: var(--d8-radius);
    display: flex;
    flex-direction: column;
    gap: .25rem;
    line-height: 1.5;
}
.tb-d8me__notice strong { color: var(--d8-text); }
.tb-d8me__notice--pending {
    background: linear-gradient(135deg, rgba(34, 211, 238, .15) 0%, rgba(168, 85, 247, .12) 100%);
    border: 1px solid rgba(34, 211, 238, .35);
    color: #c7eaf3;
}
.tb-d8me__notice--canceled {
    background: rgba(245, 158, 11, .12);
    border: 1px solid rgba(245, 158, 11, .35);
    color: #fde68a;
}
.tb-d8me__notice--failed {
    background: rgba(220, 38, 38, .12);
    border: 1px solid rgba(220, 38, 38, .4);
    color: #fecaca;
}
.tb-d8me__notice-meta { font-size: .85em; opacity: .85; }
.tb-d8me__notice code {
    background: rgba(0, 0, 0, .4);
    padding: .1em .4em;
    border-radius: 4px;
    color: var(--d8-pink-2);
}

/* Markierter aktiver Girl-Button (zeigt wer gerade im Chat unten ist) */
.tb-d8me__btn--primary.is-active {
    background: linear-gradient(135deg, var(--d8-cyan) 0%, var(--d8-purple) 100%);
    box-shadow: 0 6px 24px rgba(34, 211, 238, .4);
    cursor: default;
}

/* Chat-Footer mit Kaufen-Button, dezent unter dem Chat */
.tb-d8me__chat-footer {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 2rem;
    padding: 1.25rem 0 0;
    border-top: 1px dashed rgba(255, 255, 255, .08);
}
.tb-d8me__chat-footer .tb-d8me__chat-hint {
    margin: 0;
    padding: 0;
    font-size: .8em;
    color: var(--d8-text-mut);
}
.tb-d8me__btn--buy {
    text-decoration: none;
    display: inline-block;
    line-height: 1;
}
.tb-d8me__btn--buy::before {
    content: '+ ';
    opacity: .9;
}

/* Placeholder bekommt zentrierten Inhalt und prominenten Kauf-Button */
.tb-d8me__chat-placeholder {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .75rem;
}
.tb-d8me__chat-placeholder p { margin: 0; }

/* Typing-Indicator: drei pulsierende Punkte als "schreibt gerade" */
.tb-d8me__chat-msg--typing {
    align-self: flex-start;
    background: var(--d8-bg-card);
    color: var(--d8-text-mut);
    border: 1px solid rgba(255, 255, 255, .06);
    border-bottom-left-radius: 4px;
    padding: .75rem 1rem;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}
.tb-d8me__chat-msg--typing::before {
    content: attr(data-name);
    margin-right: .25rem;
    font-size: .85em;
    color: hsl(var(--ring-hue), 80%, 70%);
    font-weight: 600;
}
.tb-d8me__typing-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--d8-pink-2);
    animation: tb-d8me-bounce 1.2s ease-in-out infinite;
}
.tb-d8me__typing-dot:nth-child(2) { animation-delay: .2s; }
.tb-d8me__typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes tb-d8me-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: .4; }
    40%           { transform: translateY(-4px); opacity: 1; }
}

/* Inaktive Session: keine Eingabe, klare Ansage */
.tb-d8me__chat-inactive {
    padding: 1.5rem 1.75rem;
    margin: .5rem 1rem;
    background: rgba(245, 158, 11, .1);
    border: 1px dashed rgba(245, 158, 11, .35);
    border-radius: 12px;
    color: #fde68a;
    line-height: 1.55;
}
.tb-d8me__chat-inactive strong {
    display: block;
    color: #fbbf24;
    margin-bottom: .25rem;
}

/* Inline-Kaufen-Button im Chat-Log (z.B. nach Fehler) */
.tb-d8me__chat-msg--system .tb-d8me__btn--buy {
    margin-top: .5rem;
    display: inline-block;
    text-decoration: none;
}
