/* ============================================================
   ASPULIDO CHECKOUT ENGINE - Mobile-first Stylesheet
   ============================================================ */

:root {
    --brand: #7b2ff7;
    --brand-dark: #5a13c9;
    --ink: #1b1f24;
    --muted: #6b7280;
    --line: #e5e7eb;
    --bg: #f6f7f9;
    --surface: #ffffff;
    --ok: #16a34a;
    --warn: #d97706;
    --err: #dc2626;
    --radius: 14px;
    --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container { width: 100%; max-width: 560px; margin: 0 auto; padding: 0 16px; }

/* ----- Top bar ----- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; }
.brand { font-weight: 800; color: var(--brand); text-decoration: none; letter-spacing: -.3px; }
.topnav { display: flex; gap: 12px; align-items: center; font-size: .85rem; }
.topnav-user { color: var(--muted); }
.topnav a { color: var(--brand); text-decoration: none; font-weight: 600; }

/* ----- Cards / sections ----- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    margin: 14px 0;
    box-shadow: var(--shadow);
}
.card h2, .card h3 { margin-top: 0; font-size: 1.05rem; }
.card h2 { display: flex; align-items: center; gap: 8px; }

/* Step badges */
.step-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--brand); color: #fff; font-size: .8rem; font-weight: 700;
}

/* ----- Forms ----- */
.field { margin-bottom: 12px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; font-size: .9rem; }
.field .hint { color: var(--muted); font-size: .8rem; }
.field input, .field textarea, .field select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 1rem;
    background: #fff;
    color: var(--ink);
}
.field textarea { min-height: 84px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus {
    outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(123, 47, 247, .12);
}

/* ----- Cart lines ----- */
.cart-line { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-line:last-child { border-bottom: none; }
.cart-thumb {
    width: 56px; height: 56px; border-radius: 10px; object-fit: cover;
    background: var(--bg); border: 1px solid var(--line); flex-shrink: 0;
}
.cart-info { flex: 1; }
.cart-name { font-weight: 600; }
.cart-meta { color: var(--muted); font-size: .82rem; }
.cart-price { text-align: right; font-weight: 700; }
.right { text-align: right; }

/* Qty steppers */
.qty-stepper { display: inline-flex; align-items: center; gap: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.qty-stepper button {
    background: #fff; border: none; padding: 4px 10px; font-size: 1rem;
    cursor: pointer; color: var(--ink); line-height: 1;
}
.qty-stepper button:hover { background: var(--bg); }
.qty-stepper input {
    width: 40px; text-align: center; border: none; border-left: 1px solid var(--line);
    border-right: 1px solid var(--line); padding: 6px 0; font-size: .9rem;
}

/* Remove x */
.remove-x { background: none; border: none; color: var(--err); font-weight: 700; cursor: pointer; font-size: 1rem; }

/* ----- Totals rows ----- */
.totals { }
.total-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: .95rem; }
.total-row.muted { color: var(--muted); }
.total-row.grand { font-size: 1.2rem; font-weight: 800; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; }
.money { text-align: right; font-variant-numeric: tabular-nums; }

/* ----- Delivery options ----- */
.option { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 8px; cursor: pointer; }
.option.active { border-color: var(--brand); background: rgba(123, 47, 247, .05); }
.option input, .option-radio { accent-color: var(--brand); }
.option-label { font-weight: 600; }
.option-note { color: var(--muted); font-size: .82rem; }

/* ----- Payment modes ----- */
.paymode { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; cursor: pointer; }
.paymode.active { border-color: var(--brand); background: rgba(123, 47, 247, .05); }
.paymode .pay-name { font-weight: 600; flex: 1; }
.tag { font-size: .7rem; background: var(--bg); border: 1px solid var(--line); padding: 2px 6px; border-radius: 6px; color: var(--muted); }

/* ----- Seller block ----- */
.seller p { margin: 2px 0; font-size: .9rem; }
.seller .shop { font-weight: 700; font-size: 1.05rem; }

/* ----- Buttons ----- */
.btn {
    display: block; width: 100%; padding: 14px; border: none; border-radius: 12px;
    font-size: 1.05rem; font-weight: 700; cursor: pointer; text-align: center;
    color: #fff; background: var(--brand); text-decoration: none;
}
.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.secondary { background: var(--bg); color: var(--ink); border: 1px solid var(--line); }
.btn-block-space { margin-top: 16px; }

/* ----- Alerts ----- */
.alert { padding: 12px; border-radius: 10px; margin: 12px 0; font-size: .9rem; }
.alert.err { background: #fef2f2; color: var(--err); border: 1px solid #fecaca; }
.alert .ok { background: #f0fdf4; color: var(--ok); border: 1px solid #bbf7d0; }

/* ----- Footer ----- */
.footer { margin-top: 40px; border-top: 1px solid var(--line); padding: 18px 0; color: var(--muted); font-size: .85rem; }
.footer-inner { display: flex; justify-content: center; }

/* ----- Utility ----- */
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.mt { margin-top: 12px; }
.text-center { text-align: center; }

/* ----- Delivery map (Leaflet + OpenStreetMap) ----- */
.delivery-map {
    width: 100%;
    height: 320px;
    border: 1px solid var(--line);
    border-radius: 14px;
    z-index: 0;
    overflow: hidden;
    margin-bottom: 10px;
}
.delivery-pin { background: transparent; border: 0; font-size: 30px; line-height: 1; }
.delivery-status { margin-top: 10px; padding: 12px 14px; border-radius: 12px; font-size: 13px; }
.delivery-status-ok { background: #e7f3e9; color: #3a8a4f; }
.delivery-status-err { background: #fbeae3; color: #b3401f; }
.map-hint { color: var(--muted); font-size: .85rem; margin: 4px 0 8px; }

/* ----- Bank accounts editor (admin) ----- */
.bank-editor { overflow-x: auto; }
.bank-editor table { width: 100%; border-collapse: collapse; min-width: 560px; }
.bank-editor th { text-align: left; padding: 8px 6px; font-size: .8rem; color: var(--muted); border-bottom: 1px solid var(--line); }
.bank-editor td { padding: 6px; vertical-align: middle; }
.bank-editor td.bank-num { width: 32px; text-align: center; color: var(--muted); }
.bank-editor td.bank-enabled { width: 60px; text-align: center; }
.bank-editor input[type="text"] {
    width: 100%; padding: 9px 10px; border: 1px solid var(--line);
    border-radius: 8px; font-size: .9rem; background: #fff; color: var(--ink);
}
.bank-editor input[type="text"]:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(123, 47, 247, .12); outline: none; }
.bank-enabled input[type="checkbox"] { accent-color: var(--brand); width: 18px; height: 18px; }

/* Breakpoint tweaks (mobile-first) */
@media (min-width: 768px) {
    .container { max-width: 720px; }
    .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
}
