/**
 * Frontend styles for the withdrawal flow.
 *
 * Designed to layer on top of any WooCommerce-compatible theme — uses CSS
 * variables that themes can override and falls back to sensible defaults.
 */

:root {
    --bzww-bg: #ffffff;
    --bzww-border: #e5e7eb;
    --bzww-muted: #6b7280;
    --bzww-text: #1f2937;
    --bzww-accent: #2271b1;
    --bzww-accent-soft: #eef6fc;
    --bzww-success: #15803d;
    --bzww-success-soft: #ecfdf5;
    --bzww-danger: #b91c1c;
    --bzww-warning: #b45309;
    --bzww-radius: 8px;
}

/* ===== Containers ===== */

.bzww-account,
.bzww-form-wrapper,
.bzww-lookup,
.bzww-denied,
.bzww-success {
    color: var(--bzww-text);
}

.bzww-account h2,
.bzww-form-wrapper h2,
.bzww-lookup h2,
.bzww-denied h2,
.bzww-success h2 {
    margin: 0 0 0.6em;
    font-weight: 600;
}

.bzww-account h3 {
    margin: 1.6em 0 0.6em;
    font-size: 1.1rem;
    color: var(--bzww-text);
}

/* ===== Tables (existing/eligible/orders) ===== */

.bzww-existing,
.bzww-orders {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--bzww-border);
    border-radius: var(--bzww-radius);
    overflow: hidden;
    background: var(--bzww-bg);
    margin: 0 0 1.5em;
}

.bzww-existing th,
.bzww-existing td,
.bzww-orders th,
.bzww-orders td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--bzww-border);
    vertical-align: middle;
}

.bzww-existing thead th,
.bzww-orders thead th {
    background: #f9fafb;
    font-weight: 600;
    color: var(--bzww-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.bzww-existing tbody tr:last-child td,
.bzww-orders tbody tr:last-child td {
    border-bottom: 0;
}

.bzww-existing tbody tr:hover,
.bzww-orders tbody tr:hover {
    background: #f9fafb;
}

@media (max-width: 600px) {
    .bzww-existing,
    .bzww-orders {
        display: block;
    }
    .bzww-existing thead,
    .bzww-orders thead {
        display: none;
    }
    .bzww-existing tbody tr,
    .bzww-orders tbody tr {
        display: block;
        padding: 8px 12px;
        border-bottom: 1px solid var(--bzww-border);
    }
    .bzww-existing td,
    .bzww-orders td {
        display: flex;
        justify-content: space-between;
        padding: 4px 0;
        border-bottom: 0;
    }
}

/* ===== Form ===== */

.bzww-form fieldset.bzww-items {
    border: 1px solid var(--bzww-border);
    border-radius: var(--bzww-radius);
    padding: 1em 1.2em;
    margin: 0 0 1.5em;
    background: var(--bzww-bg);
}

.bzww-form fieldset.bzww-items legend {
    font-weight: 600;
    padding: 0 0.5em;
    color: var(--bzww-text);
}

.bzww-hint {
    font-size: 0.9em;
    color: var(--bzww-muted);
    margin: 0 0 1em 0;
}

.bzww-item-row {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
}

.bzww-item-row:last-child {
    border-bottom: 0;
}

.bzww-item-row label:first-child {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.bzww-item-name {
    font-weight: 500;
    color: var(--bzww-text);
}

.bzww-item-ordered {
    color: var(--bzww-muted);
    font-size: 0.85em;
    white-space: nowrap;
}

.bzww-item-qty-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--bzww-muted);
    font-size: 0.9em;
}

.bzww-item-qty {
    width: 72px;
    text-align: center;
    padding: 4px 6px;
    border: 1px solid var(--bzww-border);
    border-radius: 4px;
}

.bzww-item-total {
    min-width: 90px;
    text-align: right;
    font-weight: 600;
    color: var(--bzww-text);
}

@media (max-width: 700px) {
    .bzww-item-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    .bzww-item-total {
        text-align: left;
    }
}

.bzww-form p {
    margin: 0 0 1em 0;
}

.bzww-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.35em;
    color: var(--bzww-text);
}

.bzww-form input[type="text"],
.bzww-form input[type="email"],
.bzww-form input[type="number"],
.bzww-form textarea,
.bzww-form select {
    width: 100%;
    padding: 0.6em 0.75em;
    border: 1px solid var(--bzww-border);
    border-radius: 6px;
    box-sizing: border-box;
    /* Inherit the theme's font so controls read natively in block themes. */
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.4;
    background: var(--bzww-bg);
    color: var(--bzww-text);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.bzww-form input:focus,
.bzww-form textarea:focus,
.bzww-form select:focus {
    outline: none;
    border-color: var(--bzww-accent);
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.15);
}

.bzww-form .bzww-confirm {
    font-weight: 600;
    padding: 0.85em 1.6em;
    font-size: 1rem;
}

/* ===== Always-visible withdrawal access (footer link + sticky bar) ===== */

.bzww-footer-access {
    text-align: center;
    padding: 12px 0;
    font-size: 0.85rem;
}

.bzww-footer-access-link {
    color: var(--bzww-muted);
    text-decoration: underline;
}

.bzww-sticky-access {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9990;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 10px 16px;
    background: var(--bzww-text);
    color: #fff;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
}

.bzww-sticky-access-link {
    color: #fff;
    text-decoration: underline;
    font-weight: 600;
}

