@import url('../fonts/IRANSansXFaNum/fonts.css');

:root {
  --bs-font-sans-serif: "IRANSansX", sans-serif;
  --bs-body-font-family: var(--bs-font-sans-serif);
  --bs-border-radius: 0.3rem;
  --bs-body-font-size: 0.875rem;
  --navbar-height: 52px;
  --sidebar-width: 250px;
  --sidebar-width-collapsed: 60px;
}

.form-control,
.form-select,
.form-check-label,
.form-check-input,
.form-label,
.form-text,
.input-group-text,
.form-floating,
.form-range {
  font-size: 0.875rem;
}

.btn {
  font-size: 0.875rem;
}

/* Dropdowns */
.dropdown-menu,
.dropdown-item {
  font-size: 0.875rem;
}

.nav-link,
.navbar,
.navbar-brand {
  font-size: 0.875rem;
}

/* Tables */
.table {
  font-size: 0.875rem;
}

.card,
.list-group-item,
.alert,
.modal-content,
.tooltip,
.popover,
.toast {
  font-size: 0.875rem;
}

.tooltip {
  --bs-tooltip-font-size: 0.8rem;
  font-size: 0.8rem;
}
.tooltip .tooltip-inner {
  text-align: right;
}

.card-header {
  font-weight: 500;
}

.page-link,
.breadcrumb {
  font-size: 0.875rem;
}

/* Page header — breadcrumb on the leading side, actions on the trailing side.
   The last crumb replaces what used to be a per-page <h5> title. */
.page-header .breadcrumb-item > a {
  color: #6c757d;
  text-decoration: none;
}

.page-header .breadcrumb-item > a:hover {
  color: #000000;
}

.page-header .breadcrumb-item.active {
  font-weight: 600;
}

/* Mirror of the header actions at the end of the content, so long forms can be
   saved from either end. Populated by page-actions.js; stays invisible on the
   pages that opt out. */
.page-footer-actions {
  justify-content: flex-end;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--bs-border-color);
}

.page-footer-actions:empty {
  display: none;
}

.h6, h6 {
  font-size: 0.875rem;
}

.h1, .h2, .h3, .h4, .h5, .h6, h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
}

.h5, h5 {
  font-size: 1.125rem;
}

.x-small {
  font-size: 10px;
}

/* Tom Select (searchable selects). The bootstrap5 theme handles RTL via its own
   .rtl class (auto-applied under body[dir="rtl"]); we only cap the pill stack so a
   team with many loaders scrolls instead of pushing the form down. */
.ts-wrapper.multi .ts-control {
  max-height: 160px;
  overflow-y: auto;
  padding-right: 12px !important;
}

.ts-wrapper.form-select .ts-control {
  padding-right: 12px !important;
}

/* --- Flat "record sheet" fields (overrides Bootstrap's default field style) ---
   Inputs render as filled slots so empty fields stay recognizable, and turn into
   normal white inputs with a border on hover/focus. Applies to all form controls
   incl. Tom Select (.ts-control); file inputs keep their native look. */
.section-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #495057;
}
.form-control:not([type="file"]),
.form-select,
.ts-wrapper .ts-control {
  border: 1px solid transparent;
  background-color: #f4f5f7;
  box-shadow: none !important;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}
.form-control:not([type="file"]):hover,
.form-select:hover,
.ts-wrapper:hover .ts-control {
  border-color: var(--bs-border-color, #ced4da);
  background-color: #fff;
}
.form-control:not([type="file"]):focus,
.form-select:focus,
.ts-wrapper.focus .ts-control {
  border-color: #ddd;
  background-color: #fff;
}

/* --- Compact connected tabs (driver detail) ---
   Tabs sit flush against each other and the content box below, sharing borders.
   The active tab keeps its border and gains a bolder dark bottom edge to signal
   selection; its bottom padding is trimmed by the extra border width so the tab
   height stays put. */
.driver-tabs.nav-tabs {
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/old Edge */
}
.driver-tabs.nav-tabs::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}
.driver-tabs .nav-item {
  flex: 0 0 auto;
}
.driver-tabs .nav-link {
  color: #495057;
  white-space: nowrap;
  border-radius: 0;
  display: flex;
  align-items: center;
}
.driver-tabs .nav-link:hover {
  background-color: #f4f5f7;
  border-color: transparent !important;
}
.driver-tabs .nav-link.active {
  color: #212529;
  border-color: transparent;
  font-weight: 600;
  background-color: #f4f5f7;
  border-left: 1px solid #e9e9e9;
  border-right: 1px solid #e9e9e9;
}
.driver-tab-content {
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
  border-top: 0 !important;
}

