/* ==========================================================================
   P2P Exchange - design system (Bootstrap 5.3 + theme overrides)
   Shared by the user panel, public pages and (with admin.css) the admin panel.
   ========================================================================== */
:root {
  --brand: #4f46e5;
  --brand-600: #4338ca;
  --brand-50: #eef2ff;
  --buy: #0d9488;
  --buy-600: #0f766e;
  --buy-50: #ccfbf1;
  --sell: #e11d48;
  --sell-50: #ffe4e6;
  --warn: #d97706;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f6f7fb;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px -12px rgba(15, 23, 42, .12);
  --bs-body-font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--bg);
  --bs-link-color: var(--brand);
  --bs-link-hover-color: var(--brand-600);
  --bs-border-color: var(--line);
  --bs-primary: var(--brand);
  --bs-primary-rgb: 79, 70, 229;
}

html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; font-size: .95rem; }
a { text-decoration: none; }
.text-muted, .muted { color: var(--muted) !important; }
.text-brand { color: var(--brand) !important; }
.text-buy { color: var(--buy) !important; }
.text-sell { color: var(--sell) !important; }
.bg-brand-soft { background: var(--brand-50) !important; }
.fw-600 { font-weight: 600; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; word-break: break-all; }
.num { font-variant-numeric: tabular-nums; }

