/* ── FeriBazaar Brand Colors ─────────────────────────────── */
:root {
  --pb-green:      #10B271;
  --pb-green-dark: #059669;
  --pb-green-light:#ECFDF5;
  --pb-saffron:    #FF9933;
  --pb-sidebar-bg: #0d1f18;
  --pb-sidebar-w:  240px;
}

/* Bootstrap primary override */
.btn-primary           { background-color: var(--pb-green) !important; border-color: var(--pb-green) !important; }
.btn-primary:hover     { background-color: var(--pb-green-dark) !important; border-color: var(--pb-green-dark) !important; }
.btn-outline-primary   { color: var(--pb-green) !important; border-color: var(--pb-green) !important; }
.btn-outline-primary:hover { background-color: var(--pb-green) !important; color: #fff !important; }
.text-primary          { color: var(--pb-green) !important; }
.bg-primary            { background-color: var(--pb-green) !important; }
.border-primary        { border-color: var(--pb-green) !important; }
.badge.bg-success, .btn-success { background-color: var(--pb-green) !important; border-color: var(--pb-green) !important; }
.nav-pills .nav-link.active { background-color: var(--pb-green) !important; }
.form-control:focus, .form-select:focus { border-color: var(--pb-green); box-shadow: 0 0 0 .2rem rgba(16,178,113,.2); }

/* ── Body & Font ─────────────────────────────────────────── */
body { font-family: 'Inter', 'Segoe UI', sans-serif; background: #f4f6f9; }

/* ── Login page ──────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--pb-green) 0%, var(--pb-green-dark) 60%, #064E3B 100%);
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.login-logo { font-size: 3rem; line-height: 1; }
.otp-inputs input {
  width: 46px; height: 52px; text-align: center;
  font-size: 1.4rem; font-weight: 700;
  border: 2px solid #dee2e6; border-radius: 10px;
}
.otp-inputs input:focus { border-color: var(--pb-green); outline: none; box-shadow: 0 0 0 .15rem rgba(16,178,113,.25); }

/* ── Dashboard layout ────────────────────────────────────── */
.pb-sidebar {
  width: var(--pb-sidebar-w);
  /* Must be a fixed height, not min-height: a position:fixed element with only
     a minimum grows to fit its content, so it runs off the bottom of the screen
     and overflow-y never engages (the box never overflows itself). That hid the
     whole SEO nav group and the logout button on shorter viewports. */
  height: 100vh;
  height: 100dvh; /* mobile: excludes the browser chrome that 100vh ignores */
  background: var(--pb-sidebar-bg);
  position: fixed; top: 0; left: 0; z-index: 100;
  display: flex; flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain; /* don't chain the scroll to the page behind it */
}

/* Slim dark scrollbar — the default light one is jarring on the dark sidebar. */
.pb-sidebar { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent; }
.pb-sidebar::-webkit-scrollbar { width: 6px; }
.pb-sidebar::-webkit-scrollbar-track { background: transparent; }
.pb-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.2); border-radius: 3px;
}
.pb-sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.35); }
.pb-sidebar .brand {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.pb-sidebar .brand-icon { font-size: 1.8rem; }
.pb-sidebar .brand-name { color: #fff; font-weight: 800; font-size: 1.1rem; margin-left: .5rem; }
.pb-sidebar .brand-sub  { color: rgba(255,255,255,.45); font-size: .7rem; margin-left: .5rem; }

.pb-sidebar .nav-section-label {
  color: rgba(255,255,255,.3);
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 1rem 1.25rem .3rem;
}
.pb-sidebar .nav-link {
  color: rgba(255,255,255,.65);
  padding: .6rem 1.25rem;
  border-radius: 8px;
  margin: 2px .75rem;
  font-size: .875rem;
  font-weight: 500;
  display: flex; align-items: center; gap: .65rem;
  transition: all .15s;
}
.pb-sidebar .nav-link i { font-size: 1rem; width: 18px; text-align: center; }
.pb-sidebar .nav-link:hover  { background: rgba(255,255,255,.08); color: #fff; }
.pb-sidebar .nav-link.active { background: var(--pb-green); color: #fff !important; }

.pb-sidebar .sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.08);
}
.pb-sidebar .user-pill {
  background: rgba(255,255,255,.07);
  border-radius: 10px;
  padding: .6rem .75rem;
  display: flex; align-items: center; gap: .6rem;
}
.pb-sidebar .user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--pb-green);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .85rem;
}
.pb-sidebar .user-name { color: #fff; font-size: .8rem; font-weight: 600; }
.pb-sidebar .user-role { color: rgba(255,255,255,.4); font-size: .7rem; }

.pb-main {
  margin-left: var(--pb-sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.pb-topbar {
  background: #fff;
  border-bottom: 1px solid #e9ecef;
  padding: .85rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.pb-topbar .page-title { font-weight: 700; font-size: 1.1rem; color: #1a1a2e; margin: 0; }
.pb-content { padding: 1.5rem; flex: 1; }

/* ── Stat cards ──────────────────────────────────────────── */
.stat-card {
  background: #fff;
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  border: 1px solid #f0f0f0;
  display: flex; align-items: center; gap: 1rem;
}
.stat-icon {
  width: 52px; height: 52px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; flex-shrink: 0;
}
.stat-value { font-size: 1.75rem; font-weight: 800; color: #1a1a2e; line-height: 1; }
.stat-label { font-size: .78rem; color: #6c757d; font-weight: 500; margin-top: 2px; }

/* ── Cards & Tables ──────────────────────────────────────── */
.pb-card {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #f0f0f0;
  overflow: hidden;
}
.pb-card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f0f0f0;
  display: flex; align-items: center; justify-content: space-between;
}
.pb-card-header h6 { font-weight: 700; margin: 0; color: #1a1a2e; }
.pb-card-body { padding: 1.25rem; }

.table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: #6c757d; font-weight: 600; border-top: none; }
.table td { vertical-align: middle; font-size: .875rem; }
.table-hover tbody tr:hover { background-color: var(--pb-green-light); }

/* ── Live route map ──────────────────────────────────────── */
#routeMap { height: 420px; border-radius: 12px; border: 1px solid #dee2e6; }

/* ── LIVE pulse badge ────────────────────────────────────── */
.live-dot {
  display: inline-block;
  width: 10px; height: 10px;
  background: var(--pb-green);
  border-radius: 50%;
  animation: pulse 1.4s ease-in-out infinite;
  margin-right: 5px;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,178,113,.6); }
  50%       { box-shadow: 0 0 0 8px rgba(16,178,113,0); }
}

/* ── Toast container ─────────────────────────────────────── */
#toastContainer {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999;
  min-width: 280px;
}

/* ── Mobile topbar toggle + backdrop ─────────────────────── */
.pb-menu-toggle {
  display: none;
  background: transparent;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  color: #1a1a2e;
  padding: .25rem .5rem .25rem 0;
}
.pb-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 999;
}
.pb-backdrop.show { display: block; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .pb-sidebar {
    width: min(var(--pb-sidebar-w), 82vw);
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 1000;
    box-shadow: 0 0 40px rgba(0,0,0,.35);
  }
  .pb-sidebar.show { transform: translateX(0); }
  .pb-main { margin-left: 0; }
  .pb-menu-toggle { display: inline-block; }
  .pb-topbar { padding: .75rem 1rem; }
  .pb-content { padding: 1rem; }
}

@media (max-width: 575.98px) {
  /* Bootstrap columns only get a width rule from their own breakpoint up —
     without an explicit col-12 base they stay content-sized (flex-basis:auto)
     on narrow phones instead of stacking. Force full-width stacking here so
     every current/future admin page's grids behave without needing col-12
     added to each one individually. */
  .pb-content [class*="col-sm-"],
  .pb-content [class*="col-md-"],
  .pb-content [class*="col-lg-"],
  .pb-content [class*="col-xl-"] {
    flex: 0 0 100%;
    max-width: 100%;
  }

  /* Filter bars (search + selects) use fixed inline px widths that only
     make sense on wide screens — stack them full-width on phones. */
  .pb-content .flex-wrap > input.form-control-sm[style*="width"],
  .pb-content .flex-wrap > select.form-select-sm[style*="width"] {
    width: 100% !important;
  }
  .pb-content .flex-wrap > .btn.ms-auto { margin-left: 0 !important; }

  .stat-card { padding: 1rem; }
  .stat-icon { width: 42px; height: 42px; font-size: 1.15rem; }
  .stat-value { font-size: 1.4rem; }
  .pb-topbar .page-title { font-size: 1rem; }
  .pb-card-header { flex-wrap: wrap; gap: .4rem; }
}
