/* ---------------------------------------------------------------------------
 * postback.css — styles for the Telegram Postback Generator page only.
 *
 * A separate stylesheet rather than an addition to style.css: this page is the
 * only thing that uses any of it, and keeping it out of the sitewide sheet
 * means every other page carries none of the weight.
 *
 * All colours come from the variables already defined in style.css, so the
 * tool follows the site theme without redefining a single one.
 * ------------------------------------------------------------------------- */

.pb-tool {
    max-width: 760px;
    margin: 0 auto;
}

.pb-hidden {
    display: none !important;
}

/* --- steps ---------------------------------------------------------------- */

.pb-step {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    margin-bottom: 1.25rem;
}

.pb-step-head {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1.25rem;
}

.pb-step-head h2 {
    font-size: 1.15rem;
    margin: 0;
}

.pb-num {
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: #04121c;
    background: var(--grad);
}

.pb-step label {
    display: block;
    margin: 0 0 0.4rem;
    font-weight: 600;
    font-size: 0.92rem;
}

.pb-step input[type="text"] {
    width: 100%;
    padding: 0.8rem 0.95rem;
    margin-bottom: 1.1rem;
    background: var(--bg-alt);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    color: var(--text);
    font: inherit;
}

.pb-step input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18);
}

#pb-token {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88rem;
}

.pb-optional {
    font-weight: 400;
    color: var(--muted);
}

.pb-hint {
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.6;
    margin: 0.85rem 0 1.1rem;
}

.pb-hint code {
    background: var(--bg-alt);
    padding: 0.1rem 0.35rem;
    border-radius: 5px;
    font-size: 0.85em;
}

/* --- reassurance + Bengali guide ------------------------------------------ */

/*
 * Bengali needs noticeably more leading than Latin at the same size, and the
 * site font has no Bengali glyphs at all — without this the browser picks a
 * fallback per-character and the paragraphs come out ragged.
 */
.pb-bn,
.pb-bn-inline {
    font-family: 'Noto Sans Bengali', 'Nirmala UI', 'Shonar Bangla', 'Vrinda', sans-serif;
    line-height: 1.95;
}

.pb-bn {
    max-width: 760px;
    margin: 0 auto 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.4rem;
}

.pb-bn[open] {
    border-color: var(--border-strong);
}

.pb-bn > summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    list-style: none;
}

.pb-bn > summary::-webkit-details-marker {
    display: none;
}

.pb-bn > summary::after {
    content: " ▾";
    color: var(--muted);
}

.pb-bn[open] > summary::after {
    content: " ▴";
}

.pb-bn-en {
    font-family: inherit;
    font-weight: 400;
    color: var(--muted);
    font-size: 0.88rem;
}

.pb-bn-body {
    margin-top: 1.3rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--border);
    font-size: 0.93rem;
}

.pb-bn-body h3 {
    font-size: 1rem;
    margin: 1.6rem 0 0.7rem;
}

.pb-bn-body h3:first-child {
    margin-top: 0;
}

.pb-bn-body ol,
.pb-bn-body ul {
    margin: 0 0 1rem;
    padding-left: 1.35rem;
    color: var(--muted);
}

.pb-bn-body li {
    margin-bottom: 0.55rem;
}

.pb-bn-body li strong,
.pb-bn-body p strong {
    color: var(--text);
}

.pb-bn-body code {
    background: var(--bg-alt);
    padding: 0.1rem 0.35rem;
    border-radius: 5px;
    font-size: 0.85em;
}

.pb-bn-body > p {
    color: var(--muted);
    margin: 0 0 1rem;
}

/* The block that answers "is this safe" — tinted so it reads as an answer
   rather than more instructions. */
.pb-safe-box {
    background: var(--bg-alt);
    border: 1px solid var(--border-strong);
    border-left: 3px solid var(--accent);
    border-radius: 12px;
    padding: 1.1rem 1.3rem;
    margin-bottom: 1.6rem;
}

.pb-safe-box h3 {
    margin: 0 0 0.7rem !important;
    font-size: 0.98rem;
}

.pb-safe-box p {
    color: var(--muted);
    margin: 0 0 0.8rem;
}

.pb-bn-note {
    margin-bottom: 0 !important;
    font-size: 0.88rem;
}

/* One-line version of the same promise, sitting where the visitor actually
   decides whether to paste the token. */