.crew-item .crew-edit-btn {
  opacity: 0;
  transition: opacity 0.15s ease-in-out;
}
.crew-item:hover .crew-edit-btn,
.crew-item:focus-within .crew-edit-btn {
  opacity: 1;
}
/* Keep it usable on touch devices where hover isn't available */
@media (hover: none) {
  .crew-item .crew-edit-btn {
    opacity: 1;
  }
}

.table th,
.table td {
  min-width: fit-content;
  white-space: nowrap;
  font-size: 0.875rem;
}

.table th {
  font-weight: 600;
}

/* Grouped avatar circles (e.g. loaders column) */
.avatar-group {
  display: inline-flex;
  align-items: center;
}
.avatar-group .avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
  background-color: #e9ecef;
  color: #495057;
  border: 2px solid #fff;
  margin-inline-start: -10px;
  cursor: default;
}
.avatar-group .avatar-sm:first-child {
  margin-inline-start: 0;
}
.avatar-group .avatar-more {
  background-color: #0d6efd;
  color: #fff;
}

.color-swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, .15);
  vertical-align: -3px;
}

.table-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #6c757d;
  border-radius: 6px;
  line-height: 1;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.table-action:hover,
.table-action:focus-visible {
  color: #000000;
}
/* Page-header actions — same idiom as .table-action, sized to carry a label. */
.header-action {
  display: inline-flex;
  align-items: center;
  padding: 0 0.5rem;
  height: 30px;
  border: 0;
  background: transparent;
  color: #6c757d;
  border-radius: 6px;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.header-action:hover,
.header-action:focus-visible {
  color: #000000;
}
.header-action > i {
  font-size: 1rem;
}
.table-action > i {
  font-size: 1rem;
}
table.dataTable thead th {
  text-align: right !important;
}
/* DataTables toolbar spacing within the dashboard */
table.js-datatable + .dt-container,
.dt-container .dt-layout-row {
  margin-bottom: 0.5rem;
}
.dt-container .dt-search input {
  margin-inline-start: 0.5rem;
}
div.dt-container div.dt-paging {
  margin-bottom: .5rem !important;
}
div.dt-container span.select-info, div.dt-container span.select-item {
  margin-left: 0;
  margin-right: .5rem;
}

/* DataTables: use Bootstrap "primary subtle" for selected rows instead of solid primary.
   Scoped to the table so it overrides DataTables' :root defaults regardless of CSS load
   order (descendants inherit these RGB-triplet vars from the nearest ancestor). Values
   mirror --bs-primary-bg-subtle (#cfe2ff) and --bs-primary-text-emphasis (#052c65). */
table.js-datatable {
  --dt-row-selected: 207, 226, 255;
  --dt-row-selected-text: 5, 44, 101;
  --dt-row-selected-link: 5, 44, 101;
}

/* --- Dashboard layout: navbar, sidebar, mobile offcanvas (see base.html) --- */
.wrapper {
  display: flex;
  width: 100%;
  min-height: 100vh;
}
#sidebar {
  width: var(--sidebar-width);
  background-color: #f8f9fa;
  border-left: 1px solid #dee2e6;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  padding-top: var(--navbar-height);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
#sidebar::-webkit-scrollbar {
  display: none;
}
#sidebar .list-group {
  border-radius: 0;
}
/* Fixed-width icon column so glyphs stay aligned in a tidy vertical strip,
   which is what keeps the collapsed (icon-only) state readable. */
