/* =============================================================
   BNP Fast Checkout v2 — popup.css
   Base structural styles only.
   Button color/size come from dynamic inline CSS (Assets.php).
   ============================================================= */

/* ── Button base (no color/size — set dynamically) ─────────── */
.bnp-buy-now-btn {
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: filter .2s ease, transform .1s ease;
}
.bnp-buy-now-btn:active { transform: scale(.98); }

/* ── Overlay ────────────────────────────────────────────────── */
#bnp-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.58);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(2px);
}

/* ── Modal box ──────────────────────────────────────────────── */
#bnp-modal {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    max-height: 92dvh;
    overflow-y: auto;
    box-shadow: 0 16px 60px rgba(0,0,0,.25);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1a1a1a;
    scrollbar-width: thin;
    scrollbar-color: #ddd transparent;
}
#bnp-modal::-webkit-scrollbar       { width: 4px; }
#bnp-modal::-webkit-scrollbar-thumb { background: #ddd; border-radius: 10px; }

/* ── Header ─────────────────────────────────────────────────── */
#bnp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
}
#bnp-title  { font-size: 16px; font-weight: 700; }
#bnp-close  {
    background: none; border: none; font-size: 26px; line-height: 1;
    color: #888; cursor: pointer; padding: 2px 6px; border-radius: 4px;
}
#bnp-close:hover { background: #f0f0f0; }

/* ── Form container ─────────────────────────────────────────── */
#bnp-form { padding: 14px 18px 20px; }

/* ── Product row ─────────────────────────────────────────────── */
#bnp-prod-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #f7f7f7;
    border-radius: 8px;
    margin-bottom: 16px;
}
#bnp-prod-img { width: 52px; height: 52px; border-radius: 6px; object-fit: cover; border: 1px solid #e5e5e5; }
#bnp-prod-icon { font-size: 28px; }
#bnp-prod-name  { font-size: 13px; font-weight: 600; }
#bnp-unit-price { font-size: 12px; color: #666; margin-top: 2px; }
#bnp-qty-wrap   { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }
.bnp-qbtn {
    width: 28px; height: 28px; background: #fff; border: 1px solid #ccc;
    border-radius: 5px; font-size: 17px; line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center; color: #333;
}
.bnp-qbtn:hover    { background: #f0f0f0; }
.bnp-qbtn:disabled { opacity: .4; cursor: not-allowed; }
#bnp-qty { font-size: 15px; font-weight: 700; min-width: 22px; text-align: center; }

/* ── Delivery heading ────────────────────────────────────────── */
.bnp-section { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; color: #999; margin: 0 0 10px; }

/* ── Form grid ───────────────────────────────────────────────── */
.bnp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 4px; }
.bnp-f     { display: flex; flex-direction: column; gap: 4px; }
.bnp-full  { grid-column: 1 / -1; }

.bnp-f label { font-size: 12px; font-weight: 600; color: #555; }
.bnp-star    { color: #e24b4a; }

.bnp-f input,
.bnp-f select,
.bnp-f textarea {
    font-size: 14px; padding: 8px 10px;
    border: 1.5px solid #d0d0d0; border-radius: 6px;
    background: #fff; color: #1a1a1a; width: 100%;
    box-sizing: border-box; font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}
.bnp-f select  { height: 38px; }
.bnp-f textarea { height: 68px; resize: vertical; }
.bnp-f input:focus, .bnp-f select:focus, .bnp-f textarea:focus {
    border-color: #1D9E75;
    box-shadow: 0 0 0 3px rgba(29,158,117,.14);
}
.bnp-f.bnp-err input,
.bnp-f.bnp-err select,
.bnp-f.bnp-err textarea {
    border-color: #e24b4a;
    box-shadow: 0 0 0 3px rgba(226,75,74,.12);
}
.bnp-ferr { font-size: 11px; color: #e24b4a; }

/* ── Order summary ───────────────────────────────────────────── */
.bnp-line  { height: 1px; background: #eee; margin: 12px 0; }
.bnp-row   { display: flex; justify-content: space-between; font-size: 13px; color: #666; margin-bottom: 4px; }
.bnp-free  { color: #1D9E75; font-weight: 600; }
.bnp-total-row { font-size: 16px; font-weight: 700; color: #1a1a1a; }

/* ── Error banner ────────────────────────────────────────────── */
#bnp-err {
    overflow: hidden; max-height: 0;
    font-size: 13px; color: #e24b4a;
    background: #fdf0f0; border: 1px solid #f5c6c6;
    border-radius: 6px; transition: max-height .2s, padding .2s;
}
#bnp-err.bnp-show { max-height: 80px; padding: 8px 12px; margin-top: 10px; }

/* ── Submit ──────────────────────────────────────────────────── */
#bnp-submit {
    display: block; width: 100%; margin-top: 14px; padding: 13px;
    background: #1D9E75; color: #fff; font-size: 16px; font-weight: 700;
    border: none; border-radius: 8px; cursor: pointer;
    transition: filter .2s, transform .1s;
}
#bnp-submit:hover   { filter: brightness(1.08); }
#bnp-submit:active  { transform: scale(.99); }
#bnp-submit:disabled { background: #aaa; cursor: not-allowed; filter: none; }

/* ── Spinner ─────────────────────────────────────────────────── */
#bnp-spin {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; font-size: 13px; color: #666; margin-top: 10px;
}
.bnp-spinner {
    width: 15px; height: 15px; border-radius: 50%;
    border: 2px solid #ddd; border-top-color: #1D9E75;
    animation: bnp-spin .7s linear infinite;
    display: inline-block;
}
@keyframes bnp-spin { to { transform: rotate(360deg); } }

/* ── Success ─────────────────────────────────────────────────── */
#bnp-success { padding: 36px 22px 30px; text-align: center; }
.bnp-ok-icon { font-size: 52px; margin-bottom: 10px; }
#bnp-ok-title { font-size: 21px; font-weight: 700; margin: 0 0 10px; }
#bnp-ok-msg   { font-size: 14px; color: #555; line-height: 1.6; margin: 0 0 6px; }
#bnp-continue {
    margin-top: 16px; padding: 10px 26px; border: 1.5px solid #d0d0d0;
    background: #f5f5f5; border-radius: 6px; font-size: 14px; font-weight: 600;
    color: #1a1a1a; cursor: pointer;
}
#bnp-continue:hover { background: #eaeaea; }

/* ── Mobile: bottom sheet ────────────────────────────────────── */
@media (max-width: 540px) {
    #bnp-overlay { padding: 0; align-items: flex-end; }
    #bnp-modal   { border-radius: 14px 14px 0 0; max-height: 96dvh; }
    .bnp-grid    { grid-template-columns: 1fr; }
    .bnp-full    { grid-column: 1; }
}

/* ── Focus rings (a11y) ──────────────────────────────────────── */
.bnp-buy-now-btn:focus-visible,
#bnp-close:focus-visible,
#bnp-submit:focus-visible,
.bnp-qbtn:focus-visible { outline: 3px solid #1D9E75; outline-offset: 2px; }
