/**
 * okloadexpress Admin — brand / logo system
 * Single logo in header (no dark/light × sm/lg duplicates)
 */

:root {
  --brand-header-h: 70px;
  --brand-box-w: 250px;
  --brand-logo-h: 52px;
  --brand-logo-max-w: 210px;
  --brand-pad-x: 16px;
}

/* ── Header brand container ───────────────────────────────────────── */
.navbar-header .navbar-brand-box,
.navbar-brand-box.brand-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--brand-box-w);
  min-width: var(--brand-box-w);
  max-width: var(--brand-box-w);
  height: var(--brand-header-h);
  padding: 0 var(--brand-pad-x);
  margin: 0;
  text-align: center;
  box-sizing: border-box;
  overflow: hidden;
}

.navbar-brand-box .brand-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  line-height: 0;
  text-decoration: none;
}

/* One logo — height-driven, never stretched */
.navbar-brand-box .brand-logo {
  display: block;
  height: var(--brand-logo-h);
  width: auto;
  max-width: var(--brand-logo-max-w);
  max-height: var(--brand-logo-h);
  object-fit: contain;
  object-position: center center;
  image-rendering: auto;
  border: 0;
  background: transparent;
}

/* Keep hamburger aligned with brand */
.navbar-header > .d-flex:first-child {
  align-items: center;
  min-height: var(--brand-header-h);
}

#vertical-menu-btn.header-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--brand-header-h);
  align-self: center;
}

/* Collapsed sidebar: shrink brand rail + logo */
body.vertical-collpsed .navbar-brand-box.brand-box,
body.vertical-collpsed .navbar-header .navbar-brand-box {
  width: 70px;
  min-width: 70px;
  max-width: 70px;
  padding: 0 6px;
}

body.vertical-collpsed .navbar-brand-box .brand-logo {
  height: 32px;
  max-height: 32px;
  max-width: 56px;
}

body[data-sidebar="dark"] .navbar-brand-box.brand-box {
  background: #2a3042;
}

/* Tablet */
@media (max-width: 991.98px) {
  :root {
    --brand-logo-h: 44px;
    --brand-logo-max-w: 160px;
    --brand-pad-x: 12px;
  }
  .navbar-header .navbar-brand-box,
  .navbar-brand-box.brand-box {
    width: auto;
    min-width: 120px;
    max-width: 180px;
  }
}

/* Mobile */
@media (max-width: 575.98px) {
  :root {
    --brand-logo-h: 36px;
    --brand-logo-max-w: 120px;
    --brand-pad-x: 8px;
  }
  .navbar-header .navbar-brand-box,
  .navbar-brand-box.brand-box {
    width: auto;
    min-width: 96px;
    max-width: 140px;
  }
}

/* ── Settings preview ─────────────────────────────────────────────── */
.brand-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 140px;
  height: 72px;
  padding: 8px 12px;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  overflow: hidden;
}

.brand-preview img,
#weblogoPreview.brand-preview-img {
  display: block;
  width: auto !important;
  height: 56px !important;
  max-width: 100% !important;
  object-fit: contain;
  object-position: center;
  background: transparent;
}

/* ── Print / report ───────────────────────────────────────────────── */
.brand-print-logo {
  display: block;
  height: 36px !important;
  width: auto !important;
  max-width: 140px !important;
  max-height: 36px !important;
  object-fit: contain;
  object-position: left center;
}

@media print {
  .no-print,
  .order-preview-toolbar,
  .modal-header .btn-close-preview,
  .popup_open,
  .cmd {
    display: none !important;
  }

  body * {
    visibility: hidden !important;
  }

  #divprint,
  #divprint * {
    visibility: visible !important;
  }

  #divprint {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 12mm;
    box-shadow: none !important;
  }

  .brand-print-logo,
  .order-preview-brand .brand-print-logo {
    height: 28px !important;
    max-width: 120px !important;
    max-height: 28px !important;
  }

  .order-preview-sheet {
    border: none !important;
    box-shadow: none !important;
  }
}

/* ── Order preview modal ──────────────────────────────────────────── */
#myModal .modal-dialog {
  max-width: 760px;
}

#myModal .modal-content {
  border: 0;
  border-radius: 12px;
  overflow: hidden;
}

#myModal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #eef2f7;
  background: #fff;
}

#myModal .modal-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