.bzww-sticky-access-dismiss {
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 6px;
}

.bzww-sticky-access-dismiss:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.bzww-error-summary:focus {
    outline: 2px solid var(--bzww-danger);
    outline-offset: 2px;
}

/* ===== Two-step review screen ===== */

.bzww-review-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 1.4em;
    border: 1px solid var(--bzww-border);
    border-radius: var(--bzww-radius);
    overflow: hidden;
}

.bzww-review-table th,
.bzww-review-table td {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--bzww-border);
    vertical-align: top;
}

.bzww-review-table tr:last-child th,
.bzww-review-table tr:last-child td {
    border-bottom: 0;
}

.bzww-review-table th {
    width: 34%;
    color: var(--bzww-muted);
    font-weight: 600;
    background: #f9fafb;
}

.bzww-review-items {
    margin: 0;
    padding-left: 1.1em;
}

.bzww-edit-link {
    color: var(--bzww-muted);
    text-decoration: underline;
}

/* ===== Legal artifacts (Annex I.A information / I.B model form) ===== */
/* Font family is intentionally left to the theme so the text reads natively. */

.bzww-policy,
.bzww-model-form {
    color: var(--bzww-text);
    line-height: 1.6;
}

.bzww-policy h2,
.bzww-model-form h2 {
    margin: 0 0 0.6em;
}

.bzww-policy h3 {
    margin: 1.4em 0 0.5em;
}

.bzww-policy p,
.bzww-model-form > p {
    margin: 0 0 1em;
}

.bzww-model-form {
    border: 1px solid var(--bzww-border);
    border-radius: var(--bzww-radius);
    padding: 1.2em 1.4em;
    background: var(--bzww-bg);
}

.bzww-model-form-lines {
    list-style: none;
    margin: 0;
    padding: 0;
}

.bzww-model-form-lines li {
    padding: 0.6em 0;
    border-bottom: 1px dashed var(--bzww-border);
}

.bzww-model-form-lines li:last-child {
    border-bottom: 0;
}

.bzww-receipt-code code {
    word-break: break-all;
}

/* ===== Honeypot (anti-bot decoy — must never be visible to humans) ===== */

.bzww-hp {
    position: absolute !important;
    left: -9999px !important;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ===== Lookup form ===== */

.bzww-lookup-form {
    max-width: 460px;
}

.bzww-lookup-form input[type="text"],
.bzww-lookup-form input[type="email"] {
    width: 100%;
    padding: 0.6em 0.75em;
    border: 1px solid var(--bzww-border);
    border-radius: 6px;
    box-sizing: border-box;
    margin-bottom: 0.4em;
}

/* ===== Summary / notices / status pills ===== */

.bzww-order-summary {
    background: #f7f7f7;
    padding: 0.85em 1em;
    border-radius: var(--bzww-radius);
    margin-bottom: 1.4em;
    color: var(--bzww-muted);
}

.bzww-notice {
    background: var(--bzww-accent-soft);
    border-left: 4px solid var(--bzww-accent);
    padding: 12px 16px;
    margin: 12px 0;
    border-radius: 4px;
    color: var(--bzww-text);
}

.bzww-notice p:last-child {
    margin-bottom: 0;
}

.bzww-notice-product {
    background: #f0f8ff;
}

.bzww-notice-thankyou {
    background: var(--bzww-success-soft);
    border-left-color: var(--bzww-success);
}

.bzww-cancel {
    color: var(--bzww-danger);
}

/* ===== Buttons (defensive defaults if theme doesn't style .button) ===== */

.bzww-form .button,
.bzww-account .button,
.bzww-form-wrapper .button,
.bzww-lookup .button,
.bzww-success .button {
    display: inline-block;
    padding: 0.6em 1.2em;
    background: var(--bzww-accent);
    color: #fff;
    border: 1px solid var(--bzww-accent);
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    font-weight: 500;
    transition: background .15s ease, border-color .15s ease;
}

.bzww-form .button:hover,
.bzww-account .button:hover,
.bzww-form-wrapper .button:hover,
.bzww-lookup .button:hover,
.bzww-success .button:hover {
    background: #1e5f95;
    border-color: #1e5f95;
}

.bzww-form .button-link-delete,
.bzww-account .button-link-delete {
    background: transparent;
    border: 1px solid transparent;
    color: var(--bzww-danger);
    text-decoration: underline;
}

.bzww-actions {
    margin: 1.2em 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6em;
    align-items: center;
}

/* ===== UI/UX refinements for default themes ===== */

/* Buttons and links inherit the theme typeface for a native look. */
.bzww-form .button,
.bzww-footer-access-link,
.bzww-sticky-access-link,
.bzww-edit-link {
    font-family: inherit;
}

/* Visible keyboard focus on the primary controls (WCAG 2.4.7). */
.bzww-form .button:focus-visible,
.bzww-footer-access-link:focus-visible,
.bzww-sticky-access-link:focus-visible {
    outline: 2px solid var(--bzww-accent);
    outline-offset: 2px;
}

/* Respect users who prefer reduced motion. */
@media (prefers-reduced-motion: reduce) {
    .bzww-form input,
    .bzww-form textarea,
    .bzww-form select,
    .bzww-form .button,
    .bzww-account .button,
    .bzww-form-wrapper .button,
    .bzww-lookup .button,
    .bzww-success .button {
        transition: none;
    }
}