#sidebar .sidebar-link .bi:first-child,
#sidebar .sidebar-sublink .bi:first-child {
  flex: 0 0 1.25rem;
  width: 1.25rem;
  text-align: center;
  font-size: 1.1rem;
}
#sidebar .list-group-item {
  background-color: #f8f9fa;
  border: none;
  border-bottom: 1px solid #dee2e6;
}
#sidebar .list-group-item:last-child {
  border-bottom: none;
}
#sidebar .list-group-item.active {
  background-color: #e9ecef;
  color: #0a58ca;
  border-right: 3px solid #0a58ca;
  font-weight: 500;
}
/* Titled dividers that group the nav items into concepts, shared by the desktop
   sidebar and the mobile offcanvas. The gap above sets the group apart from the
   previous item; padding below breathes into its own. */
.sidebar-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.65rem;
  padding: 0.5rem 1rem 0.45rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #8a939b;
  background-color: #f8f9fa;
  border: none;
  text-align: start;
  user-select: none;
  cursor: pointer;
}
.sidebar-section:hover {
  color: #5c656d;
}
/* Chevron points down when the group is open and flips when it is collapsed. */
.sidebar-section .sidebar-chevron {
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}
.sidebar-section[aria-expanded="false"] .sidebar-chevron {
  transform: rotate(-90deg);
}
.sidebar-group.is-collapsed {
  display: none;
}
#content {
  width: calc(100% - var(--sidebar-width));
  margin-right: var(--sidebar-width);
  transition: width 0.25s ease, margin-right 0.25s ease;
}
@media (max-width: 991.98px) {
  #sidebar {
    display: none;
  }
  #content {
    width: 100% !important;
    margin-right: 0 !important;
  }
}

/* --- Collapsed (icon-only) sidebar --- */
.sidebar-collapsed #sidebar {
  width: var(--sidebar-width-collapsed);
}
.sidebar-collapsed #content {
  width: calc(100% - var(--sidebar-width-collapsed));
  margin-right: var(--sidebar-width-collapsed);
}
.sidebar-collapsed #sidebar .list-group-item.active {
  background-color: #e9ecef;
  color: #0a58ca;
  border-right: none;
  font-weight: 500;
}
/* Hide text, chevrons and count badges; keep only the leading icon centered. */
.sidebar-collapsed #sidebar .nav-label,
.sidebar-collapsed #sidebar .sidebar-chevron {
  /*display: none;*/
  font-size: 10px;
  font-weight: 500;
}
.sidebar-collapsed #sidebar .list-group-item.active .nav-label,
.sidebar-collapsed #sidebar .sidebar-chevron {
  font-weight: 600;
}
/* Section titles are meaningless without their labels, so hide them entirely
   in the icon-only sidebar. */
.sidebar-collapsed #sidebar .sidebar-section {
  display: none;
}
/* …and with no header to re-open them, their groups must always stay visible. */
.sidebar-collapsed #sidebar .sidebar-group.is-collapsed {
  display: block;
}
.sidebar-collapsed #sidebar .sidebar-link,
.sidebar-collapsed #sidebar .sidebar-sublink {
  justify-content: center;
  padding-inline: 0 !important;
}
/* Collapse the operations submenu indentation when there is no text. */
.sidebar-collapsed #sidebar .sidebar-sublink {
  padding-inline-start: 0 !important;
}
/* Show the ticket count as a small dot on the icon instead of a full pill. */
.sidebar-collapsed #sidebar .sidebar-link {
  position: relative;
  display: flex !important;
  flex-direction: column;
  gap: 0 !important;
  align-items: center;
  justify-content: center;
}
.sidebar-collapsed #sidebar .sidebar-link .badge {
  position: absolute;
  top: 6px;
  inset-inline-end: 12px;
  min-width: 8px;
  height: 8px;
  padding: 0;
  font-size: 0;
  border-radius: 50%;
}

.navbar {
  z-index: 1000;
  position: sticky;
  top: 0;
  /* Fixed height (not min-height) so the two-line brand can't grow the navbar
     past --navbar-height, which the fixed sidebar's padding-top relies on. */
  height: var(--navbar-height);
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}
#sidebarToggle {
  padding: 0.25rem 0.5rem;
  line-height: 1;
}
.navbar-brand-title {
  font-size: .875rem;
}
.navbar-brand-date {
  font-size: .7rem;
  font-weight: 400;
}
.offcanvas {
  z-index: 9999991;
}
/* Mobile offcanvas active state */
.offcanvas .list-group-item.active {
  background-color: #e9ecef !important;
  color: #0a58ca;
  border-right: 3px solid #0a58ca;
  border-bottom: 0;
  font-weight: 500;
}
.offcanvas .list-group-item {
  padding: 14px 16px;
}
jdp-container {
  z-index: 2000 !important;
}

