/* =========================================================
   RECEBIMENTO DE AMOSTRAS
   ========================================================= */

/* Filtros */

.samples-toolbar {
  grid-template-columns:
    minmax(230px, 1.2fr)
    150px
    165px
    165px
    190px
    auto;
  align-items: end;
}

.samples-toolbar input,
.samples-toolbar select {
  height: 48px;
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
}

.samples-toolbar input::placeholder {
  color: #7a8aa3;
  font-size: 16px;
}

.samples-toolbar .search-box {
  height: 48px;
}

.samples-toolbar .search-box input {
  height: 100%;
}

.samples-toolbar .search-box span {
  width: 22px;
  font-size: 18px;
}

.date-filter {
  display: grid;
  gap: 5px;
  color: var(--muted);
}

.date-filter > span {
  color: #6f7f96;
  font-size: 12px;
  font-weight: 600;
}

.date-filter input {
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}

/* Tabela */

.samples-table {
  min-width: 1370px;
}

.c-reg {
  width: 7%;
}

.c-farm {
  width: 21%;
}

.c-origin {
  width: 10%;
}

.c-date {
  width: 10%;
}

.c-type {
  width: 13%;
}

.c-qty {
  width: 7%;
}

.c-actions {
  width: 8%;
}

.sample-farm {
  display: flex;
  align-items: center;
  gap: 11px;
}