/* --- cards ------------------------------------------------------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { background: transparent; border-bottom: 1px solid var(--line); font-weight: 600; padding: .9rem 1.1rem; }
.card-body { padding: 1.1rem; }
.card-flat { box-shadow: none; }
.card-hover { transition: transform .15s ease, box-shadow .15s ease, border-color .15s; }
.card-hover:hover { transform: translateY(-2px); border-color: #c7d2fe; box-shadow: 0 12px 28px -14px rgba(79, 70, 229, .35); }

/* --- buttons / forms --------------------------------------------------- */
.btn { border-radius: 10px; font-weight: 500; padding: .5rem 1rem; }
.btn-lg { padding: .75rem 1.4rem; border-radius: 12px; }
.btn-sm { padding: .3rem .7rem; border-radius: 8px; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600); --bs-btn-active-bg: var(--brand-600); --bs-btn-active-border-color: var(--brand-600); --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: #c7d2fe; --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); --bs-btn-active-bg: var(--brand); }
.btn-buy { --bs-btn-color: #fff; --bs-btn-bg: var(--buy); --bs-btn-border-color: var(--buy); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--buy-600); --bs-btn-hover-border-color: var(--buy-600); --bs-btn-active-bg: var(--buy-600); --bs-btn-disabled-bg: var(--buy); --bs-btn-disabled-border-color: var(--buy); }
.btn-soft { background: var(--brand-50); color: var(--brand); border: 0; }
.btn-soft:hover { background: #e0e7ff; color: var(--brand-600); }
.form-control, .form-select { border-radius: 10px; border-color: var(--line); padding: .6rem .85rem; background-color: #fff; }
.form-control:focus, .form-select:focus { border-color: #a5b4fc; box-shadow: 0 0 0 .22rem rgba(79, 70, 229, .15); }
.form-label { font-weight: 500; font-size: .85rem; color: var(--ink-2); margin-bottom: .3rem; }
.form-text { color: var(--muted); }
.input-group-text { background: #f8fafc; border-color: var(--line); color: var(--muted); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-switch .form-check-input { width: 2.4em; height: 1.3em; }

/* --- tables ------------------------------------------------------------ */
.table-modern { --bs-table-bg: transparent; margin-bottom: 0; }
.table-modern thead th { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); background: #fafbfd; white-space: nowrap; padding: .75rem 1rem; }
.table-modern td { vertical-align: middle; padding: .85rem 1rem; border-color: #f1f5f9; }
.table-modern tbody tr:hover { background: #fafbff; }
.table-responsive { border-radius: var(--radius); }

/* --- small components --------------------------------------------------- */
.page-title { font-size: 1.55rem; font-weight: 700; letter-spacing: -.015em; margin: 0; }
.page-sub { color: var(--muted); margin: .2rem 0 0; }
.badge-soft { font-weight: 600; padding: .4em .7em; border-radius: 999px; font-size: .72rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; background: #f1f5f9; color: #334155; border-radius: 999px; padding: .18rem .65rem; font-size: .75rem; font-weight: 500; white-space: nowrap; }
.chip i { color: var(--brand); }
.coin-dot { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--c, var(--brand)); color: #fff; font-weight: 700; flex: none; letter-spacing: -.02em; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: var(--brand-50); color: var(--brand); font-weight: 700; font-size: .8rem; flex: none; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.3rem; }
.stat-card { display: flex; gap: .9rem; align-items: center; padding: 1rem 1.1rem; }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem; background: var(--brand-50); color: var(--brand); flex: none; }
.stat-icon.buy { background: var(--buy-50); color: var(--buy); }
.stat-icon.warn { background: #fef3c7; color: var(--warn); }
.stat-icon.sell { background: var(--sell-50); color: var(--sell); }
.stat-label { color: var(--muted); font-size: .78rem; font-weight: 500; }
.stat-value { font-size: 1.35rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2.6rem; opacity: .45; display: block; margin-bottom: .5rem; }
.divider-text { display: flex; align-items: center; gap: .8rem; color: var(--muted); font-size: .8rem; margin: 1.1rem 0; }
.divider-text::before, .divider-text::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.kv { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px dashed var(--line); }
.kv:last-child { border-bottom: 0; }
.kv > span:first-child { color: var(--muted); }
.kv > span:last-child { font-weight: 500; text-align: right; word-break: break-word; }
.copy-btn { cursor: pointer; }
.price-big { font-size: 1.35rem; font-weight: 700; letter-spacing: -.01em; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 700; }
.countdown.urgent { color: var(--sell); }
.dot { display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; background: var(--buy); }

/* --- top navigation (user panel) --------------------------------------- */
.topbar { background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1030; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.15rem; color: var(--ink); letter-spacing: -.02em; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--brand), #7c3aed); color: #fff; display: grid; place-items: center; font-size: 1.05rem; }
.nav-pill { color: var(--ink-2); font-weight: 500; padding: .45rem .85rem; border-radius: 10px; display: inline-flex; align-items: center; gap: .4rem; }
.nav-pill:hover { background: #f1f5f9; color: var(--ink); }
.nav-pill.active { background: var(--brand-50); color: var(--brand); }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 10px; display: inline-grid; place-items: center; color: var(--ink-2); border: 0; background: transparent; }
.icon-btn:hover { background: #f1f5f9; }
.icon-btn .count { position: absolute; top: 2px; right: 1px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--sell); color: #fff; font-size: .65rem; font-weight: 700; display: grid; place-items: center; }
.dropdown-menu { border-radius: 12px; border: 1px solid var(--line); box-shadow: 0 16px 40px -12px rgba(15, 23, 42, .25); padding: .4rem; }
.dropdown-item { border-radius: 8px; padding: .5rem .75rem; }
.notif-menu { width: 340px; max-width: 92vw; padding: 0; }
.notif-item { display: block; padding: .7rem .9rem; border-bottom: 1px solid #f1f5f9; color: var(--ink); }
.notif-item:hover { background: #f8fafc; color: var(--ink); }
.notif-item.unread { background: #f5f7ff; }
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; background: #fff; border-top: 1px solid var(--line); display: none; padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom)); }
.bottom-nav a { flex: 1; text-align: center; font-size: .68rem; color: var(--muted); padding: .25rem 0; position: relative; }
.bottom-nav a i { display: block; font-size: 1.25rem; }
.bottom-nav a.active { color: var(--brand); }
@media (max-width: 991.98px) {
  .bottom-nav { display: flex; }
  body.has-bottom-nav { padding-bottom: 4.6rem; }
}

/* --- marketplace -------------------------------------------------------- */
.ad-card { padding: 1rem 1.1rem; }
.ad-card + .ad-card { margin-top: .75rem; }
.seg { display: inline-flex; background: #eef0f6; border-radius: 12px; padding: 4px; gap: 4px; }
.seg a, .seg button { border: 0; background: transparent; padding: .45rem 1.1rem; border-radius: 9px; font-weight: 600; color: var(--muted); }
.seg a.active, .seg button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.filter-chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: .3rem .85rem; font-size: .82rem; color: var(--ink-2); font-weight: 500; display: inline-flex; align-items: center; gap: .35rem; }
.filter-chip.active, .filter-chip:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-50); }

/* --- wallet cards -------------------------------------------------------- */
.wallet-card { position: relative; overflow: hidden; border: 0; color: #fff; background: linear-gradient(135deg, var(--c1, #4f46e5), var(--c2, #7c3aed)); box-shadow: 0 14px 30px -16px var(--c1, #4f46e5); }
.wallet-card::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.wallet-card .sub { color: rgba(255, 255, 255, .75); font-size: .78rem; }
.wallet-card .amount { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; }

/* --- order timeline + chat ---------------------------------------------- */
.steps { display: flex; gap: .5rem; flex-wrap: wrap; }
.step { flex: 1; min-width: 110px; text-align: center; font-size: .75rem; color: var(--muted); position: relative; padding-top: 1.7rem; }
.step::before { content: ""; position: absolute; top: .45rem; left: 50%; transform: translateX(-50%); width: 14px; height: 14px; border-radius: 50%; background: #e2e8f0; border: 3px solid #fff; box-shadow: 0 0 0 1px #e2e8f0; z-index: 1; }
.step::after { content: ""; position: absolute; top: .95rem; left: calc(50% + 10px); right: calc(-50% + 10px); height: 2px; background: #e2e8f0; }
.step:last-child::after { display: none; }
.step.done { color: var(--ink-2); font-weight: 600; }
.step.done::before { background: var(--buy); box-shadow: 0 0 0 1px var(--buy); }
.step.done::after { background: var(--buy); }
.step.current::before { background: var(--brand); box-shadow: 0 0 0 1px var(--brand), 0 0 0 6px rgba(79, 70, 229, .15); }
.step.bad::before { background: var(--sell); box-shadow: 0 0 0 1px var(--sell); }
.chat-box { height: 380px; overflow-y: auto; padding: 1rem; background: #f8fafc; border-radius: 12px; display: flex; flex-direction: column; gap: .6rem; scroll-behavior: smooth; }
.bubble { max-width: 82%; padding: .55rem .8rem; border-radius: 14px; font-size: .9rem; line-height: 1.35; word-break: break-word; white-space: pre-wrap; box-shadow: 0 1px 1px rgba(15, 23, 42, .05); }
.bubble small { display: block; font-size: .66rem; opacity: .65; margin-top: .2rem; }
.bubble.me { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.bubble.them { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble.admin { align-self: flex-start; background: #fff7ed; border: 1px solid #fed7aa; }
.bubble.system { align-self: center; max-width: 94%; background: #eef2ff; color: #3730a3; font-size: .78rem; text-align: center; border-radius: 10px; box-shadow: none; }
.bubble img { max-width: 220px; border-radius: 10px; display: block; margin-bottom: .3rem; cursor: zoom-in; }

/* --- auth + landing ----------------------------------------------------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-aside { background: radial-gradient(1200px 500px at 0% 0%, #6d63ff 0%, transparent 60%), linear-gradient(160deg, #1e1b4b, #312e81 55%, #4338ca); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-aside::after { content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%; right: -140px; bottom: -140px; background: rgba(255, 255, 255, .07); }
.auth-main { display: grid; place-items: center; padding: 2rem 1.25rem; background: #fff; }
.auth-card { width: 100%; max-width: 410px; }
.feature-li { display: flex; gap: .8rem; align-items: flex-start; margin-bottom: 1.1rem; }
.feature-li i { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, .14); flex: none; }
.otp-input { letter-spacing: .6em; font-size: 1.6rem; text-align: center; font-weight: 700; padding-left: .6em; }
@media (max-width: 991.98px) { .auth-wrap { grid-template-columns: 1fr; } .auth-aside { display: none; } }
.hero { background: radial-gradient(900px 420px at 85% -10%, rgba(124, 58, 237, .28), transparent 60%), radial-gradient(700px 400px at 0% 0%, rgba(79, 70, 229, .22), transparent 60%), #fff; }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.08; }
.gradient-text { background: linear-gradient(90deg, var(--brand), #7c3aed 60%, #db2777); -webkit-background-clip: text; background-clip: text; color: transparent; }
.feature-card { padding: 1.4rem; height: 100%; }
.feature-card .ico { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-size: 1.3rem; background: var(--brand-50); color: var(--brand); margin-bottom: .9rem; }
.step-num { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; display: inline-grid; place-items: center; }
.footer { color: var(--muted); font-size: .85rem; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--brand); }

/* --- misc ---------------------------------------------------------------- */
.alert { border-radius: 12px; border: 0; }
.pagination .page-link { border-radius: 8px; margin: 0 2px; border: 1px solid var(--line); color: var(--ink-2); }
.pagination .active .page-link { background: var(--brand); border-color: var(--brand); color: #fff; }
.toast-container { z-index: 2000; }
.progress { height: .5rem; border-radius: 99px; background: #eef0f6; }
.progress-bar { background: var(--brand); }
.upload-drop { border: 2px dashed #cbd5e1; border-radius: 12px; padding: 1rem; text-align: center; color: var(--muted); background: #fafbfd; }
.sticky-side { position: sticky; top: 84px; }
@media print { .topbar, .bottom-nav, .no-print { display: none !important; } }