/* Replace giant blue circular close with a compact control */
#myModal .modal-header .close,
#myModal .modal-header .popup_open,
#myModal .modal-header .btn-close-preview,
.popup_open {
  position: static !important;
  width: 32px !important;
  height: 32px !important;
  min-width: 32px;
  border-radius: 8px !important;
  padding: 0 !important;
  margin: 0 !important;
  background: #f1f3f7 !important;
  color: #495057 !important;
  border: 1px solid #e3e6ed !important;
  opacity: 1 !important;
  font-size: 20px !important;
  line-height: 28px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  box-shadow: none !important;
}

#myModal .modal-header .close:hover,
#myModal .modal-header .popup_open:hover,
.popup_open:hover {
  background: #e9ecef !important;
  color: #212529 !important;
}

#myModal .modal-body {
  padding: 16px 18px 20px;
  background: #f7f9fc;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}

.order-preview-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 12px;
}

.order-preview-sheet {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  padding: 16px;
}

.order-preview-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eef2f7;
}

.order-preview-brand-name {
  font-weight: 600;
  font-size: 15px;
  color: #212529;
  line-height: 1.2;
}

.order-preview-brand-sub {
  font-size: 12px;
  color: #74788d;
}

.order-preview-status-pill {
  margin-left: auto;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #f1f3f5;
  color: #495057;
  border: 1px solid #ced4da;
  white-space: nowrap;
  text-transform: capitalize;
}

.order-preview-status-pill.status-cancelled,
.order-preview-status-pill.status-canceled,
.order-preview-status-pill.status-rejected {
  background: #fff5f5;
  color: #c92a2a;
  border-color: #ffa8a8;
}

.order-preview-status-pill.status-completed,
.order-preview-status-pill.status-complete {
  background: #ebfbee;
  color: #2b8a3e;
  border-color: #8ce99a;
}

.order-preview-status-pill.status-pending {
  background: #fff4e6;
  color: #d9480f;
  border-color: #ffc078;
}

.order-preview-status-pill.status-processing {
  background: #e7f5ff;
  color: #1864ab;
  border-color: #74c0fc;
}

.order-preview-status-pill.status-on-route,
.order-preview-status-pill.status-onroute {
  background: #e5dbff;
  color: #5f3dc4;
  border-color: #b197fc;
}

.order-preview-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.order-preview-meta > div {
  background: #f8f9fb;
  border: 1px solid #eef2f7;
  border-radius: 8px;
  padding: 10px 12px;
}

.order-preview-meta span {
  display: block;
  font-size: 11px;
  color: #74788d;
  margin-bottom: 4px;
}

.order-preview-meta strong {
  font-size: 13px;
  color: #212529;
  word-break: break-word;
}

.order-preview-card {
  border: 1px solid #eef2f7;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: #fff;
}

.order-preview-card-title {
  font-size: 13px;
  font-weight: 600;
  color: #343a40;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.order-preview-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed #edf0f5;
  font-size: 13px;
}

.order-preview-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.order-preview-row span {
  color: #74788d;
}

.order-preview-row strong {
  color: #212529;
  text-align: right;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.order-preview-row-total {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid #e9ecef;
  border-bottom: 0;
}

.order-preview-grid3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.order-preview-grid3 span {
  display: block;
  font-size: 11px;
  color: #74788d;
  margin-bottom: 4px;
}

.order-preview-grid3 p {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: #212529;
  word-break: break-word;
}

.order-preview-stop {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #212529;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.order-preview-thumb {
  width: 18px !important;
  height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  object-fit: contain;
  vertical-align: middle;
}

@media (max-width: 767.98px) {
  .order-preview-meta,
  .order-preview-grid3 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 575.98px) {
  .order-preview-meta,
  .order-preview-grid3 {
    grid-template-columns: 1fr;
  }
}

/* ── Layout: never clip page headings under the sidebar ─────────────
 * Theme sets .main-content { overflow:hidden } which clips .h5_set
 * section titles (and first-line content) against the fixed sidebar.
 */
.main-content {
  overflow: visible !important;
  overflow-x: hidden !important;
  overflow-y: visible !important;
}

.page-content,
.page-content .container-fluid,
.page-content .card,
.page-content .card-body {
  overflow: visible;
}

.h5_set {
  position: relative;
  z-index: 1;
  clear: both;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  display: block;
  padding-left: 0;
  margin-left: 0;
  overflow: visible;
  word-wrap: break-word;
}

/* Keep content clear of the fixed vertical menu on small glitches */
@media (min-width: 992px) {
  body:not(.vertical-collpsed) .main-content {
    margin-left: 250px;
  }
}