.sample-farm-code {
  width: 43px;
  height: 43px;
  border: 1px solid #c9e2fb;
  border-radius: 13px;
  background: linear-gradient(145deg, #dcebff, #eff7ff);
  color: var(--blue-900);
  display: grid;
  place-items: center;
  font-weight: 800;
}

.sample-farm strong,
.sample-farm small {
  display: block;
}

.sample-farm small {
  margin-top: 4px;
  color: var(--muted);
}

.origin-badge,
.sample-type-badge,
.register-badge {
  display: inline-flex;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.origin-badge {
  background: #edf4fb;
  color: #22527e;
}

.sample-type-badge {
  background: #f1edff;
  color: #6545a7;
}

.register-badge {
  background: #e9f3ff;
  color: #155aa3;
}

.pending-value {
  color: #91a0b3;
  font-size: 12px;
}

/* Estado vazio */

.empty-state[hidden] {
  display: none !important;
}

.empty-state {
  min-height: 420px;
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
}

.empty-state-image {
  width: 230px;
  max-width: 80%;
  opacity: .96;
  user-select: none;
  pointer-events: none;
}

.empty-state h3 {
  margin: 0;
  color: #0b2f63;
  font-size: 26px;
  font-weight: 750;
}

.empty-state p {
  max-width: 430px;
  margin: 0;
  color: #667a99;
  font-size: 16px;
  line-height: 1.5;
}

/* Modal */

.sample-modal-card {
  width: min(970px, 96vw);
  max-height: 94vh;
  display: flex;
  flex-direction: column;
}

.sample-modal-card form {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.sample-modal-card .modal-body {
  min-height: 0;
}

.sample-form-grid {
  align-items: start;
}

.notes-control {
  min-height: 105px;
  resize: vertical;
}

.nested-modal {
  z-index: 120;
  background: rgba(3, 27, 58, .62);
}

.quick-farm-card {
  width: min(820px, 96vw);
}

.code-control {
  background: #f3f8ff;
  color: var(--blue-900);
  font-weight: 800;
  letter-spacing: .1em;
}

.form-message.success {
  color: #087448;
}

/* Garante que os dropdowns possam sobrepor as linhas seguintes */
.sample-modal-card,
.sample-modal-card form,
.sample-modal-card .modal-body,
.sample-form-grid {
  position: relative;
}

.sample-form-grid {
  overflow: visible;
}

.sample-form-grid > .field {
  position: relative;
  z-index: 1;
}

/* O campo que possui uma lista aberta sobe acima dos demais campos do grid. */
.sample-form-grid > .field:has(.lookup-control.open) {
  z-index: 1000;
}

/* =========================================================
   LOOKUPS PERSONALIZADOS
   ========================================================= */

.lookup-control {
  position: relative;
  width: 100%;
  min-width: 0;
  z-index: 1;
}

.lookup-control.open {
  z-index: 1001;
}

.lookup-input {
  width: 100%;
  height: 48px;
  padding: 0 76px 0 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  outline: none;
  transition:
    border-color .18s ease,
    box-shadow .18s ease,
    border-radius .18s ease;
}

.lookup-input::placeholder {
  color: #8292a6;
  font-size: 16px;
  font-weight: 400;
}

.lookup-input:focus,
.lookup-control.open .lookup-input {
  border-color: #2694ed;
  box-shadow:
    0 0 0 4px rgba(38, 148, 237, .11),
    0 8px 20px rgba(22, 103, 177, .06);
}

.lookup-control.open .lookup-input {
  border-bottom-left-radius: 9px;
  border-bottom-right-radius: 9px;
}

.lookup-clear,
.lookup-toggle {
  position: absolute;
  top: 50%;
  z-index: 5;
  padding: 0;
  border: 0;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  transform: translateY(-50%);
}

.lookup-clear {
  right: 41px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: #7b8fa5;
  display: none;
  font: 20px/1 Arial, sans-serif;
  transition:
    background .16s ease,
    color .16s ease;
}

.lookup-control.has-value .lookup-clear {
  display: grid;
}

.lookup-clear:hover {
  background: #eaf5ff;
  color: #0872ca;
}

.lookup-toggle {
  right: 5px;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: #173f6a;
  font-size: 11px;
  transition:
    background .16s ease,
    transform .18s ease;
}

.lookup-toggle:hover {
  background: #edf6ff;
}

.lookup-control.open .lookup-toggle {
  transform: translateY(-50%) rotate(180deg);
}

.lookup-results {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  z-index: 1002;
  width: 100%;
  min-width: 100%;
  max-width: 100%;
  max-height: 245px;
  padding: 7px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid rgba(53, 151, 231, .24);
  border-radius: 12px 12px 16px 16px;
  background: rgba(255, 255, 255, .985);
  box-shadow:
    0 14px 30px rgba(17, 61, 105, .14),
    0 0 0 3px rgba(43, 149, 232, .04);
  backdrop-filter: blur(12px);
}

.lookup-results[hidden] {
  display: none !important;
}

.lookup-results::before {
  content: "";
  position: absolute;
  top: 0;
  left: 12px;
  right: 12px;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(46, 159, 240, .46),
    transparent
  );
}

.lookup-result-item {
  width: 100%;
  min-height: 45px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #14375f;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background .15s ease,
    color .15s ease,
    transform .15s ease;
}

.lookup-result-item:hover,
.lookup-result-item.active {
  background: linear-gradient(90deg, #edf7ff, #f7fbff);
  color: #086abb;
  transform: translateX(2px);
}

.lookup-result-code {
  min-width: 42px;
  padding: 5px 7px;
  border-radius: 8px;
  background: #e4f2ff;
  color: #0967b4;
  font-size: 11px;
  font-weight: 850;
  text-align: center;
}

.lookup-result-content {
  min-width: 0;
  flex: 1;
}

.lookup-result-title,
.lookup-result-subtitle {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lookup-result-title {
  font-size: 14px;
  font-weight: 700;
}

.lookup-result-subtitle {
  margin-top: 3px;
  color: #7a8ca0;
  font-size: 12px;
  font-weight: 400;
}

.lookup-no-result {
  min-height: 65px;
  padding: 16px;
  color: #7b8ca0;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 13px;
  line-height: 1.45;
}

.lookup-results::-webkit-scrollbar {
  width: 7px;
}

.lookup-results::-webkit-scrollbar-track {
  background: transparent;
}

.lookup-results::-webkit-scrollbar-thumb {
  border: 2px solid #fff;
  border-radius: 999px;
  background: #bdd8ee;
}

.lookup-results::-webkit-scrollbar-thumb:hover {
  background: #90bfe2;
}

.farm-picker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}

.farm-picker-row .quick-add-btn {
  min-height: 48px;
  white-space: nowrap;
}

/* Responsividade */

@media (max-width: 1300px) {
  .samples-toolbar {
    grid-template-columns:
      1fr
      150px
      160px
      160px
      180px
      auto;
  }
}

@media (max-width: 1050px) {
  .samples-toolbar {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .samples-toolbar .search-box:first-child {
    grid-column: span 2;
  }
}

@media (max-width: 720px) {
  .farm-picker-row {
    grid-template-columns: 1fr;
  }

  .farm-picker-row .quick-add-btn {
    width: 100%;
  }
}
