/* tb-artificial-payment Frontend Styles */

.tb-ap, .tb-ap-session {
    --ap-blue:     #2563eb;
    --ap-blue-2:   #1d4ed8;
    --ap-bg-soft:  #f0f5ff;
    --ap-border:   #e0e7ff;
    --ap-ink:      #1a1a2e;
    --ap-muted:    #6b7280;
    --ap-radius:   14px;
    --ap-shadow:   0 4px 24px rgba(37, 99, 235, .08);
    --ap-coin-bg:  radial-gradient(circle, #dbeafe 0%, #93c5fd 100%);
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 1rem 5rem;
    color: var(--ap-ink);
}

/* ─────────── LANDING ─────────── */

.tb-ap__hero {
    text-align: center;
    padding: 2rem 0 3rem;
}
.tb-ap__hero-logo {
    max-width: 180px;
    height: auto;
    display: block;
    margin: 0 auto 1rem;
}
.tb-ap__hero-claim {
    font-size: clamp(1.2rem, 3vw, 1.55rem);
    margin: .5rem auto 1rem;
    max-width: 720px;
}
.tb-ap__hero-sub {
    max-width: 720px;
    margin: 0 auto;
    color: var(--ap-muted);
}

.tb-ap__section-title {
    margin: 2.5rem 0 1rem;
    font-size: 1.35rem;
    color: var(--ap-ink);
    border-left: 4px solid var(--ap-blue);
    padding-left: .75rem;
}

.tb-ap__bundles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
}

.tb-ap__bundle {
    position: relative;
    background: #fff;
    border: 2px solid var(--ap-border);
    border-radius: var(--ap-radius);
    padding: 1.5rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: .65rem;
    text-align: center;
    transition: border-color .2s ease, transform .2s ease;
}
.tb-ap__bundle.is-selected {
    border-color: var(--ap-blue);
    transform: translateY(-2px);
    box-shadow: var(--ap-shadow);
}
.tb-ap__bundle-badge {
    position: absolute;
    top: -10px;
    right: 12px;
    background: var(--ap-blue);
    color: #fff;
    font-size: .8em;
    font-weight: 700;
    padding: .25em .75em;
    border-radius: 999px;
}
.tb-ap__bundle-img {
    width: 140px;
    height: 140px;
    margin: 0 auto;
    object-fit: contain;
}
.tb-ap__bundle-title { margin: 0; font-size: 1.2rem; }
.tb-ap__bundle-tagline { margin: 0; color: var(--ap-muted); font-size: .92em; }
.tb-ap__bundle-price { margin: 0; font-size: 1.5rem; color: var(--ap-blue); }
.tb-ap__bundle-highlights {
    text-align: left;
    margin: .5rem 0 1rem;
    padding-left: 1.2rem;
    color: var(--ap-ink);
    font-size: .92em;
    line-height: 1.55;
}

.tb-ap__themes {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.tb-ap__theme-group {
    background: #fff;
    border: 1px solid var(--ap-border);
    border-radius: var(--ap-radius);
    padding: .5rem 1rem;
}
.tb-ap__theme-group[open] {
    border-color: var(--ap-blue);
}
.tb-ap__theme-group-title {
    font-weight: 700;
    cursor: pointer;
    padding: .5rem 0;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.tb-ap__theme-group-title::-webkit-details-marker { display: none; }
.tb-ap__theme-group-count {
    background: var(--ap-bg-soft);
    color: var(--ap-blue);
    padding: .15em .65em;
    border-radius: 999px;
    font-size: .8em;
    font-weight: 600;
}
.tb-ap__theme-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: .5rem;
    padding: .75rem 0;
}
.tb-ap__theme-item {
    appearance: none;
    text-align: left;
    background: #fff;
    border: 1px solid var(--ap-border);
    border-radius: 8px;
    padding: .65rem .9rem;
    cursor: pointer;
    font-size: .92em;
    transition: background .15s ease, border-color .15s ease;
}
.tb-ap__theme-item:hover { background: var(--ap-bg-soft); }
.tb-ap__theme-item.is-selected {
    background: var(--ap-blue);
    color: #fff;
    border-color: var(--ap-blue);
}

.tb-ap__themes-intro {
    color: var(--ap-muted);
    max-width: 720px;
}

.tb-ap__form {
    background: var(--ap-bg-soft);
    border-radius: var(--ap-radius);
    padding: 1.5rem;
    margin-top: 2rem;
}
.tb-ap__form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .9rem;
}
.tb-ap__field { display: flex; flex-direction: column; gap: .3rem; }
.tb-ap__field--wide { grid-column: 1 / -1; }
.tb-ap__field > span { font-weight: 600; font-size: .92em; color: var(--ap-ink); }
.tb-ap__field input {
    border: 1px solid var(--ap-border);
    border-radius: 8px;
    padding: .65rem .85rem;
    background: #fff;
    font: inherit;
}