/* Iranian license plate */
.plate {
  display: inline-flex;
  align-items: stretch;
  direction: ltr;
  border: 1px solid #bbbbbb;
  border-radius: 6px;
  background: #fff;
  /* font-family: "Vazirmatn", Tahoma, sans-serif; */
  font-weight: 700;
  line-height: 1;
  overflow: hidden;
  height: 30px;
  white-space: nowrap;
}
.plate__band {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2px;
  background: #003fa3;
  color: #fff;
  padding: 0 5px;
  font-size: 9px;
}
.plate__flag {
  display: block;
  width: 14px;
  height: 3px;
  background: linear-gradient(#239f40 0 33.33%, #fff 33.33% 66.66%, #da0000 66.66% 100%);
}
.plate__main {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0 4px;
  font-size: 12px;
  letter-spacing: 1px;
  color: #111;
}
.plate__letter {
  font-size: 12px;
}
.plate__region {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1px;
  padding: 0 7px;
  border-left: 1px solid #bbbbbb;
  color: #111;
}
.plate__region-label {
  font-size: 8px;
  font-weight: 500;
  color: #555;
  margin-bottom: 2px;
}
.plate__region-code {
  font-size: 12px;
}
/* Editable plate (dashboard/components/_plate_input.html): the same plate shape as
   above, sized to sit in a form row like any other input, with the number parts as
   real inputs. */
.plate-input {
  /* Block-level (not inline-flex) so it starts on its own line under the label,
     the way a .form-control does. */
  display: flex;
  align-items: stretch;
  direction: ltr;
  border: 1px solid #bbbbbb;
  border-radius: 6px;
  background: #fff;
  font-weight: 700;
  line-height: 1;
  overflow: hidden;
  /* Bootstrap's own .form-control height, so it lines up with its neighbours. */
  height: calc(1.5em + 0.75rem + 2px);
  /* Fills its column and grows with it, like any other form field. The band and
     region blocks stay fixed; the number parts below take up the slack. */
  width: 100%;
}
.plate-input:focus-within {
  border-color: #86b7fe;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.2);
}
.plate-input .plate__band {
  flex: 0 0 auto;
  padding: 0 5px;
  font-size: 9px;
  gap: 2px;
}
.plate-input .plate__main {
  flex: 1 1 auto;
  min-width: 0;
  gap: 2px;
  padding: 0 4px;
}
.plate-input .plate__region {
  flex: 0 0 auto;
  padding: 0 5px;
  gap: 1px;
}
.plate-input .plate__region-label {
  margin-bottom: 1px;
}
.plate-input__part {
  border: none;
  background: transparent;
  padding: 0;
  min-width: 0;
  color: #111;
  font-weight: 700;
  font-size: 13px;
  text-align: center;
  letter-spacing: 1px;
}
.plate-input__part:focus {
  outline: none;
  background: #eef4ff;
  border-radius: 3px;
}
.plate-input__part::placeholder {
  color: #c4c4c4;
  font-weight: 500;
}
/* Share the middle of the plate roughly in proportion to what each part holds
   (2 digits · 1 letter · 3 digits), shrinking to fit a narrow column and growing
   with a wide one. */
.plate-input__left {
  flex: 2 1 0;
}
.plate-input__letter {
  flex: 3 1 0;
  font-size: 12px;
  /* The arrow would crowd the plate; the select is obvious from context. */
  appearance: none;
  text-align-last: center;
  cursor: pointer;
}
.plate-input__right {
  flex: 3 1 0;
}
/* The region block keeps its own fixed width so the plate stays plate-shaped. */
.plate-input__region {
  width: 2em;
}

/* Raw fallback when plate text is not a valid Iranian plate */
.plate--raw {
  padding: 0 10px;
  align-items: center;
  font-size: 15px;
  letter-spacing: 1px;
  color: #111;
}