.pb-safe {
    margin: 0 0 1.2rem;
    padding: 0.75rem 0.95rem;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 11px;
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.65;
}

.pb-bn-inline {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.88rem;
}

.pb-manual {
    margin-top: 1.1rem;
    padding: 0.85rem 1rem;
    background: var(--bg-alt);
    border: 1px dashed var(--border-strong);
    border-radius: 11px;
    color: var(--muted);
    font-size: 0.87rem;
    line-height: 1.7;
}

.pb-manual strong {
    color: var(--text);
}

.pb-manual code {
    background: var(--surface-solid);
    border: 1px solid var(--border);
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85em;
    color: var(--text);
}

/* .btn.tiny is defined in admin.css only, which the public pages never load —
   so the small size has to be set here or this button sits full-height in the
   middle of a sentence. */
.pb-manual .btn {
    padding: 0.3rem 0.7rem;
    font-size: 0.78rem;
    vertical-align: middle;
}

/* --- messages ------------------------------------------------------------- */

.pb-msg {
    margin-top: 0.9rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.pb-msg:empty {
    margin-top: 0;
}

.pb-msg-ok {
    color: var(--success);
}

.pb-msg-error {
    color: var(--error);
}

.pb-msg-info {
    color: var(--muted);
}

/* --- waiting spinner ------------------------------------------------------ */

.pb-waiting {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 1.1rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.pb-spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--border-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: pb-spin 0.8s linear infinite;
}

@keyframes pb-spin {
    to { transform: rotate(360deg); }
}

/* Respect a visitor who has asked the system for less motion. */
@media (prefers-reduced-motion: reduce) {
    .pb-spinner { animation-duration: 2.4s; }
}

/* --- result --------------------------------------------------------------- */

.pb-connected {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    margin-bottom: 1.1rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--success);
    background: var(--success-bg);
}

.pb-connected::before {
    content: "✓ ";
}

.pb-url-box {
    display: flex;
    align-items: stretch;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.pb-url-box code {
    flex: 1 1 320px;
    min-width: 0;
    padding: 0.85rem 1rem;
    background: var(--bg-alt);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--text);
    /* The URL is one long unbroken string; without this it forces the whole
       page into a horizontal scroll on a phone. */
    word-break: break-all;
}

.pb-actions {
    margin-top: 1rem;
}

/* --- field picker --------------------------------------------------------- */

.pb-options {
    margin-top: 1.6rem;
    border-top: 1px solid var(--border);
    padding-top: 1.2rem;
}

.pb-options summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.92rem;
}

.pb-field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.6rem;
    margin: 1.1rem 0 0.4rem;
}

.pb-field {
    display: flex !important;
    align-items: center;
    gap: 0.55rem;
    padding: 0.6rem 0.75rem;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 11px;
    cursor: pointer;
    font-weight: 500 !important;
    font-size: 0.88rem;
    margin: 0 !important;
}

.pb-field:hover {
    border-color: var(--border-strong);
}

.pb-field input {
    accent-color: var(--accent);
    cursor: pointer;
}

.pb-emoji {
    font-size: 1.05rem;
    line-height: 1;
}

/* --- closing instructions ------------------------------------------------- */

.pb-final {
    margin-top: 1.6rem;
    padding-top: 1.3rem;
    border-top: 1px solid var(--border);
}

.pb-final h3 {
    font-size: 1rem;
    margin: 0 0 0.75rem;
}

.pb-final ol {
    margin: 0;
    padding-left: 1.25rem;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.9;
}

/* --- message preview ------------------------------------------------------ */

.pb-preview-wrap {
    max-width: 760px;
    margin: 2.5rem auto 0;
}

.pb-preview-wrap h3 {
    font-size: 1rem;
    margin-bottom: 0.85rem;
}

.pb-preview {
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.1rem 1.25rem;
    font-size: 0.92rem;
    line-height: 1.85;
    white-space: pre-wrap;
}

.pb-preview-body {
    color: var(--muted);
}

.pb-privacy {
    max-width: 760px;
    margin: 2rem auto 0;
    font-size: 0.88rem;
    line-height: 1.7;
}

.pb-privacy p:last-child {
    margin-bottom: 0;
}

@media (max-width: 640px) {
    .pb-step { padding: 1.25rem; }
    .pb-url-box code { font-size: 0.74rem; }
}
