/* ==========================================================
   Rechargili : comptes clients et solde prépayé
   Utilise les variables de styles.css (--brand, --ink, etc.)
   ========================================================== */

/* ---------- Bandeau sous l'en-tête ---------- */
.acct-bar {
    max-width: 900px;
    margin: 18px auto 0;
    padding: 0 20px;
    min-height: 60px;
    box-sizing: border-box;
}
.acct-bar-in {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--surface, #fff);
    border: 2px solid #ecdfe2;
    border-radius: 16px;
    padding: 10px 12px 10px 18px;
    box-shadow: var(--shadow-soft, 0 4px 16px rgba(0,0,0,.06));
}
.acct-bar-in p {
    margin: 0;
    font-size: 14px;
    line-height: 1.3;
    color: var(--ink, #1a1a1a);
}
.acct-bar-user {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    min-width: 0;
}
.ab-name {
    font-size: 12px;
    color: var(--muted, #6b7280);
    max-width: 40vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ab-bal {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--brand-dark, #8f1c39);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.acct-bar-btn,
.acct-primary {
    font-family: inherit;
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    background: linear-gradient(120deg, var(--brand, #BF284B), var(--brand-dark, #8f1c39));
    border: 0;
    border-radius: 10px;
    padding: 11px 18px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(191, 40, 75, .22);
    transition: transform .15s ease, box-shadow .15s ease;
    white-space: nowrap;
}
.acct-primary { width: 100%; white-space: normal; }
.acct-bar-btn:hover,
.acct-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(191, 40, 75, .3); }
.acct-primary[disabled] { opacity: .65; cursor: wait; transform: none; }
.acct-secondary {
    font-family: inherit;
    font-weight: 600;
    font-size: 15px;
    width: 100%;
    color: var(--brand-dark, #8f1c39);
    background: #fff;
    border: 2px solid #ecdfe2;
    border-radius: 10px;
    padding: 10px 18px;
    cursor: pointer;
    transition: border-color .15s ease;
}
.acct-secondary:hover { border-color: var(--brand-light, #ff5577); }
.acct-bar button:focus-visible,
.acct-modal button:focus-visible,
.acct-modal input:focus-visible,
.wallet-pay-btn:focus-visible,
.wallet-panel button:focus-visible {
    outline: 3px solid rgba(191, 40, 75, .35);
    outline-offset: 2px;
}

/* ---------- Fenêtre du compte ---------- */
dialog.product-modal.acct-modal {
    padding: 0;
    max-width: 480px;
    overflow-x: hidden;
}
.acct-inner { padding: 22px 22px 24px; font-family: 'Outfit', 'Segoe UI', sans-serif; color: var(--ink, #1a1a1a); }
.acct-head { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.acct-head h2 { flex: 1; margin: 0; font-size: 1.3rem; text-align: left; }
.acct-x, .acct-back {
    display: grid; place-items: center;
    width: 36px; height: 36px; flex-shrink: 0;
    border: 0; border-radius: 50%;
    background: #f5eef0; color: var(--brand-dark, #8f1c39);
    cursor: pointer;
}
.acct-x:hover, .acct-back:hover { background: #ecdfe2; }
.acct-x svg, .acct-back svg { width: 18px; height: 18px; }
.acct-body { display: flex; flex-direction: column; gap: 14px; }

.acct-tabs { display: flex; gap: 6px; background: #f5eef0; padding: 4px; border-radius: 12px; }
.acct-tabs button {
    flex: 1; font-family: inherit; font-size: 14px; font-weight: 600;
    border: 0; border-radius: 9px; padding: 9px 8px; cursor: pointer;
    background: transparent; color: var(--muted, #6b7280);
}
.acct-tabs button[aria-selected="true"] { background: #fff; color: var(--brand-dark, #8f1c39); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.acct-count {
    display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px;
    border-radius: 999px; background: var(--brand, #BF284B); color: #fff; font-size: 11px; line-height: 18px;
}

.acct-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.acct-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: #555; }
.acct-form input[type="text"], .acct-form input[type="tel"], .acct-form input[type="password"],
.acct-form input[type="number"], .acct-form input:not([type]) {
    font-family: inherit; font-size: 16px; font-weight: 500; color: var(--ink, #1a1a1a);
    padding: 11px 12px; border: 2px solid #ecdfe2; border-radius: 10px; background: #fff; width: 100%; box-sizing: border-box;
}
.acct-form input:focus { border-color: var(--brand, #BF284B); outline: none; box-shadow: 0 0 0 4px rgba(191, 40, 75, .12); }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 84px !important; }
.pw-toggle {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    font-family: inherit; font-size: 13px; font-weight: 600; color: var(--brand-dark, #8f1c39);
    background: none; border: 0; padding: 6px 8px; cursor: pointer;
}
.acct-hint { margin: 0; font-size: 13px; color: var(--muted, #6b7280); text-align: left; line-height: 1.45; }
.acct-hint a { color: var(--brand-dark, #8f1c39); font-weight: 600; }
.acct-link {
    align-self: center; background: none; border: 0; cursor: pointer;
    font-family: inherit; font-size: 14px; font-weight: 600; color: var(--muted, #6b7280); text-decoration: underline; padding: 6px;
}
.acct-form .modal-status, .acct-body .modal-status { margin: 0; }

/* Carte de solde : l'élément qui porte l'identité du compte */
.wallet-card {
    position: relative; overflow: hidden;
    display: flex; flex-direction: column; gap: 4px;
    padding: 20px 22px 18px; border-radius: 18px; color: #fff; text-align: left;
    background: linear-gradient(120deg, var(--brand, #BF284B) 0%, var(--brand-dark, #8f1c39) 100%);
    box-shadow: 0 10px 24px rgba(191, 40, 75, .28);
}
.wallet-card::after {
    content: ""; position: absolute; right: -46px; top: -46px; width: 150px; height: 150px;
    border-radius: 50%; border: 26px solid rgba(255, 255, 255, .09); pointer-events: none;
}
.wc-label { font-size: 14px; opacity: .85; }
.wc-amount { font-size: 2.3rem; line-height: 1.1; font-weight: 700; font-variant-numeric: tabular-nums; }
.wc-owner { font-size: 13px; opacity: .85; margin-top: 6px; }
.acct-actions { display: flex; flex-direction: column; gap: 8px; }

/* Listes d'activité et de commandes */
.acct-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.acct-row {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
    padding: 12px 2px; border-top: 1px solid #f0e6e9; text-align: left;
}
.acct-row:first-child { border-top: 0; }
.acct-row strong { display: block; font-size: 14.5px; font-weight: 600; }
.acct-row small { display: block; font-size: 12.5px; color: var(--muted, #6b7280); margin-top: 2px; line-height: 1.35; }
.acct-row .amt { font-weight: 700; font-size: 14.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.amt.plus { color: #1e7e34; }
.amt.minus { color: var(--ink, #1a1a1a); }
.acct-row.pending .amt { color: #b45309; }
.acct-row.rejected .amt { color: #a5142a; }
.acct-empty { margin: 8px 0; text-align: center; color: var(--muted, #6b7280); font-size: 14px; line-height: 1.45; }

.ord { padding: 12px 0; border-top: 1px solid #f0e6e9; text-align: left; }
.ord:first-child { border-top: 0; }
.ord-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.ord-top strong { font-size: 14.5px; font-weight: 600; }
.ord small { display: block; font-size: 12.5px; color: var(--muted, #6b7280); margin-top: 2px; }
.pill { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.pill-pending { background: #fff4e0; color: #b45309; }
.pill-delivered { background: #eaf7ee; color: #1e7e34; }
.pill-refunded { background: #f1f1f3; color: #555; }
.ord-note { margin: 8px 0 0; font-size: 13px; color: #555; line-height: 1.4; }
.code-box {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    margin-top: 8px; padding: 10px 12px; background: #f8f4f5; border: 1px dashed #d9b3bc; border-radius: 10px;
}
.code-box code { font-family: 'Space Mono', ui-monospace, Menlo, monospace; font-size: 14px; font-weight: 700; word-break: break-all; text-align: left; }
.code-box button {
    font-family: inherit; font-size: 13px; font-weight: 700; color: var(--brand-dark, #8f1c39);
    background: #fff; border: 1px solid #d9b3bc; border-radius: 8px; padding: 6px 12px; cursor: pointer; flex-shrink: 0;
}

/* Recharge */
.acct-step { display: flex; align-items: center; margin: 4px 0 0; font-size: 15px; font-weight: 700; text-align: left; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.acct-chip, .acct-method {
    font-family: inherit; font-weight: 700; cursor: pointer; color: #333;
    background: #f8f9fa; border: 2px solid #ced4da; border-radius: 10px;
    transition: border-color .15s ease, background .15s ease;
}
.acct-chip { flex: 1 1 auto; padding: 10px 12px; font-size: 14px; font-variant-numeric: tabular-nums; }
.acct-methods { display: flex; gap: 10px; }
.acct-method { flex: 1; padding: 12px 8px; font-size: 14.5px; }
.acct-chip[aria-pressed="true"], .acct-method[aria-pressed="true"] { border-color: #28a745; background: #eaf7ee; }
.pay-ins { margin: 0; padding: 12px 14px; background: #f8f4f5; border-radius: 10px; font-size: 14px; line-height: 1.5; text-align: left; }
.pay-ins strong { font-variant-numeric: tabular-nums; }
.pay-ins button {
    margin-top: 8px; font-family: inherit; font-size: 13px; font-weight: 700; color: var(--brand-dark, #8f1c39);
    background: #fff; border: 1px solid #d9b3bc; border-radius: 8px; padding: 6px 12px; cursor: pointer;
}
.proof-pick {
    display: block; text-align: center; padding: 12px; border: 2px dashed #ced4da; border-radius: 10px;
    background: #e9ecef; color: #333; font-weight: 600; font-size: 14px; cursor: pointer;
}
.proof-pick:focus-within { border-color: var(--brand, #BF284B); }
.proof-preview { display: flex; align-items: center; gap: 12px; }
.proof-preview img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid #ecdfe2; }
.proof-preview button { font-family: inherit; font-size: 13px; font-weight: 600; background: none; border: 0; color: var(--brand-dark, #8f1c39); text-decoration: underline; cursor: pointer; }
.acct-done { align-items: center; text-align: center; padding: 10px 0 0; }
.acct-done h3 { margin: 0; font-size: 1.2rem; }
.acct-done p { margin: 0; color: #555; line-height: 1.5; font-size: 14.5px; }
.done-ico { width: 56px; height: 56px; border-radius: 50%; background: #eaf7ee; color: #1e7e34; display: grid; place-items: center; }
.done-ico svg { width: 30px; height: 30px; }

.acct-primary.loading { position: relative; pointer-events: none; }
.acct-primary.loading::after {
    content: ""; display: inline-block; width: 14px; height: 14px; margin-left: 10px; vertical-align: -2px;
    border: 2px solid rgba(255, 255, 255, .5); border-top-color: #fff; border-radius: 50%; animation: acct-spin .7s linear infinite;
}
@keyframes acct-spin { to { transform: rotate(360deg); } }

/* ---------- Paiement par solde dans les fenêtres produit ---------- */
.wallet-pay-btn {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    padding: 10px 8px; min-width: 0;
    border: 2px solid #ced4da; border-radius: 8px; background: #f8f9fa; color: #333;
    font-family: inherit; font-size: 13px; font-weight: bold; cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.wallet-pay-btn:hover { border-color: #adb5bd; }
.wallet-pay-btn.selected { border-color: #28a745; background: #eaf7ee; }
.wallet-pay-btn svg { width: 26px; height: 26px; color: var(--brand, #BF284B); }
.wallet-pay-btn .wp-sub { font-size: 12px; font-weight: 600; color: var(--muted, #6b7280); font-variant-numeric: tabular-nums; }

.wallet-panel { margin: 0 0 15px; padding: 12px 14px; border-radius: 10px; background: #f8f4f5; text-align: left; font-size: 14px; line-height: 1.45; color: #333; }
.wallet-panel[hidden] { display: none; }
.wallet-panel p { margin: 0 0 10px; }
.wallet-panel p:last-child { margin-bottom: 0; }
.wp-rows { margin: 0 0 10px; display: flex; flex-direction: column; gap: 4px; }
.wp-rows div { display: flex; justify-content: space-between; gap: 10px; }
.wp-rows dt { color: #555; }
.wp-rows dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.wp-rows .wp-total { padding-top: 6px; margin-top: 2px; border-top: 1px solid #e6d8dc; }
.wp-rows .wp-total dd { color: var(--brand-dark, #8f1c39); font-weight: 700; }
.wp-note { font-size: 13px; color: #555; }
.wp-warn { color: #a5142a; font-weight: 600; }

/* Quand le solde est choisi, les champs de paiement manuel disparaissent */
.wallet-mode .payment-number-display,
.wallet-mode .copy-number-btn,
.wallet-mode .upload-container,
.wallet-mode .promo-container,
.wallet-mode .whatsapp-container { display: none !important; }

@media (max-width: 520px) {
    .acct-bar { padding: 0 14px; margin-top: 14px; }
    .acct-bar-in { padding-left: 14px; }
    .acct-inner { padding: 18px 16px 20px; }
    .wc-amount { font-size: 2rem; }
    .payment-methods .wallet-pay-btn { padding: 8px 4px; }
}
@media (prefers-reduced-motion: reduce) {
    .acct-bar-btn, .acct-primary, .acct-primary.loading::after { transition: none; animation: none; }
}
