/* ==========================================================================
   BidNexa core — shared tokens & components (deep navy + royal blue professional palette)
   ========================================================================== */
:root {
    --ink: #0f1f3d;
    --ink-2: #1e3a6e;
    --ink-3: #3f4f6b;
    --muted: #64748b;
    --line: #e7eaf1;
    --bg: #f5f6fa;
    --card: #ffffff;
    --accent: #2563eb;
    --accent-600: #1d4ed8;
    --accent-soft: #e8f0fe;
    --accent-light: #9db9f5;
    --blue: #3b6bff;
    --green: #16a34a;
    --amber: #f59e0b;
    --red: #ef4444;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .04);
    --shadow: 0 10px 30px -12px rgba(15, 23, 42, .18);
    --shadow-lg: 0 24px 60px -20px rgba(15, 23, 42, .35);

    --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --bs-body-color: var(--ink);
    --bs-body-bg: var(--bg);
    --bs-border-color: var(--line);
    --bs-link-color: #1d4ed8;
    --bs-border-radius: 12px;
}

html { scroll-behavior: smooth; }
body { font-feature-settings: 'cv11', 'ss01'; -webkit-font-smoothing: antialiased; color: var(--ink); background: var(--bg); }
h1, h2, h3, h4, h5, h6 { letter-spacing: -.02em; font-weight: 700; color: var(--ink); }
a { text-decoration: none; }
.text-muted, .text-secondary { color: var(--muted) !important; }
.fw-800 { font-weight: 800; }
.small-caps { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; color: var(--muted); }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------- Buttons ---------- */
.btn { font-weight: 600; border-radius: 12px; padding: .6rem 1.1rem; transition: all .15s ease; }
.btn-sm { padding: .35rem .75rem; border-radius: 9px; font-size: .82rem; }
.btn-lg { padding: .85rem 1.5rem; border-radius: 14px; font-size: 1rem; }
.btn-primary {
    --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-color: #fff;
    --bs-btn-hover-bg: var(--accent-600); --bs-btn-hover-border-color: var(--accent-600); --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--accent-600); --bs-btn-active-border-color: var(--accent-600); --bs-btn-active-color: #fff;
    --bs-btn-disabled-bg: var(--accent); --bs-btn-disabled-border-color: var(--accent); --bs-btn-disabled-color: #fff;
    --bs-btn-focus-shadow-rgb: 37, 99, 235;
    box-shadow: 0 6px 16px -8px rgba(159, 216, 15, .9);
}
.btn-dark { --bs-btn-bg: var(--ink); --bs-btn-border-color: var(--ink); --bs-btn-hover-bg: #000; --bs-btn-hover-border-color: #000; }
.btn-outline-dark { --bs-btn-color: var(--ink); --bs-btn-border-color: #cfd5e1; --bs-btn-hover-bg: var(--ink); --bs-btn-hover-border-color: var(--ink); }
.btn-soft { background: #eef1f7; color: var(--ink); border: 0; }
.btn-soft:hover { background: #e2e7f1; color: var(--ink); }
.btn-icon { width: 36px; height: 36px; padding: 0; display: inline-grid; place-items: center; border-radius: 10px; }

/* ---------- Forms ---------- */
.form-control, .form-select { border-radius: 12px; border-color: #d9deea; padding: .65rem .9rem; background-color: #fff; font-size: .95rem; }
.form-control-sm, .form-select-sm { padding: .35rem .65rem; border-radius: 9px; font-size: .85rem; }
.form-control:focus, .form-select:focus { border-color: #2563eb; box-shadow: 0 0 0 .22rem rgba(37, 99, 235, .28); }
.form-label { font-weight: 600; font-size: .84rem; color: var(--ink-3); margin-bottom: .35rem; }
.form-text { font-size: .78rem; }
.input-group-text { border-radius: 12px; background: #f3f5fa; border-color: #d9deea; color: var(--muted); }
.form-check-input:checked { background-color: var(--ink); border-color: var(--ink); }
.form-switch .form-check-input { width: 2.4em; height: 1.3em; }
.form-switch .form-check-input:checked { background-color: var(--green); border-color: var(--green); }
.invalid-feedback, .field-error { color: var(--red); font-size: .8rem; margin-top: .25rem; }

/* ---------- Cards ---------- */
.card-bn { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-bn > .card-head { padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.card-bn > .card-head h5, .card-bn > .card-head h6 { margin: 0; font-size: 1rem; }
.card-bn > .card-body-bn { padding: 1.25rem; }
.card-bn.hover-lift { transition: transform .2s, box-shadow .2s; }
.card-bn.hover-lift:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

/* ---------- Tables ---------- */
.table-bn { margin: 0; --bs-table-bg: transparent; }
.table-bn thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; background: #fafbfd; border-bottom: 1px solid var(--line); padding: .8rem 1rem; white-space: nowrap; }
.table-bn tbody td { padding: .85rem 1rem; vertical-align: middle; border-color: var(--line); font-size: .9rem; }
.table-bn tbody tr:hover { background: #fafbfe; }
.table-responsive { border-radius: var(--radius); }

/* ---------- Badges / status chips ---------- */
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .22rem .65rem; border-radius: 999px; font-size: .74rem; font-weight: 600; line-height: 1.3; white-space: nowrap; background: #eef1f7; color: var(--ink-3); }
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.chip-green { background: #dcfce7; color: #166534; }
.chip-red { background: #fee2e2; color: #991b1b; }
.chip-amber { background: #fef3c7; color: #92400e; }
.chip-blue { background: #dbeafe; color: #1e40af; }
.chip-purple { background: #ede9fe; color: #5b21b6; }
.chip-gray { background: #eef1f7; color: #475569; }
.chip-dark { background: var(--ink); color: #fff; }
.chip-lime { background: var(--accent-soft); color: #1e40af; }
.chip-plain::before { display: none; }

/* ---------- Misc UI ---------- */
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--ink); color: var(--accent-light); display: inline-grid; place-items: center; font-weight: 700; font-size: .85rem; flex-shrink: 0; letter-spacing: .02em; }
.avatar-sm { width: 30px; height: 30px; font-size: .7rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.3rem; }
.icon-bubble { width: 44px; height: 44px; border-radius: 14px; display: inline-grid; place-items: center; font-size: 1.2rem; background: var(--accent-soft); color: #1e40af; flex-shrink: 0; }
.icon-bubble.blue { background: #e4ebff; color: #2748c9; }
.icon-bubble.amber { background: #fff1d6; color: #b45309; }
.icon-bubble.red { background: #fde4e4; color: #b91c1c; }
.icon-bubble.dark { background: var(--ink); color: var(--accent-light); }
.icon-bubble.purple { background: #ede9fe; color: #6d28d9; }
.divider { height: 1px; background: var(--line); margin: 1rem 0; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2.6rem; display: block; margin-bottom: .75rem; color: #c3c9d8; }
.empty-state h6 { color: var(--ink); }
.kv { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; font-size: .92rem; }
.kv + .kv { border-top: 1px dashed var(--line); }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { font-weight: 600; text-align: right; }
.route-dots { position: relative; padding-left: 1.6rem; }
.route-dots::before { content: ''; position: absolute; left: 6px; top: 12px; bottom: 12px; border-left: 2px dashed #c3c9d8; }
.route-dots .stop { position: relative; padding: .35rem 0; font-size: .92rem; }
.route-dots .stop::before { content: ''; position: absolute; left: -1.6rem; top: .6rem; width: 14px; height: 14px; border-radius: 50%; background: var(--green); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--green); }
.route-dots .stop.drop::before { background: var(--red); box-shadow: 0 0 0 1px var(--red); border-radius: 3px; }
.route-dots .stop.mid::before { background: var(--amber); box-shadow: 0 0 0 1px var(--amber); width: 10px; height: 10px; left: -1.45rem; }
.route-dots small { display: block; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }

/* flash */
.flash-wrap { position: fixed; top: 76px; right: 16px; z-index: 2000; width: min(420px, calc(100vw - 32px)); display: grid; gap: .6rem; }
.flash { display: flex; gap: .7rem; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 12px; padding: .8rem 1rem; box-shadow: var(--shadow); animation: slideIn .3s ease; font-size: .92rem; }
.flash.error { border-left-color: var(--red); }
.flash i { font-size: 1.15rem; color: var(--green); margin-top: 1px; }
.flash.error i { color: var(--red); }
.flash .btn-close { margin-left: auto; font-size: .65rem; }
@keyframes slideIn { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

.pagination { --bs-pagination-border-radius: 10px; --bs-pagination-active-bg: var(--ink); --bs-pagination-active-border-color: var(--ink); --bs-pagination-color: var(--ink); gap: 4px; }
.pagination .page-link { border-radius: 10px !important; border-color: var(--line); font-size: .85rem; }

.nav-pills-bn { gap: .35rem; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.nav-pills-bn::-webkit-scrollbar { display: none; }
.nav-pills-bn .nav-link { border-radius: 999px; color: var(--ink-3); font-weight: 600; font-size: .85rem; padding: .4rem .95rem; background: #fff; border: 1px solid var(--line); white-space: nowrap; }
.nav-pills-bn .nav-link.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.nav-pills-bn .nav-link .count { background: #eef1f7; color: var(--ink-3); border-radius: 999px; font-size: .7rem; padding: 0 .45rem; margin-left: .3rem; }
.nav-pills-bn .nav-link.active .count { background: rgba(255, 255, 255, .18); color: #fff; }

/* Leaflet polish */
.leaflet-container { font-family: inherit; border-radius: inherit; }
.bn-pin { width: 34px; height: 34px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); display: grid; place-items: center; border: 3px solid #fff; box-shadow: 0 6px 14px rgba(0, 0, 0, .3); }
.bn-pin i { transform: rotate(45deg); color: #fff; font-size: .9rem; }
.bn-pin.pickup { background: var(--green); }
.bn-pin.drop { background: var(--red); }
.bn-pin.stop { background: var(--amber); }
.bn-car { width: 38px; height: 38px; border-radius: 50%; background: var(--ink); color: var(--accent-light); display: grid; place-items: center; border: 3px solid var(--accent); box-shadow: 0 6px 14px rgba(0, 0, 0, .35); font-size: 1rem; }

/* skeleton / pulse */
.pulse-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); display: inline-block; position: relative; }
.pulse-dot::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--green); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(1.6); opacity: 0; } }
.spinner-ring { width: 56px; height: 56px; border-radius: 50%; border: 4px solid #e2e8f0; border-top-color: var(--ink); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* status stepper */
.stepper { display: flex; justify-content: space-between; position: relative; margin: 0; padding: 0; list-style: none; }
.stepper::before { content: ''; position: absolute; top: 15px; left: 8%; right: 8%; height: 3px; background: var(--line); }
.stepper li { position: relative; z-index: 1; flex: 1; text-align: center; font-size: .72rem; color: var(--muted); font-weight: 600; }
.stepper li .dot { width: 32px; height: 32px; border-radius: 50%; background: #fff; border: 3px solid var(--line); display: grid; place-items: center; margin: 0 auto .4rem; font-size: .8rem; color: var(--muted); }
.stepper li.done .dot { background: var(--ink); border-color: var(--ink); color: var(--accent-light); }
.stepper li.current .dot { background: var(--accent); border-color: #fff; color: #fff; box-shadow: 0 0 0 5px rgba(37, 99, 235, .3); }
.stepper li.done, .stepper li.current { color: var(--ink); }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.6rem; font-size: .88rem; }
.timeline li::before { content: ''; position: absolute; left: 4px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); }
.timeline li::after { content: ''; position: absolute; left: 8px; top: 18px; bottom: -4px; border-left: 2px solid var(--line); }
.timeline li:last-child::after { display: none; }
.timeline small { color: var(--muted); display: block; }

@media (max-width: 575.98px) {
    .btn-lg { padding: .75rem 1.2rem; }
    .stepper li { font-size: .62rem; }
    .stepper li .dot { width: 26px; height: 26px; font-size: .7rem; }
    .stepper::before { top: 12px; }
}

@media print {
    .no-print, .navbar-bn, .flash-wrap, footer { display: none !important; }
    body { background: #fff; }
}
