/**
 * 2026-present BestCoding
 * Front-office styles for the withdrawal flow. Flat, monochrome, editorial
 * (Zalando-inspired): white surfaces, hairline rules, square corners, a single
 * near-black accent for CTAs and selection. Everything is scoped under
 * .bcrefunds-* so nothing leaks into the host theme, and the whole palette is
 * driven by CSS variables — a shop can re-brand by overriding --bcr-accent.
 */

.bcrefunds-form,
.bcrefunds-confirmation,
.bcrefunds-history,
.bcrefunds-errors {
    --bcr-accent: #111111;        /* CTAs, checked boxes — override to re-brand */
    --bcr-accent-strong: #000000;
    --bcr-ink: #111111;
    --bcr-muted: #6b6b6b;
    --bcr-card: #ffffff;
    --bcr-line: #e6e6e6;
    --bcr-soft: #f5f5f5;
    --bcr-bg: #ffffff;
    --bcr-ok: #1a7f4b;
    --bcr-warn: #8a5a00;
    --bcr-danger: #b42318;
    --bcr-radius: 2px;
    --bcr-radius-sm: 2px;

    max-width: 980px;
    margin: 1.25rem auto 3rem;
    color: var(--bcr-ink);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* ---- headings ------------------------------------------------------ */
.bcrefunds-form,
.bcrefunds-confirmation,
.bcrefunds-history,
.bcrefunds-errors { font-size: 1rem; }

/* ---- intro --------------------------------------------------------- */
.bcrefunds-lead {
    color: var(--bcr-muted);
    font-size: 1rem;
    margin: .25rem 0 1.75rem;
    max-width: 62ch;
}
.bcrefunds-empty {
    background: var(--bcr-soft);
    padding: 1.1rem 1.25rem;
    color: var(--bcr-ink);
    margin: .5rem 0 1.25rem;
}
.bcrefunds-empty__hint { display: block; margin-top: .4rem; font-size: .9rem; color: var(--bcr-muted); }

/* ---- guest session banner ------------------------------------------ */
.bcrefunds-session-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    background: var(--bcr-soft);
    padding: .6rem 1rem;
    font-size: .92rem;
    color: var(--bcr-ink);
    margin: 0 0 1.5rem;
}
.bcrefunds-session-banner strong { color: var(--bcr-ink); }
.bcrefunds-end-session {
    margin-left: auto;
    background: #fff;
    border: 1px solid var(--bcr-ink);
    padding: .35rem .9rem;
    font-size: .82rem;
    text-decoration: none;
    color: var(--bcr-ink);
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    transition: background .15s, color .15s;
}
.bcrefunds-end-session:hover { background: var(--bcr-ink); color: #fff; }

/* ==================================================================== */
/* FORM: two-column layout (lines + sticky summary)                      */
/* ==================================================================== */
/* Single column: the product list spans the full width and the summary box
   (item count + confirm button) sits at the very bottom. */
.bcrefunds-form__grid { display: block; }

/* ---- order group --------------------------------------------------- */
.bcrefunds-order {
    border: 0;
    border-top: 2px solid var(--bcr-ink);
    padding: 0;
    margin: 0 0 1.5rem;
    background: #fff;
}
.bcrefunds-order > legend {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: .5rem;
    padding: .85rem 0 .5rem;
    margin: 0;
    float: none;
}
.bcrefunds-order > legend strong { font-size: 1.05rem; color: var(--bcr-ink); font-weight: 700; }
.bcrefunds-meta { font-size: .85rem; color: var(--bcr-muted); white-space: nowrap; }

.bcrefunds-order__all {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem 0;
    border-bottom: 1px solid var(--bcr-line);
    font-size: .9rem;
    color: var(--bcr-muted);
    cursor: pointer;
    min-height: 44px;
}
.bcrefunds-order__all-check { width: 1.15rem; height: 1.15rem; min-width: 1.15rem; accent-color: var(--bcr-accent); cursor: pointer; }

/* ---- line card ----------------------------------------------------- */
.bcrefunds-line {
    display: grid;
    grid-template-columns: auto 84px minmax(0, 1fr) minmax(7rem, 10rem);
    grid-template-areas:
        "select thumb body     qty"
        "select thumb controls controls";
    gap: .35rem 1.1rem;
    align-items: start;
    padding: 1.15rem 0;
    border-top: 1px solid var(--bcr-line);
}
.bcrefunds-line__controls { grid-area: controls; min-width: 0; }
.bcrefunds-line:first-of-type { border-top: 0; }
.bcrefunds-form input:disabled,
.bcrefunds-form select:disabled { background: var(--bcr-soft); color: #aab0bf; cursor: not-allowed; }

/* --- FOUC guard ----------------------------------------------------- */
/* front.js runs after first paint, so without this the note + enabled
   fields would flash before the script hides/greys them. When JS is active
   (the .bcrefunds-js marker is set synchronously, before the form paints)
   the initial "nothing selected" state is rendered immediately: notes hidden,
   unchecked rows muted with greyed quantity/reason fields. No-JS users get the
   fully-visible, enabled fallback. JS then only toggles state on interaction. */
.bcrefunds-js .bcrefunds-line__note { display: none; }
.bcrefunds-js .bcrefunds-line--reason .bcrefunds-line__note { display: block; }
.bcrefunds-js .bcrefunds-line:not(.bcrefunds-line--on) { opacity: .55; }
.bcrefunds-js .bcrefunds-line:not(.bcrefunds-line--on) .bcrefunds-qty-select,
.bcrefunds-js .bcrefunds-line:not(.bcrefunds-line--on) .bcrefunds-reason-select {
    background: var(--bcr-soft);
    color: #aab0bf;
}
/* Confirm button dimmed until at least one item is selected (JS toggles the
   has-selection class; default-off is set before paint so there is no flash). */
.bcrefunds-js .bcrefunds-form:not(.bcrefunds-has-selection) .bcrefunds-submit {
    opacity: .45;
    cursor: not-allowed;
}

.bcrefunds-line__select { grid-area: select; display: flex; align-items: center; min-height: 44px; }
.bcrefunds-line__thumb {
    grid-area: thumb;
    width: 84px; height: 84px;
    background: var(--bcr-soft);
    overflow: hidden;
    flex: 0 0 auto;
}
.bcrefunds-line__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bcrefunds-line__body { grid-area: body; min-width: 0; }
/* Zalando-style stack: brand (bold), product name (bold), then muted attributes. */
.bcrefunds-line__brand { display: block; font-weight: 700; line-height: 1.3; }
.bcrefunds-line__title { display: block; font-weight: 700; line-height: 1.3; }
.bcrefunds-line__attrs { margin: .55rem 0 0; padding: 0; }
.bcrefunds-line__attr { display: flex; gap: .35rem; font-size: .85rem; color: var(--bcr-muted); line-height: 1.45; }
.bcrefunds-line__attr dt { margin: 0; font-weight: 400; }
.bcrefunds-line__attr dd { margin: 0; }

.bcrefunds-line__reason { margin: .75rem 0 .5rem; }
.bcrefunds-reason-select {
    width: 100%;
    max-width: 24rem;
    padding: .6rem .75rem;
    border: 1px solid var(--bcr-ink);
    border-radius: var(--bcr-radius-sm);
    background: #fff;
    color: var(--bcr-ink);
    font-size: .95rem;
    line-height: 1.3;
    cursor: pointer;
}
.bcrefunds-line__note label { display: block; font-size: .75rem; color: var(--bcr-muted); margin-bottom: .15rem; }
.bcrefunds-line__note input { max-width: 24rem; }

.bcrefunds-line__qty { grid-area: qty; text-align: right; }
/* Single-unit lines: hide the quantity control (the input stays in the DOM with
   value 1 so the line still submits when selected). */
.bcrefunds-line__qty--single { display: none; }
.bcrefunds-line__qty label { display: block; font-size: .75rem; color: var(--bcr-muted); margin-bottom: .15rem; }
.bcrefunds-qty-select {
    width: 100%;
    max-width: 10rem;
    margin-left: auto;
    padding: .55rem .6rem;
    border: 1px solid var(--bcr-ink);
    border-radius: var(--bcr-radius-sm);
    background: #fff;
    color: var(--bcr-ink);
    font-size: .95rem;
    line-height: 1.3;
    cursor: pointer;
}

/* ---- square checkbox ----------------------------------------------- */
.bcrefunds-line__check {
    appearance: none;
    -webkit-appearance: none;
    width: 1.5rem;
    height: 1.5rem;
    min-width: 1.5rem;
    flex: 0 0 auto;
    border: 2px solid var(--bcr-ink);
    border-radius: var(--bcr-radius-sm);
    background: #fff;
    cursor: pointer;
    position: relative;
    transition: background .12s, border-color .12s;
}
.bcrefunds-line__check:checked { background: var(--bcr-accent); border-color: var(--bcr-accent); }
.bcrefunds-line__check:checked::after {
    content: "";
    position: absolute;
    left: 7px; top: 2px;
    width: 5px; height: 11px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ---- shared reason fieldset ---------------------------------------- */
.bcrefunds-reason {
    border: 0;
    border-top: 1px solid var(--bcr-line);
    padding: 1.25rem 0 0;
    margin: 1rem 0 0;
}
.bcrefunds-reason > legend {
    font-size: .95rem;
    font-weight: 700;
    color: var(--bcr-ink);
    padding: 0;
    width: auto;
    margin: 0 0 .5rem;
    float: none;
}
.bcrefunds-reason label { display: block; font-size: .85rem; color: var(--bcr-muted); margin-bottom: .35rem; }

/* ---- bottom summary bar -------------------------------------------- */
.bcrefunds-summary { border-top: 2px solid var(--bcr-ink); background: #fff; margin-top: 1.75rem; }
.bcrefunds-summary__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 0 0;
}
.bcrefunds-summary__count { margin: 0; font-size: 1.05rem; color: var(--bcr-ink); }
.bcrefunds-summary__n { font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---- primary button (flat black, themable) ------------------------- */
.bcrefunds-form .btn-primary,
.bcrefunds-confirmation .btn-primary,
.bcrefunds-history .btn-primary,
.bcrefunds-errors .btn-primary {
    background: var(--bcr-accent);
    border: 1px solid var(--bcr-accent);
    color: #fff;
    border-radius: var(--bcr-radius-sm);
    box-shadow: none;
    font-weight: 700;
    text-transform: none;
    transition: background .15s;
}
.bcrefunds-form .btn-primary:hover,
.bcrefunds-confirmation .btn-primary:hover,
.bcrefunds-history .btn-primary:hover,
.bcrefunds-errors .btn-primary:hover { background: var(--bcr-accent-strong); border-color: var(--bcr-accent-strong); color: #fff; }
.bcrefunds-form .btn-secondary,
.bcrefunds-confirmation .btn-secondary {
    background: #fff;
    border: 1px solid var(--bcr-ink);
    color: var(--bcr-ink);
    border-radius: var(--bcr-radius-sm);
    box-shadow: none;
    font-weight: 600;
}
/* Full-width only inside the summary panel; standalone forms (guest e-mail /
   token confirm) keep a natural button width. */
.bcrefunds-summary .bcrefunds-submit { width: auto; min-width: 16rem; }
.bcrefunds-actions { margin-top: 1.5rem; display: flex; }
.bcrefunds-actions .bcrefunds-submit { min-width: 14rem; }

/* ==================================================================== */
/* CONFIRMATION                                                          */
/* ==================================================================== */
.bcrefunds-confirmation {
    background: #fff;
    border: 1px solid var(--bcr-line);
    padding: clamp(1.5rem, 1rem + 2vw, 2.5rem);
    text-align: center;
}
.bcrefunds-confirmation__check {
    width: 56px; height: 56px;
    margin: .25rem auto 1.25rem;
    border: 2px solid var(--bcr-ink);
    border-radius: 50%;
    display: grid; place-items: center;
}
.bcrefunds-confirmation__check::after {
    content: "";
    width: 13px; height: 24px;
    border: solid var(--bcr-ink);
    border-width: 0 3px 3px 0;
    transform: rotate(45deg) translateY(-2px);
}
.bcrefunds-confirmation p { margin: 0 auto .6rem; max-width: 52ch; }
.bcrefunds-next { color: var(--bcr-muted); font-size: .92rem; }
.bcrefunds-parcel-hint { color: var(--bcr-muted); font-size: .92rem; margin: 0 auto 1.25rem; max-width: 46ch; }

.bcrefunds-code-box {
    margin: 1.25rem auto;
    max-width: 24rem;
    background: var(--bcr-soft);
    padding: 1rem 1.25rem;
}
.bcrefunds-code-box__label { display: block; font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--bcr-muted); margin-bottom: .4rem; }
.bcrefunds-code-box__value {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: .12em;
    color: var(--bcr-ink);
    font-variant-numeric: tabular-nums;
}

.bcrefunds-address-box {
    margin: 0 auto 1.25rem;
    max-width: 24rem;
    text-align: left;
    background: #fff;
    border: 1px solid var(--bcr-line);
    padding: .9rem 1.1rem;
}
.bcrefunds-address-box__label { display: block; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--bcr-muted); margin-bottom: .3rem; }
.bcrefunds-address-box__value { font-style: normal; font-weight: 600; color: var(--bcr-ink); line-height: 1.5; }
.bcrefunds-address-box__contact { display: block; margin-top: .55rem; padding-top: .55rem; border-top: 1px solid var(--bcr-line); font-size: .85rem; color: var(--bcr-muted); }

.bcrefunds-confirmation__actions,
.bcrefunds-errors__actions {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    justify-content: center;
    margin-top: 1.75rem;
}
.bcrefunds-errors__actions { justify-content: flex-start; }

/* ==================================================================== */
/* GUEST e-mail authentication + code entry                              */
/* ==================================================================== */
.bcrefunds-form input[type="email"] { max-width: 26rem; }
.bcrefunds-login-hint { font-size: .9rem; color: var(--bcr-muted); margin: -.75rem 0 1.5rem; }
.bcrefunds-login-hint a { color: var(--bcr-ink); text-decoration: underline; }
.bcrefunds-code-cta { display: block; font-weight: 600; margin: 0 0 .5rem; }
.bcrefunds-code-form input[name="code"] {
    font-size: 1.6rem;
    letter-spacing: .25em;
    text-align: center;
    font-variant-numeric: tabular-nums;
    max-width: 14rem;
    border: 1px solid var(--bcr-ink);
    border-radius: var(--bcr-radius-sm);
}
/* Comfortable inner padding so content never sits flush against the theme
   card / viewport edge (the Classic theme's page card ships zero padding on
   mobile, leaving only its 15px gutter). */
.bcrefunds-form {
    background: #fff;
    box-sizing: border-box;
    padding: 1.25rem clamp(1.1rem, 4vw, 1.75rem) 1.5rem;
}

/* ==================================================================== */
/* HISTORY list                                                          */
/* ==================================================================== */
.bcrefunds-history { max-width: 100%; }
.bcrefunds-history-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.bcrefunds-history-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bcr-card);
}
.bcrefunds-history-table th,
.bcrefunds-history-table td {
    padding: .85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--bcr-line);
    vertical-align: middle;
    white-space: nowrap;
}
.bcrefunds-history-table thead th {
    border-bottom: 2px solid var(--bcr-ink);
    font-size: .76rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--bcr-muted);
    font-weight: 700;
}
.bcrefunds-history-table tbody tr:hover { background: var(--bcr-soft); }
.bcrefunds-history-table td:first-child { font-weight: 700; color: var(--bcr-ink); font-variant-numeric: tabular-nums; }
.bcrefunds-history-table td.bcrefunds-amount { font-variant-numeric: tabular-nums; }
.bcrefunds-overdue { background: #fbeae8 !important; }
.bcrefunds-history-first { display: block; font-size: .8rem; color: var(--bcr-muted); font-weight: normal; }
.bcrefunds-history-table th:nth-child(5),
.bcrefunds-history-table td:nth-child(5) { white-space: normal; }

/* ---- status chips (flat, squared) ---------------------------------- */
.bcrefunds-status {
    display: inline-block;
    font-size: .74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: .2rem .55rem;
    border-radius: var(--bcr-radius-sm);
    border: 1px solid var(--bcr-line);
    background: #fff;
    color: var(--bcr-ink);
}
.bcrefunds-status--new { border-color: var(--bcr-ink); }
.bcrefunds-status--accepted { background: var(--bcr-ink); color: #fff; border-color: var(--bcr-ink); }
.bcrefunds-status--goods_received { background: var(--bcr-soft); }
.bcrefunds-status--refunded { background: var(--bcr-ink); color: #fff; border-color: var(--bcr-ink); }
.bcrefunds-status--rejected,
.bcrefunds-status--expired { color: var(--bcr-muted); border-color: var(--bcr-line); }

/* ==================================================================== */
/* ERROR page                                                            */
/* ==================================================================== */
.bcrefunds-errors {
    background: #fff;
    border: 1px solid var(--bcr-line);
    border-left: 3px solid var(--bcr-danger);
    padding: clamp(1.25rem, 1rem + 2vw, 2rem);
}
.bcrefunds-errors__list { list-style: none; margin: .25rem 0 1.25rem; padding: 0; }
.bcrefunds-errors__list li {
    background: var(--bcr-soft);
    border-left: 2px solid var(--bcr-danger);
    padding: .6rem .85rem;
    margin: 0 0 .5rem;
    color: var(--bcr-ink);
}

/* ==================================================================== */
/* a11y + theme-leak guards                                              */
/* ==================================================================== */
/* Self-contained accessible-hide utility (some themes don't ship one). */
.bcrefunds-form .visually-hidden,
.bcrefunds-history .visually-hidden,
.bcrefunds-confirmation .visually-hidden,
.bcrefunds-errors .visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0; padding: 0; margin: -1px;
}

/* The host theme (PrestaShop Classic) right-aligns bare form labels/legends;
   force left alignment on our own text. Intentional exceptions re-asserted
   afterwards. */
.bcrefunds-form,
.bcrefunds-form label,
.bcrefunds-form legend,
.bcrefunds-form input,
.bcrefunds-form select,
.bcrefunds-form textarea,
.bcrefunds-form .bcrefunds-line__body span,
.bcrefunds-history,
.bcrefunds-errors { text-align: left; }
.bcrefunds-form input[type="number"] { text-align: right; }
.bcrefunds-code-form input[name="code"] { text-align: center; }

/* Keyboard focus cues. */
.bcrefunds-line__check:focus,
.bcrefunds-line__check:focus-visible,
.bcrefunds-order__all-check:focus { outline: 3px solid rgba(17, 17, 17, .35); outline-offset: 2px; }
.bcrefunds-form .form-control:focus,
.bcrefunds-form .form-control:focus-visible,
.bcrefunds-reason-select:focus,
.bcrefunds-end-session:focus-visible { outline: 2px solid var(--bcr-accent); outline-offset: 2px; }

/* ==================================================================== */
/* RESPONSIVE                                                            */
/* ==================================================================== */
@media (max-width: 560px) {
    /* Stack the bottom summary: count above a full-width confirm button. */
    .bcrefunds-summary__inner { flex-direction: column; align-items: stretch; }
    .bcrefunds-summary .bcrefunds-submit { width: 100%; min-width: 0; }
}

@media (max-width: 560px) {
    /* Stack the line card: checkbox + thumb + identity on top, then the
       reason/note controls full-width, then quantity — all aligned to the
       card padding instead of being indented under the thumbnail. */
    .bcrefunds-line {
        grid-template-columns: auto 64px minmax(0, 1fr);
        grid-template-areas:
            "select thumb body"
            "controls controls controls"
            "qty      qty      qty";
        gap: .5rem .75rem;
    }
    .bcrefunds-line__thumb { width: 64px; height: 64px; }
    .bcrefunds-line__controls { margin-top: .25rem; }
    .bcrefunds-line__reason { margin: 0 0 .6rem; }
    .bcrefunds-reason-select,
    .bcrefunds-line__note input { max-width: none; }
    .bcrefunds-line__qty { text-align: left; }
    .bcrefunds-line__qty label { display: inline-block; margin-right: .5rem; }
    .bcrefunds-qty-select { width: auto; min-width: 6rem; max-width: 12rem; margin-left: 0; }

    /* Stack the guest session banner. */
    .bcrefunds-session-banner { flex-direction: column; align-items: flex-start; }
    .bcrefunds-end-session { margin-left: 0; }

    /* Order header: reference above date. */
    .bcrefunds-order > legend { flex-direction: column; align-items: flex-start; gap: .25rem; }

    /* History table → stacked cards (thead hidden, data-label shown). */
    .bcrefunds-history-table thead { display: none; }
    .bcrefunds-history-table,
    .bcrefunds-history-table tbody,
    .bcrefunds-history-table tr,
    .bcrefunds-history-table td { display: block; width: 100%; box-sizing: border-box; }
    .bcrefunds-history-table tr { border-bottom: 2px solid var(--bcr-ink); padding: .35rem 0 .6rem; }
    .bcrefunds-history-table td {
        border: 0;
        padding: .3rem 0;
        display: flex;
        justify-content: space-between;
        gap: 1rem;
        text-align: right;
    }
    .bcrefunds-history-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--bcr-muted);
        text-align: left;
    }

    .bcrefunds-code-box__value { font-size: 1.5rem; letter-spacing: .08em; }
}

@media (prefers-reduced-motion: reduce) {
    .bcrefunds-line__check,
    .bcrefunds-end-session,
    .bcrefunds-form .btn-primary { transition: none; }
}

/* My-withdrawals pagination */
.bcrefunds-pagination { margin-top: 1.25rem; }
.bcrefunds-pagination__list {
    display: flex;
    flex-wrap: wrap;
    gap: .375rem;
    padding: 0;
    margin: 0;
    list-style: none;
    justify-content: center;
}
.bcrefunds-pagination__item a,
.bcrefunds-pagination__item span {
    display: inline-block;
    padding: .375rem .75rem;
    border: 1px solid var(--bcr-border, #d6dbe0);
    border-radius: 6px;
    text-decoration: none;
    line-height: 1.2;
}
.bcrefunds-pagination__item a:hover { background: var(--bcr-muted-bg, #f2f4f6); }
.bcrefunds-pagination__item--current span {
    font-weight: 700;
    background: var(--bcr-accent, #2f3a45);
    color: #fff;
    border-color: var(--bcr-accent, #2f3a45);
}
