/* ============================================================
   BODYCAM IMS — STYLESHEET

   ============================================================ */

/* ── TOKENS ── */
:root {
  --navy:     #0D1B2A;
  --steel:    #1C2F45;
  --slate:    #2A3F5C;
  --accent:   #00B4D8;
  --amber:    #F4A01C;
  --offwhite: #E8EDF2;
  --muted:    #8A9BB0;
  --danger:   #E74C3C;
  --success:  #27AE60;
  --sidebar-w: 260px;
  --topbar-h:  60px;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #F0F4F8;
  color: #1A2535;
}

/* ════════════════════════════════════════
   TOPBAR
════════════════════════════════════════ */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--navy);
  display: flex; align-items: center;
  padding: 0 1rem;
  z-index: 1050;
  border-bottom: 2px solid var(--accent);
  gap: 1rem;
}

.topbar .brand {
  display: flex; align-items: center; gap: .6rem;
  font-weight: 700; font-size: 1.05rem; color: #fff;
  letter-spacing: .04em; white-space: nowrap;
}
.topbar .brand .cam-icon {
  width: 34px; height: 34px;
  background: var(--accent); border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: var(--navy);
}
.topbar .brand span.sub { color: var(--accent); }

#sidebarToggle {
  background: transparent; border: none; color: #fff;
  font-size: 1.3rem; cursor: pointer;
  padding: 4px 8px; border-radius: 5px;
  transition: background .15s;
  /* make sure it is always clickable */
  position: relative; z-index: 1051;
}
#sidebarToggle:hover { background: var(--steel); }

.topbar .search-wrap {
  flex: 1; max-width: 400px;
  position: relative; margin-left: .5rem;
}
.topbar .search-wrap input {
  background: var(--steel);
  border: 1px solid var(--slate);
  color: #fff; border-radius: 6px;
  padding: .4rem .8rem .4rem 2.2rem;
  width: 100%; font-size: .88rem;
  transition: border-color .2s;
}
.topbar .search-wrap input::placeholder { color: var(--muted); }
.topbar .search-wrap input:focus { outline: none; border-color: var(--accent); }
.topbar .search-wrap .bi-search {
  position: absolute; left: .7rem; top: 50%;
  transform: translateY(-50%);
  color: var(--muted); font-size: .85rem;
}

.topbar .topbar-right {
  margin-left: auto;
  display: flex; align-items: center; gap: .6rem;
}
.topbar .topbar-right .icon-btn {
  background: var(--steel); border: none; color: var(--muted);
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: color .15s, background .15s;
  position: relative;
}
.topbar .topbar-right .icon-btn:hover { color: #fff; background: var(--slate); }
.topbar .topbar-right .badge-dot {
  position: absolute; top: 7px; right: 7px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--amber); border: 1px solid var(--navy);
}
.topbar .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #0077A8);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: .8rem; cursor: pointer;
}

/* ════════════════════════════════════════
   OVERLAY  (mobile drawer backdrop)
   FIX: was blocking clicks when display:none
   — use pointer-events instead of display
════════════════════════════════════════ */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .48);
  z-index: 1039;           /* just below sidebar (1040) */
  opacity: 0;
  pointer-events: none;    /* invisible + non-blocking by default */
  transition: opacity .28s;
}
.overlay.active {
  opacity: 1;
  pointer-events: all;     /* only blocks clicks when visible */
}

/* ════════════════════════════════════════
   SIDEBAR
════════════════════════════════════════ */
#sidebar {
  position: fixed;
  top: var(--topbar-h); left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--navy);
  overflow-y: auto; overflow-x: hidden;
  transition: transform .28s cubic-bezier(.4, 0, .2, 1);
  z-index: 1040;
  display: flex; flex-direction: column;
}

/* Desktop collapsed state */
#sidebar.collapsed {
  transform: translateX(calc(-1 * var(--sidebar-w)));
}

/* Scrollbar */
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-thumb { background: var(--slate); border-radius: 4px; }

/* Section labels */
.sidebar-section-label {
  font-size: .68rem; font-weight: 700; letter-spacing: .1em;
  color: var(--muted); text-transform: uppercase;
  padding: 1.2rem 1.1rem .4rem;
  white-space: nowrap;
}

