/* ===== Famavto UI theme (stopgo / main_search style) ===== */
:root {
  /* BMW logo palette: blue / black / white / silver */
  --ub-primary: #0066B1;
  --ub-primary-hover: #004E8C;
  --ub-primary-dark: #003366;
  --ub-black: #111111;
  --ub-accent: #1C69D4;
  --ub-head-bg: #C5D8ED;
  --ub-soft: #E8F1FA;
  --ub-soft-alt: #F7F9FC;
  --ub-border: #C5D4E8;
  --ub-border-input: #B8C9DC;
  --ub-text: #1a1a1a;
  --ub-muted: #6F6F6F;
  --ub-radius: 8px;
  --ub-radius-sm: 6px;
}

body {
  background: #EEF2F7 !important;
  color: var(--ub-text);
}

/* ---- page shell ---- */
.ms-page,
.atk-page {
  color: var(--ub-text);
  font-family: 'Open Sans', sans-serif;
  padding: 0 8px 24px;
}

.ms-head,
.atk-head,
.content-header.container-fluid,
.content-header.custoom-color-cont,
.custoom-color-cont {
  background: linear-gradient(90deg, #E8F1FA 0%, #C5D8ED 45%, #FFFFFF 100%) !important;
  border-bottom: 3px solid #0066B1 !important;
  padding: 10px 15px 14px !important;
  margin: 0 0 12px !important;
  border-radius: 0 0 var(--ub-radius) var(--ub-radius);
  box-shadow: 0 1px 0 #11111122;
}

.ms-head .heading,
.atk-head .heading,
.content-header .heading,
.custoom-color-cont .heading,
h5.heading {
  margin: 0 !important;
  color: var(--ub-primary) !important;
  font-size: 1.15rem !important;
  font-weight: 600 !important;
  text-transform: none !important;
}

.heading:after {
  display: none !important;
}

.content-header .heading a,
.custoom-color-cont .heading a,
h5.heading a {
  color: var(--ub-primary) !important;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  margin-left: 8px;
  opacity: 0.9;
}

.content-header .heading a:hover,
.custoom-color-cont .heading a:hover,
h5.heading a:hover {
  opacity: 1;
  text-decoration: underline;
}

/* ---- cards ---- */
.card,
.ms-card,
.atk-card,
.ms-results-card {
  background: #fff;
  border: 1px solid var(--ub-border) !important;
  border-radius: var(--ub-radius) !important;
  box-shadow: 0 1px 3px rgba(0, 102, 177, 0.06) !important;
  margin-top: 0 !important;
}

/* results tables can clip; search cards must NOT (ui-select dropdown) */
.ms-results-card {
  overflow: hidden;
}
.ms-card,
.atk-card {
  overflow: visible;
}

.card > .card-block,
.card > .card-body {
  padding: 12px 14px;
}

.ms-results-meta,
.atk-results-meta {
  padding: 10px 14px;
  background: var(--ub-soft);
  border-bottom: 1px solid var(--ub-border);
  color: var(--ub-primary);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
}

.ms-results-meta b,
.atk-results-meta b {
  font-weight: 700;
}

/* ---- forms ---- */
.form-control:not(.ui-select-search-hidden),
select.form-control,
input.form-control:not(.ui-select-search-hidden),
textarea.form-control {
  border-radius: var(--ub-radius-sm) !important;
  border: 1px solid var(--ub-border-input) !important;
  min-height: 38px;
  font-size: 13px !important;
  color: var(--ub-text) !important;
  box-shadow: none !important;
  background: #fff !important;
}

/* ui-select: hidden search must stay collapsed when closed */
.ui-select-bootstrap .ui-select-search-hidden,
input.ui-select-search-hidden.form-control {
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  overflow: hidden !important;
}

.form-control:focus:not(.ui-select-search-hidden),
select.form-control:focus {
  border-color: var(--ub-accent) !important;
  box-shadow: 0 0 0 2px rgba(74, 144, 200, 0.2) !important;
  outline: none !important;
}

.ui-select-bootstrap {
  position: relative;
  width: 100%;
}

.ui-select-bootstrap > .ui-select-match > .btn {
  border-radius: var(--ub-radius-sm) !important;
  border: 1px solid var(--ub-border-input) !important;
  min-height: 38px !important;
  background: #fff !important;
  color: var(--ub-text) !important;
  text-align: left !important;
  box-shadow: none !important;
}

.ui-select-bootstrap.open > .ui-select-match > .btn {
  border-color: var(--ub-accent) !important;
  box-shadow: 0 0 0 2px rgba(74, 144, 200, 0.2) !important;
}

.ui-select-choices.dropdown-menu,
.ui-select-bootstrap > .ui-select-choices {
  border-radius: var(--ub-radius-sm);
  border-color: var(--ub-border);
  box-shadow: 0 6px 16px rgba(0, 102, 177, 0.12);
  z-index: 2000 !important;
  max-height: 260px;
  overflow-y: auto;
}

/* dropdown attached to body (append-to-body) */
body > .ui-select-bootstrap.open {
  z-index: 10050 !important;
}

/* ---- buttons ---- */
.btn {
  border-radius: var(--ub-radius-sm) !important;
  font-weight: 600;
  min-height: 36px;
}

.btn-primary {
  background: var(--ub-primary) !important;
  border-color: var(--ub-primary) !important;
  color: #fff !important;
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--ub-primary-hover) !important;
  border-color: var(--ub-primary-hover) !important;
  color: #fff !important;
}

.btn-success {
  background: #28a745 !important;
  border-color: #28a745 !important;
}

.btn-warning {
  background: #f0ad4e !important;
  border-color: #eea236 !important;
  color: #fff !important;
}