.tb-ap__summary {
    background: #fff;
    border: 1px solid var(--ap-border);
    border-radius: 8px;
    padding: .85rem 1rem;
    margin: 1.5rem 0 0;
}

.tb-ap__form-error {
    background: #fef2f2;
    border-left: 4px solid #dc2626;
    color: #991b1b;
    padding: .75rem 1rem;
    border-radius: 8px;
    margin: 1rem 0 0;
    font-weight: 500;
}

.tb-ap__field--voucher input {
    text-transform: lowercase;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    letter-spacing: .02em;
}

.tb-ap__voucher-hint {
    display: block;
    margin-top: .35rem;
    color: var(--ap-muted);
    font-size: .85em;
    min-height: 1.2em;
}
.tb-ap__voucher-hint.is-active {
    color: var(--ap-blue-2);
    font-weight: 600;
}
.tb-ap__small {
    color: var(--ap-muted);
    font-size: .87em;
    margin: 1rem 0 0;
}

.tb-ap__btn {
    appearance: none;
    border: 0;
    border-radius: 8px;
    padding: .7rem 1.2rem;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.tb-ap__btn--primary { background: var(--ap-blue); color: #fff; }
.tb-ap__btn--primary:hover { background: var(--ap-blue-2); }
.tb-ap__btn--primary:disabled { background: #cbd5e1; cursor: not-allowed; }
.tb-ap__btn--submit {
    margin-top: 1.25rem;
    padding: 1rem 1.5rem;
    width: 100%;
    font-size: 1.05rem;
}

@media (max-width: 600px) {
    .tb-ap__bundles, .tb-ap__theme-items, .tb-ap__form-grid {
        grid-template-columns: 1fr;
    }
}

/* ─────────── SESSION ─────────── */

.tb-ap-session__head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #1e293b 0%, #1e3a8a 100%);
    color: #fff;
    border-radius: var(--ap-radius);
    margin-bottom: 1.5rem;
}
.tb-ap-session__meta { font-weight: 600; }
.tb-ap-session__sep { opacity: .5; margin: 0 .25em; }
.tb-ap-session__indicators {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}
.tb-ap-session__indicator { display: flex; flex-direction: column; }
.tb-ap-session__indicator-label {
    font-size: .72em; text-transform: uppercase; letter-spacing: .07em;
    opacity: .7;
}
.tb-ap-session__indicator strong {
    font-size: 1.3rem;
    font-variant-numeric: tabular-nums;
}
.tb-ap-session__credits-of { opacity: .55; font-weight: 400; font-size: .85em; }

.tb-ap-session__main {
    display: grid;
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: stretch;
}
@media (max-width: 960px) {
    .tb-ap-session__main { grid-template-columns: 1fr; }
}

.tb-ap-session__viz {
    position: relative;
    background: radial-gradient(circle at 50% 35%, #1e3a8a 0%, #0f172a 60%, #020617 100%);
    border-radius: var(--ap-radius);
    padding: 2rem 1.25rem;
    overflow: hidden;
    min-height: 380px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
}

.tb-ap-session__viz-rings {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.tb-ap-session__viz-ring {
    position: absolute;
    border: 2px solid rgba(59, 130, 246, .35);
    border-radius: 50%;
    animation: tb-ap-ring 4s ease-out infinite;
    width: 80px; height: 80px;
    opacity: 0;
}
.tb-ap-session__viz-ring--2 { animation-delay: 1.3s; }
.tb-ap-session__viz-ring--3 { animation-delay: 2.6s; }
@keyframes tb-ap-ring {
    0%   { transform: scale(.6); opacity: 0; }
    20%  { opacity: .9; }
    100% { transform: scale(3.5); opacity: 0; }
}

.tb-ap-session__viz-coin {
    width: 110px; height: 110px;
    border-radius: 50%;
    object-fit: cover;
    z-index: 1;
    box-shadow: 0 0 60px rgba(59, 130, 246, .5);
    animation: tb-ap-coin-idle 6s ease-in-out infinite;
}
.tb-ap-session[data-ap-state="active"] .tb-ap-session__viz-coin {
    animation: tb-ap-coin-active 1.4s ease-in-out infinite;
}
.tb-ap-session[data-ap-state="paused"] .tb-ap-session__viz-coin {
    animation: none;
    filter: grayscale(.6) brightness(.7);
}
.tb-ap-session[data-ap-state="finished"] .tb-ap-session__viz-coin {
    animation: none;
    filter: grayscale(1) brightness(.5);
}
@keyframes tb-ap-coin-idle {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}
@keyframes tb-ap-coin-active {
    0%, 100% { transform: scale(1); box-shadow: 0 0 60px rgba(59,130,246,.5); }
    50%      { transform: scale(1.04); box-shadow: 0 0 90px rgba(59,130,246,.9); }
}

.tb-ap-session__viz-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.tb-ap-session__viz-particle {
    position: absolute;
    top: 50%; left: 50%;
    width: 6px; height: 6px;
    background: #93c5fd;
    border-radius: 50%;
    opacity: 0;
    box-shadow: 0 0 8px #60a5fa;
}
.tb-ap-session[data-ap-state="active"] .tb-ap-session__viz-particle {
    animation: tb-ap-particle 3.5s linear infinite;
}
.tb-ap-session__viz-particle:nth-child(1) { animation-delay: 0s;   --angle:   0deg; }
.tb-ap-session__viz-particle:nth-child(2) { animation-delay: .4s;  --angle:  45deg; }
.tb-ap-session__viz-particle:nth-child(3) { animation-delay: .8s;  --angle:  90deg; }
.tb-ap-session__viz-particle:nth-child(4) { animation-delay: 1.2s; --angle: 135deg; }
.tb-ap-session__viz-particle:nth-child(5) { animation-delay: 1.6s; --angle: 180deg; }
.tb-ap-session__viz-particle:nth-child(6) { animation-delay: 2.0s; --angle: 225deg; }
.tb-ap-session__viz-particle:nth-child(7) { animation-delay: 2.4s; --angle: 270deg; }
.tb-ap-session__viz-particle:nth-child(8) { animation-delay: 2.8s; --angle: 315deg; }
@keyframes tb-ap-particle {
    0%   { transform: rotate(var(--angle)) translateX(20px) scale(.5); opacity: 0; }
    20%  { opacity: 1; }
    100% { transform: rotate(var(--angle)) translateX(160px) scale(0); opacity: 0; }
}

.tb-ap-session__viz-controls {
    z-index: 2;
    display: flex;
    gap: .5rem;
    margin-top: 1rem;
}
.tb-ap-session__ctl {
    appearance: none;
    background: rgba(255,255,255,.1);
    color: #fff;
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 8px;
    padding: .55rem 1.1rem;
    cursor: pointer;
    font-weight: 600;
    transition: background .15s ease;
}
.tb-ap-session__ctl:hover { background: rgba(255,255,255,.18); }
.tb-ap-session__ctl--stop { border-color: rgba(248,113,113,.5); color: #fecaca; }
.tb-ap-session__ctl--stop:hover { background: rgba(248,113,113,.18); }

.tb-ap-session__viz-cost {
    z-index: 2;
    color: rgba(255,255,255,.6);
    font-size: .82em;
    margin: 1rem 0 0;
    text-align: center;
}

.tb-ap-session__chat {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--ap-border);
    border-radius: var(--ap-radius);
    overflow: hidden;
    min-height: 380px;
    min-width: 0;
}
.tb-ap-session__chat-log {
    flex: 1;
    padding: 1rem 1.25rem;
    overflow-y: auto;
    max-height: 480px;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}
.tb-ap-session__msg {
    padding: .65rem 1rem;
    border-radius: 12px;
    max-width: 85%;
    white-space: pre-wrap;
    line-height: 1.55;
}
.tb-ap-session__msg--user {
    background: var(--ap-blue);
    color: #fff;
    align-self: flex-end;
}
.tb-ap-session__msg--bot {
    background: var(--ap-bg-soft);
    color: var(--ap-ink);
    align-self: flex-start;
}
.tb-ap-session__msg--system {
    background: #fef9c3;
    color: #713f12;
    align-self: center;
    font-size: .9em;
}
.tb-ap-session__msg--cost {
    font-size: .75em;
    color: var(--ap-muted);
    align-self: flex-start;
    background: transparent;
    padding: 0 .5rem;
}
.tb-ap-session__chat-form {
    display: flex;
    border-top: 1px solid var(--ap-border);
    padding: .75rem;
    gap: .5rem;
}
.tb-ap-session__chat-input {
    flex: 1 1 0;
    min-width: 0;
    padding: .65rem .85rem;
    border-radius: 8px;
    border: 1px solid var(--ap-border);
    font: inherit;
}
.tb-ap-session__btn--send {
    flex: 0 0 auto;
}
.tb-ap-session__btn--send {
    appearance: none;
    background: var(--ap-blue);
    color: #fff;
    border: 0;
    padding: .65rem 1.1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}
.tb-ap-session__btn--send:disabled { background: #cbd5e1; cursor: not-allowed; }

.tb-ap-session__topup {
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem 1.25rem;
    background: var(--ap-bg-soft);
    border-radius: var(--ap-radius);
}
.tb-ap-session__topup-btn {
    background: var(--ap-blue);
    color: #fff;
    text-decoration: none;
    padding: .65rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    transition: background .15s ease;
}
.tb-ap-session__topup-btn:hover { background: var(--ap-blue-2); color: #fff; }
.tb-ap-session__topup-hint {
    color: var(--ap-muted);
    font-size: .9em;
}

.tb-ap-session__hint {
    color: var(--ap-muted);
    font-size: .85em;
    margin-top: 1.25rem;
}

/* d8me-Brücke: Hinweis oben + Button am Ende der Session */
.tb-ap__hero-d8me {
    background: linear-gradient(135deg, rgba(255, 61, 138, .15) 0%, rgba(168, 85, 247, .15) 100%);
    border: 1px solid rgba(255, 61, 138, .25);
    border-radius: 8px;
    padding: .75rem 1rem;
    margin: 1rem auto;
    max-width: 640px;
    color: #1a1a2e;
}
.tb-ap__hero-d8me a { color: #ff3d8a; font-weight: 600; }

.tb-ap-session__d8me {
    margin-top: 1rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(255, 61, 138, .08) 0%, rgba(168, 85, 247, .08) 100%);
    border: 1px solid rgba(255, 61, 138, .2);
    border-radius: var(--tb-shop-radius, 12px);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.tb-ap-session__d8me-btn {
    background: linear-gradient(135deg, #ff3d8a 0%, #a855f7 100%);
    color: #fff !important;
    text-decoration: none;
    padding: .65rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
}
.tb-ap-session__d8me-btn:hover { filter: brightness(1.1); color: #fff !important; }
.tb-ap-session__d8me-hint { color: var(--ap-muted, #6b7280); font-size: .9em; }