/* ── Nav links — #sidebar prefix beats Bootstrap specificity ── */
#sidebar nav a,
#sidebar nav a.nav-link,
#sidebar nav a.nav-link:link,
#sidebar nav a.nav-link:visited {
  display: flex; align-items: center; gap: .65rem;
  color: #FFFFFF !important;
  padding: .55rem 1.1rem;
  border-radius: 0; font-size: .88rem;
  transition: background .15s, color .15s;
  text-decoration: none !important;
  white-space: nowrap;
}
#sidebar nav a.nav-link:hover,
#sidebar nav a.nav-link:focus {
  background: var(--steel);
  color: #FFFFFF !important;
  outline: none;
}
#sidebar nav a.nav-link.active {
  background: linear-gradient(90deg, rgba(0,180,216,.18) 0%, transparent 100%);
  color: var(--accent) !important;
  border-left: 3px solid var(--accent);
}
#sidebar nav a.nav-link i { font-size: 1rem; flex-shrink: 0; }
#sidebar nav a.nav-link .nav-badge {
  margin-left: auto; font-size: .7rem;
  padding: 2px 7px; border-radius: 20px; font-weight: 600;
}

/* ── Sub-menu toggle row ── */
#sidebar .sub-toggle {
  display: flex; align-items: center; gap: .65rem;
  color: #FFFFFF !important;
  padding: .55rem 1.1rem;
  font-size: .88rem; cursor: pointer;
  transition: background .15s, color .15s;
  user-select: none; white-space: nowrap;
}
#sidebar .sub-toggle:hover { background: var(--steel); color: #FFFFFF !important; }
#sidebar .sub-toggle.open  { color: var(--accent) !important; }
#sidebar .sub-toggle i.toggle-icon {
  margin-left: auto; font-size: .8rem;
  transition: transform .22s;
}
#sidebar .sub-toggle.open i.toggle-icon { transform: rotate(90deg); }

/* ── Sub-menu container ── */
.sub-menu {
  overflow: hidden;
  max-height: 0;
  transition: max-height .3s ease;
}
.sub-menu.open { max-height: 600px; }

/* ── Sub-menu links — exhaustive selector to defeat Bootstrap ── */
#sidebar .sub-menu a,
#sidebar .sub-menu a.nav-link,
#sidebar .sub-menu a.nav-link:link,
#sidebar .sub-menu a.nav-link:visited,
#sidebar .sub-menu a.nav-link:hover,
#sidebar .sub-menu a.nav-link:focus,
#sidebar .sub-menu a.nav-link:active {
  color: #FFFFFF !important;
  padding-left: 2.8rem !important;
  font-size: .83rem !important;
  text-decoration: none !important;
  display: flex;
  align-items: center;
}

/* Dot bullet */
#sidebar .sub-menu a.nav-link::before {
  content: '';
  display: inline-block;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--slate);
  flex-shrink: 0; margin-right: 6px;
}
#sidebar .sub-menu a.nav-link:hover::before,
#sidebar .sub-menu a.nav-link.active::before { background: var(--accent); }

/* ── Sidebar footer ── */
.sidebar-footer {
  margin-top: auto; padding: 1rem;
  border-top: 1px solid var(--steel);
}
.sidebar-footer .user-card {
  display: flex; align-items: center; gap: .7rem;
  background: var(--steel); border-radius: 8px; padding: .6rem .8rem;
}
.sidebar-footer .user-card .avatar-sm {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #005F7A);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .75rem; color: #fff; flex-shrink: 0;
}
.sidebar-footer .user-card .user-info { overflow: hidden; }
.sidebar-footer .user-card .user-name {
  font-size: .82rem; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-footer .user-card .user-role { font-size: .72rem; color: var(--muted); }

/* ════════════════════════════════════════
   MAIN CONTENT
════════════════════════════════════════ */
#mainContent {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  padding: 1.5rem 1.6rem;
  transition: margin-left .28s cubic-bezier(.4, 0, .2, 1);
  min-height: calc(100vh - var(--topbar-h));
}
#mainContent.expanded { margin-left: 0; }

/* ── Page header ── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.4rem; flex-wrap: wrap; gap: .8rem;
}
.page-header h1 { font-size: 1.3rem; font-weight: 700; margin: 0; color: #1A2535; }
.page-header .breadcrumb { margin: 0; font-size: .78rem; color: var(--muted); }
.page-header .breadcrumb .breadcrumb-item.active { color: #1A2535; }

/* ════════════════════════════════════════
   KPI CARDS  (inventory page)
════════════════════════════════════════ */
.kpi-card {
  background: #fff; border-radius: 10px;
  padding: 1.1rem 1.2rem; border: 1px solid #E2E8F0;
  display: flex; align-items: flex-start; gap: 1rem;
  transition: box-shadow .18s;
}
.kpi-card:hover { box-shadow: 0 4px 18px rgba(0,0,0,.07); }
.kpi-icon {
  width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}