.btn-info {
  border-radius: 4px !important;
}

/* ---- tables ---- */
.table thead th,
.table > thead > tr > th,
.atk-table th {
  background: var(--ub-soft) !important;
  color: var(--ub-primary) !important;
  font-weight: 600 !important;
  font-size: 12px !important;
  border-color: var(--ub-border) !important;
  white-space: nowrap;
}

.table tbody tr:nth-child(even):not(.collected):not(.sended):not(.finished):not(.cancled):not(.reserve):not(.separate):not(.sell):not(.write_off) {
  background: var(--ub-soft-alt);
}

.table-hover tbody tr:hover:not(.collected):not(.sended):not(.finished):not(.cancled) {
  background: #E8F2FB !important;
}

.table-bordered,
.table-bordered td,
.table-bordered th {
  border-color: #e2ebf0 !important;
}

.table-responsive {
  border: 1px solid var(--ub-border);
  border-radius: var(--ub-radius-sm);
  background: #fff;
}

/* ---- search form layouts (generic) ---- */
#searchform .form-group {
  margin-bottom: 8px;
}

#searchform .btn {
  border-radius: var(--ub-radius-sm) !important;
  min-height: 38px;
  font-weight: 600;
}

/* ---- content area ---- */
.content {
  padding: 0 10px 24px !important;
}

.right-aside {
  background: #EEF2F7;
}

/* pages with own wrapper (no .ms-page) */
.ubase-page .card {
  margin-bottom: 14px;
}

/* content-header: strip awkward top margin on nested headings */
.content-header .m-t-30,
.custoom-color-cont .m-t-30 {
  margin-top: 0 !important;
}

/* clients/report often use full-width header with margins — normalize */
.content-header[style*="margin-left"],
.content-header[style*="background"] {
  border-radius: 0 0 8px 8px;
}

/* ---- modals ---- */
.modal-content {
  border: none;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 102, 177, 0.2);
  overflow: hidden;
}

.modal-header,
.modal-content > .text-center h4,
.modal-body h4.text-info {
  color: var(--ub-primary);
}

.modal-footer {
  border-top: 1px solid #e2ebf0;
  background: #fafcfd;
}

/* ---- status colors (keep functional) ---- */
.reserve { background-color: #50fff3 !important; }
.separate { background-color: #eca8ff !important; }
.virtual { background: #f0e1ff !important; }

/* ---- tire/wheel filter fields ---- */
.tire_bl select,
.wheel_bl select {
  background-color: #e8f8ef !important;
  border-color: #a8dfc0 !important;
}

/* ---- sprav / admin forms ---- */
.form-horizontal .form-group,
.login_validator .form-group {
  margin-bottom: 10px;
}

/* ---- pagination ---- */
#page-Pagination,
.pagination {
  padding: 10px 4px;
}

/* ---- loading overlay ---- */
.loading-window {
  border-radius: var(--ub-radius);
}

/* ---- legend chips on old pages ---- */
.content-header .btn-info,
.custoom-color-cont .btn-info {
  width: 18px;
  height: 18px;
  padding: 0 !important;
  min-width: 18px;
  min-height: 18px !important;
  border-radius: 4px !important;
  vertical-align: middle;
  pointer-events: none;
}

/* ---- ms/atk helpers (shared) ---- */
.ms-card,
.atk-card {
  padding: 14px 16px;
  margin-bottom: 14px;
}

.ms-search-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px;
  gap: 14px;
  align-items: start;
}

.ms-search-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 14px;
}

.ms-field {
  min-width: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}

.ms-field-full { grid-column: 1 / -1; }

.ms-search-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ms-toggles {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  background: var(--ub-soft-alt);
  border: 1px solid #e2ebf0;
  border-radius: var(--ub-radius-sm);
  font-size: 13px;
  color: var(--ub-primary);
}

.ms-toggles > div {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
}

.ms-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e2ebf0;
}

.ms-actions-row .btn {
  min-width: 120px;
  padding: 8px 18px;
}

.ms-legend,
.atk-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  font-size: 12px;
  color: var(--ub-primary);
  width: 100%;
  margin-bottom: 4px;
}

/* ---- atk table (requests-style) ---- */
.atk-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--ub-border);
  border-radius: var(--ub-radius-sm);
  background: #fff;
}

.atk-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
}

.atk-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--ub-primary);
  padding: 8px 10px;
  background: var(--ub-soft);
  border-bottom: 1px solid var(--ub-border);
  white-space: nowrap;
}

.atk-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e8eef2;
  vertical-align: middle;
  font-size: 12px;
  color: var(--ub-text);
  background: #fff;
}

.atk-table tbody tr:nth-child(even):not(.collected):not(.sended):not(.finished):not(.cancled) td {
  background: var(--ub-soft-alt);
}

.atk-table tr.collected td { background-color: #fee92e !important; color: #333 !important; }
.atk-table tr.sended td { background-color: #fbb931 !important; color: #333 !important; }
.atk-table tr.finished td { background-color: greenyellow !important; color: #333 !important; }
.atk-table tr.cancled td { background-color: red !important; color: #fff !important; }
.atk-table tr.cancled td a { color: #fff; }

/* ---- mobile ---- */
@media (max-width: 1100px) {
  .ms-search-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 992px) {
  .ms-search-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .ms-search-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .ms-field-full { grid-column: 1 / -1; }
  .form-control:not(.ui-select-search-hidden),
  select.form-control,
  .ui-select-bootstrap > .ui-select-match > .btn {
    min-height: 42px !important;
    font-size: 16px !important;
  }
  .ms-actions-row .btn {
    flex: 1 1 calc(50% - 5px);
    min-width: 0;
  }
  .content {
    padding: 0 6px 20px !important;
  }
}
