/* ===================================================================
   Hatramij admin theme — left sidebar layout (bonniepro-style)
   Built on top of Bootstrap 5 for page content (cards/tables/forms).
   =================================================================== */
:root {
  --hatramij-red:        #C8102E;
  --hatramij-red-dark:   #9a0c23;
  --hatramij-red-soft:   #fde7ea;
  --hatramij-gray:       #2c2c2c;

  --sidebar-w:        248px;
  --sidebar-w-min:     66px;
  --sidebar-bg:       #0f172a;
  --sidebar-bg-2:     #0b1120;
  --sidebar-text:     #cbd5e1;
  --sidebar-muted:    #8a98ad;
  --sidebar-hover:    rgba(255,255,255,0.06);
  --sidebar-active:   rgba(200,16,46,0.22);
}

* { box-sizing: border-box; }

body {
  background: #f5f5f7;
  color: var(--hatramij-gray);
}

/* ============================ LAYOUT ============================ */
.wrapper {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 1040;
  border-right: 1px solid rgba(255,255,255,0.06);
  transition: width 0.25s ease, transform 0.25s ease;
}
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }

.main-content {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  transition: margin-left 0.25s ease;
}

/* collapsed (desktop) */
.sidebar.collapsed { width: var(--sidebar-w-min); }
body.sidebar-collapsed .main-content { margin-left: var(--sidebar-w-min); }
.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .sidebar-sub,
.sidebar.collapsed .sidebar-user-text,
.sidebar.collapsed .nav-section,
.sidebar.collapsed .sidebar-nav a span,
.sidebar.collapsed .sidebar-logout span { display: none; }
.sidebar.collapsed .sidebar-header { justify-content: center; padding: 16px 6px; }
.sidebar.collapsed .sidebar-brand { justify-content: center; }
.sidebar.collapsed .sidebar-user  { justify-content: center; }
.sidebar.collapsed .sidebar-nav a,
.sidebar.collapsed .sidebar-logout { justify-content: center; padding-left: 0; padding-right: 0; }
.sidebar.collapsed .sidebar-nav a i { margin: 0; }

/* ======================== SIDEBAR HEADER ======================== */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}
.sidebar-brand img {
  height: 38px; width: 38px;
  object-fit: contain;
  background: #fff;
  border-radius: 7px;
  padding: 3px;
  flex-shrink: 0;
}
.sidebar-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.sidebar-title { font-size: 15px; font-weight: 700; color: #f1f5f9; letter-spacing: -0.2px; }
.sidebar-sub   { font-size: 11px; color: var(--hatramij-red); font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; }

.sidebar-toggle {
  background: none; border: none;
  color: var(--sidebar-muted);
  cursor: pointer;
  font-size: 15px;
  padding: 4px 7px;
  border-radius: 5px;
  flex-shrink: 0;
  transition: color .15s, background .15s;
}
.sidebar-toggle:hover { color: #fff; background: var(--sidebar-hover); }

/* ========================= SIDEBAR USER ========================= */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.sidebar-user i { font-size: 26px; color: var(--sidebar-muted); flex-shrink: 0; }
.sidebar-user-text { display: flex; flex-direction: column; line-height: 1.2; overflow: hidden; }
.sidebar-user-text .su-name { font-size: 13.5px; font-weight: 600; color: #f1f5f9; }
.sidebar-user-text .su-role { font-size: 11px; color: var(--sidebar-muted); }

/* ========================= SIDEBAR NAV ========================== */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0 10px;
}
.sidebar-nav ul { list-style: none; margin: 0; padding: 0; }

.nav-section {
  padding: 16px 18px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: #5a6b82;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  border-left: 3px solid transparent;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.sidebar-nav a i { font-size: 16px; width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-nav a:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav li.active a {
  background: var(--sidebar-active);
  color: #fff;
  border-left-color: var(--hatramij-red);
  font-weight: 600;
}

/* badge for items needing attention (e.g. pending HQ approvals) */
.sidebar-nav .nav-badge {
  margin-left: auto;
  background: var(--hatramij-red);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  line-height: 1.3;
}
.sidebar.collapsed .nav-badge { display: none; }

/* ======================== SIDEBAR FOOTER ======================== */
.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,0.07);
  padding: 8px 0;
}
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  transition: background .15s, color .15s;
}
.sidebar-logout i { font-size: 16px; width: 18px; text-align: center; }
.sidebar-logout:hover { background: rgba(200,16,46,0.18); color: #fff; }

/* =========================== TOPBAR ============================= */
.topbar {
  display: none; /* visible on mobile only */
  align-items: center;
  gap: 12px;
  background: var(--hatramij-red);
  color: #fff;
  padding: 10px 14px;
  position: sticky;
  top: 0;
  z-index: 1030;
}
.topbar .mobile-menu-btn {
  background: none; border: none; color: #fff;
  font-size: 22px; cursor: pointer; padding: 0 4px;
}
.topbar .topbar-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.topbar .topbar-brand img { height: 26px; background: #fff; border-radius: 4px; padding: 2px; }

.content-area { padding: 22px 26px; }

/* sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1035;
}
.sidebar-overlay.show { display: block; }

/* ========================== RESPONSIVE ========================== */
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w); }
  .sidebar.open { transform: translateX(0); }
  .sidebar.collapsed { width: var(--sidebar-w); }      /* ignore collapse on mobile */
  .sidebar.collapsed .sidebar-title,
  .sidebar.collapsed .sidebar-sub,
  .sidebar.collapsed .sidebar-user-text,
  .sidebar.collapsed .nav-section,
  .sidebar.collapsed .sidebar-nav a span,
  .sidebar.collapsed .sidebar-logout span { display: revert; }
  .main-content { margin-left: 0 !important; }
  .topbar { display: flex; }
  .sidebar-toggle { display: none; }
}

/* ===================== PAGE CONTENT THEMING ===================== */
.btn-hatramij {
  background: var(--hatramij-red);
  border-color: var(--hatramij-red);
  color: #fff;
}
.btn-hatramij:hover,
.btn-hatramij:focus {
  background: var(--hatramij-red-dark);
  border-color: var(--hatramij-red-dark);
  color: #fff;
}

.text-hatramij { color: var(--hatramij-red) !important; }
.bg-hatramij   { background: var(--hatramij-red) !important; color: #fff; }
.bg-hatramij-soft { background: var(--hatramij-red-soft) !important; }

.card-stat { border-left: 4px solid var(--hatramij-red); }
.card-stat .stat-num {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--hatramij-red);
}

.badge-status-pending   { background: #f0ad4e; color: #fff; }
.badge-status-prepped   { background: #0d6efd; color: #fff; }
.badge-status-delivered { background: #198754; color: #fff; }
.badge-status-cancelled { background: #6c757d; color: #fff; }

.signature-thumb {
  max-width: 360px;
  max-height: 160px;
  background: #fff;
  border: 1px solid #ddd;
  padding: 4px;
}

.mini-map  { height: 320px; border-radius: 6px; }
.track-map { height: 540px; border-radius: 6px; }

.distance-warn {
  color: var(--hatramij-red);
  font-weight: 600;
}

/* =========================== LOGIN ============================= */
.login-card {
  max-width: 380px;
  margin: 8% auto;
}
.login-card .brand {
  text-align: center;
  padding: 24px 0;
  background: var(--hatramij-red);
  border-radius: 6px 6px 0 0;
}
.login-card .brand img { max-height: 60px; }