.kpi-label  { font-size: .75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.kpi-value  { font-size: 1.75rem; font-weight: 800; line-height: 1.1; color: #1A2535; }
.kpi-delta  { font-size: .75rem; margin-top: .2rem; }
.kpi-delta.up   { color: var(--success); }
.kpi-delta.down { color: var(--danger); }

/* ════════════════════════════════════════
   TABLE / CARD PANEL  (inventory page)
════════════════════════════════════════ */
.card-panel {
  background: #fff; border-radius: 10px;
  border: 1px solid #E2E8F0; overflow: hidden;
}
.card-panel .cp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.2rem; border-bottom: 1px solid #EEF2F7;
  flex-wrap: wrap; gap: .6rem;
}
.card-panel .cp-title  { font-size: .95rem; font-weight: 700; color: #1A2535; }
.card-panel .cp-actions { display: flex; align-items: center; gap: .5rem; }

.table thead th {
  background: #F7FAFC; font-size: .75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); border-bottom: 1px solid #E2E8F0;
  padding: .7rem 1rem; white-space: nowrap;
}
.table tbody td {
  padding: .75rem 1rem; vertical-align: middle;
  font-size: .87rem; border-color: #F0F4F8;
}
.table tbody tr:hover td { background: #FAFCFF; }

/* Status pills */
.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .72rem; font-weight: 700; padding: 3px 10px;
  border-radius: 20px; text-transform: uppercase; letter-spacing: .05em;
}
.status-pill::before {
  content: ''; display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
}
.sp-active      { background: #E6F9EF; color: #1E8449; }
.sp-active::before      { background: var(--success); }
.sp-maintenance { background: #FEF9E7; color: #B7770D; }
.sp-maintenance::before { background: var(--amber); }
.sp-offline     { background: #FDEDEC; color: #922B21; }
.sp-offline::before     { background: var(--danger); }
.sp-charging    { background: #EBF5FB; color: #1A5276; }
.sp-charging::before    { background: var(--accent); }

/* Battery bar */
.battery-wrap { display: flex; align-items: center; gap: 6px; }
.battery-bar  {
  height: 6px; border-radius: 3px; background: #E2E8F0;
  flex: 1; max-width: 80px; position: relative; overflow: hidden;
}
.battery-fill { height: 100%; border-radius: 3px; }
.batt-high { background: var(--success); }
.batt-mid  { background: var(--amber); }
.batt-low  { background: var(--danger); }
.battery-pct { font-size: .78rem; color: var(--muted); min-width: 30px; }

/* Action icon button */
.act-btn {
  background: #F0F4F8; border: none;
  width: 28px; height: 28px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted); cursor: pointer;
  transition: background .15s, color .15s;
}
.act-btn:hover { background: var(--accent); color: #fff; }

/* Filter bar */
.filter-bar {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding: .8rem 1.2rem; background: #FAFBFD;
  border-bottom: 1px solid #EEF2F7;
}
.filter-bar select,
.filter-bar input {
  font-size: .82rem; border: 1px solid #DDE3EA;
  border-radius: 6px; padding: .3rem .65rem;
  color: #1A2535; background: #fff;
}
.filter-bar select:focus,
.filter-bar input:focus { outline: none; border-color: var(--accent); }
.filter-label { font-size: .78rem; color: var(--muted); font-weight: 600; }

/* Alert strip */
.alert-strip {
  display: flex; align-items: center; gap: .6rem;
  background: #FFF8E7; border: 1px solid #F4A01C33;
  border-radius: 8px; padding: .6rem 1rem;
  font-size: .83rem; color: #7D5A0A;
}
.alert-strip i { color: var(--amber); font-size: 1rem; }

/* Pagination */
.page-link { font-size: .82rem; color: #1A2535; border-color: #DDE3EA; }
.page-item.active .page-link { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-link:hover { background: #EEF2F7; color: #1A2535; }

.region { background:#EEF2F7;color:#4A5568;font-size:.72rem; }

/* ════════════════════════════════════════
   FORM CARDS  (form page)
════════════════════════════════════════ */
.form-card {
  background: #fff; border-radius: 10px;
  border: 1px solid #E2E8F0; overflow: hidden;
  margin-bottom: 1.4rem;
}
.form-card .fc-header {
  display: flex; align-items: center; gap: .6rem;
  padding: 1rem 1.2rem; border-bottom: 1px solid #EEF2F7;
}
.form-card .fc-header .fc-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: #E8F8FE; color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.form-card .fc-header .fc-title    { font-size: .95rem; font-weight: 700; color: #1A2535; }
.form-card .fc-header .fc-subtitle { font-size: .78rem; color: var(--muted); }
.form-card .fc-body { padding: 1.4rem 1.2rem; }
.fc-divider { border: none; border-top: 1px solid #EEF2F7; margin: 1.4rem 0; }
.fc-section-title {
  font-size: .72rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 1rem;
}

/* ── Form controls ── */
.form-label {
  font-size: .8rem; font-weight: 600; color: #4A5568;
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: .35rem;
}
.form-control,
.form-select {
  font-size: .87rem; border: 1px solid #DDE3EA;
  border-radius: 7px; color: #1A2535;
  padding: .45rem .75rem;
  transition: border-color .18s, box-shadow .18s;
}
.form-control:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,180,216,.12);
  outline: none;
}
.form-control::placeholder { color: #AAB5C4; }
.form-text { font-size: .75rem; color: var(--muted); margin-top: .25rem; }

.input-group .input-group-text {
  background: #F7FAFC; border: 1px solid #DDE3EA;
  color: var(--muted); font-size: .87rem;
}
.input-group .form-control { border-left: none; }
.input-group .form-control:focus { border-left: 1px solid var(--accent); }

/* Range slider accent */
.form-range::-webkit-slider-thumb { background: var(--accent); }
.form-range::-moz-range-thumb     { background: var(--accent); }

/* Required asterisk */
.req { color: var(--danger); margin-left: 2px; }

/* File drop zone */
.drop-zone {
  border: 2px dashed #DDE3EA; border-radius: 8px;
  padding: 2rem 1rem; text-align: center; cursor: pointer;
  transition: border-color .18s, background .18s;
  background: #FAFBFD;
}
.drop-zone:hover { border-color: var(--accent); background: #F0FAFE; }
.drop-zone i { font-size: 1.8rem; color: var(--muted); }
.drop-zone p { font-size: .83rem; color: var(--muted); margin: .5rem 0 0; }
.drop-zone span { font-size: .78rem; color: var(--accent); font-weight: 600; }

/* Color swatch preview */
#colorPreview { width: 36px; height: 36px; border-radius: 6px; border: 1px solid #DDE3EA; }

/* Form action buttons */
.btn-primary-ims {
  background: var(--accent); border: none; color: #fff;
  font-weight: 600; font-size: .88rem;
  padding: .55rem 1.4rem; border-radius: 7px;
  transition: background .18s; cursor: pointer;
}
.btn-primary-ims:hover { background: #0099BA; color: #fff; }

.btn-outline-ims {
  background: transparent; border: 1px solid #DDE3EA;
  color: #4A5568; font-weight: 600; font-size: .88rem;
  padding: .55rem 1.2rem; border-radius: 7px;
  transition: background .18s; cursor: pointer;
}
.btn-outline-ims:hover { background: #F0F4F8; }

.char-count { font-size: .72rem; color: var(--muted); text-align: right; margin-top: .2rem; }
.status-preview {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .78rem; font-weight: 700; padding: 4px 12px; border-radius: 20px;
}




/* ════════════════════════════════════════
   RESPONSIVE  —  MOBILE SIDEBAR FIX

════════════════════════════════════════ */
@media (max-width: 768px) {

  /* Hide sidebar off-screen by default on mobile */
  #sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w)));
    /* ensure it sits above overlay when open */
    z-index: 1041;
  }

  /* Slide in when JS adds .mobile-open */
  #sidebar.mobile-open {
    transform: translateX(0);
  }

  /* Desktop .collapsed class must not interfere on mobile */
  #sidebar.collapsed {
    transform: translateX(calc(-1 * var(--sidebar-w)));
  }
  #sidebar.collapsed.mobile-open {
    transform: translateX(0);
  }

  /* Main content fills full width */
  #mainContent,
  #mainContent.expanded {
    margin-left: 0;
    padding: 1rem;
  }

  /* Table scrolls horizontally */
  .table-responsive { -webkit-overflow-scrolling: touch; }

  /* Stack page header on small screens */
  .page-header { flex-direction: column; align-items: flex-start; }

  /* KPI cards 2-col on mobile */
  .kpi-value { font-size: 1.4rem; }
}

@media (max-width: 480px) {
  .topbar .search-wrap { display: none; }
  .topbar .brand { font-size: .9rem; }
}


/* Handling Printing of Data */
@media print {
    /* 1. Hide every element by default on the page */
    body * {
        visibility: hidden;
    }

    /* 2. Target your specific table block and force it to be visible */
    #printableTable, #printableTable * {
        visibility: visible;
    }

    /* 3. Position the printable element exactly in the top-left corner of the print layout */
    #printableTable {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }

    /* Optional: Remove URL backgrounds, headers, footers, and decoration shadows for a clean look */
    .table {
        border-collapse: collapse !important;
        width: 100% !important;
    }
	
	/* --- ADD THIS: Class to completely strip elements from the print page --- */
    .no-print {
        display: none !important;
    }
}
