/*!
 * HiData Support PIN — client area styles
 *
 * Colours are expressed as translucent overlays on top of whatever the theme
 * provides, and text inherits currentColor, so the panel looks correct in Lagom
 * (light and dark styles), Twenty-One and Six without any theme edits.
 */

.supportpin-panel {
    --sp-accent: #2f7fd1;
    --sp-surface: rgba(125, 145, 178, 0.10);
    --sp-surface-strong: rgba(125, 145, 178, 0.18);
    --sp-border: rgba(125, 145, 178, 0.30);
    --sp-radius: 10px;
    text-align: center;
}

.supportpin-panel--rtl {
    direction: rtl;
}

/* ------------------------------------------------------------------ */
/* Text                                                                */
/* ------------------------------------------------------------------ */

.supportpin-panel__intro {
    margin: 0 0 14px;
    font-size: 13px;
    line-height: 1.7;
    opacity: 0.78;
}

.supportpin-panel__meta {
    margin: 12px 0 0;
    font-size: 11.5px;
    line-height: 1.8;
    opacity: 0.62;
}

.supportpin-panel__warning {
    margin: 10px 0 0;
    font-size: 11.5px;
    line-height: 1.7;
    opacity: 0.72;
}

.supportpin-panel__warning i {
    margin-inline-end: 4px;
}

.supportpin-panel__empty {
    margin: 0;
    padding: 18px 0;
    font-size: 13px;
    opacity: 0.7;
}

/* ------------------------------------------------------------------ */
/* The code itself                                                     */
/* ------------------------------------------------------------------ */

.supportpin-display {
    margin: 4px 0 14px;
}

.supportpin-code {
    display: inline-block;
    min-width: 190px;
    padding: 12px 20px;
    border: 1px solid var(--sp-border);
    border-radius: var(--sp-radius);
    background: var(--sp-surface);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 30px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 6px;
    /* The code is always Latin digits, even on an RTL page. */
    direction: ltr;
    unicode-bidi: isolate;
    user-select: all;
    -webkit-user-select: all;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

/*
 * Only the ink changes when the code is hidden, never the metrics. The mask has
 * the same character count as the grouped code and the face is monospace, so as
 * long as both states share a letter-spacing the box keeps its size and the
 * panel does not jump as the reader toggles it.
 */
.supportpin-code.is-masked {
    opacity: 0.75;
}

.supportpin-code.is-flashing {
    background: var(--sp-surface-strong);
    border-color: var(--sp-accent);
}

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */

.supportpin-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.supportpin-actions form {
    margin: 0;
}

/*
 * The buttons carry the theme's .btn classes, so their colour, weight, radius
 * and size come from the theme. Nothing here may set any of those, or the panel
 * goes back to looking like a foreign object: the only thing the module still
 * owns is the transient busy state, which no theme has a class for.
 */
.supportpin-btn.is-busy {
    opacity: 0.55;
    cursor: default;
}

/* ------------------------------------------------------------------ */
/* Inline messages                                                     */
/* ------------------------------------------------------------------ */

.supportpin-flash {
    margin: 0 0 12px;
    padding: 8px 12px;
    border: 1px solid var(--sp-border);
    border-radius: 6px;
    background: var(--sp-surface);
    font-size: 12.5px;
    line-height: 1.6;
}

.supportpin-flash--success {
    border-color: rgba(46, 160, 100, 0.45);
    background: rgba(46, 160, 100, 0.10);
}

.supportpin-flash--warning {
    border-color: rgba(224, 158, 44, 0.45);
    background: rgba(224, 158, 44, 0.10);
}

.supportpin-flash--danger {
    border-color: rgba(214, 74, 74, 0.45);
    background: rgba(214, 74, 74, 0.10);
}

/* ------------------------------------------------------------------ */
/* Sidebar variant                                                     */
/* ------------------------------------------------------------------ */

/*
 * The right-hand column is around 280px wide and themes give a hook-added
 * sidebar panel a full-bleed body with no padding of its own, so the panel
 * supplies its own inset and steps the code down to a size that still fits
 * once the column narrows on a laptop screen.
 */

.supportpin-panel--sidebar {
    padding: 2px 16px 4px;
}

.supportpin-panel--sidebar .supportpin-panel__intro {
    margin-bottom: 12px;
    font-size: 12px;
    line-height: 1.6;
}

.supportpin-panel--sidebar .supportpin-display {
    margin: 2px 0 12px;
}

.supportpin-panel--sidebar .supportpin-code {
    display: block;
    min-width: 0;
    padding: 10px 8px;
    font-size: 24px;
    letter-spacing: 4px;
}

/* btn-block already fills the row, so the actions just stack. */
.supportpin-panel--sidebar .supportpin-actions {
    display: block;
}

.supportpin-panel--sidebar .supportpin-actions > * {
    margin: 0 0 8px;
}

.supportpin-panel--sidebar .supportpin-actions > *:last-child {
    margin-bottom: 0;
}

.supportpin-panel--sidebar .supportpin-panel__meta,
.supportpin-panel--sidebar .supportpin-panel__warning {
    font-size: 11px;
    line-height: 1.7;
}

/*
 * Lagom styles cards with `.panel:not(.panel-sidebar)` and deliberately leaves
 * sidebar panels chromeless, so the box would otherwise float on the page with
 * no surface at all. --panel-bg is the theme's own card colour, so this follows
 * its light and dark styles rather than hard-coding white; the shadow is what
 * actually separates a card from the page there, since the page is white too.
 * The 6px radius already comes from the theme's own .panel rule.
 *
 * supportpin.css loads after the theme's stylesheets, so matching Lagom's
 * `.panel-sidebar:not(.panel-summary)` specificity is enough — no !important.
 */
.panel-sidebar.panel-supportpin {
    background: var(--panel-bg, var(--card-bg, #fff));
    box-shadow: 0 0 1px rgba(0, 0, 0, 0.10), 0 2px 24px rgba(0, 0, 0, 0.08);
}

/* A chromeless sidebar heading has no inset of its own to sit on. */
.panel-sidebar.panel-supportpin > .panel-heading {
    padding: 16px 16px 6px;
}

.panel-supportpin .supportpin-panel--sidebar {
    padding: 2px 16px 14px;
}

/* Very narrow columns: let the code shrink rather than spill out. */
@media (max-width: 1200px) {
    .supportpin-panel--sidebar .supportpin-code {
        font-size: 21px;
        letter-spacing: 3px;
    }
}

/* ------------------------------------------------------------------ */
/* Small screens                                                       */
/* ------------------------------------------------------------------ */

@media (max-width: 480px) {
    .supportpin-code {
        font-size: 24px;
        letter-spacing: 4px;
        min-width: 0;
        padding: 10px 14px;
    }

    /* One per row on a phone; .btn brings its own centring. */
    .supportpin-actions > * {
        flex: 1 1 100%;
    }
}
