/* Patients Page */
.sync-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--on-surface-var);
  opacity: 0.7;
}
.sync-bar .material-icons-round {
  font-size: 13px;
}
.sync-bar.sync-bar--stale {
  opacity: 1;
  color: var(--accent-orange, #f59e0b);
}
.sync-bar.sync-bar--error {
  opacity: 1;
  color: var(--accent-red, #ef4444);
}
.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  padding: 6px 0;
  cursor: pointer;
}

.check-item input {
  accent-color: var(--primary-light);
}

/* Layout and style alignments for the main filter controls */
.filter-selects {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-select {
  height: 38px;
  border-width: 1px; /* 1px border instead of 1.5px for simpler look */
  box-sizing: border-box;
}

/* Redesign the Advanced Search Button to look like a sibling dropdown rather than a heavy secondary button */
.filter-selects .adv-search-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--outline-var); /* Matches dropdown border */
  background: var(--surface-low);
  color: var(--on-surface-var);
  font-size: 0.85rem;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: none;
  box-sizing: border-box;
}

.filter-selects .adv-search-btn:hover {
  border-color: var(--primary-light);
  color: var(--primary-light);
  background: var(--surface-mid);
}

.filter-selects .adv-search-btn .material-icons-round {
  font-size: 18px;
}

/* Advanced Search Panel styling */
.adv-search-panel {
  margin-top: -20px;
  margin-bottom: 20px;
  padding: 16px 20px; /* Reduced padding for cleaner look */
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
  border-top: 1px solid var(--outline-var) !important;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-sm); /* Subtle shadow instead of heavy md */
  transition: all 0.3s ease;
}

.adv-search-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--outline-var);
}

.adv-results-count {
  font-size: 0.78rem;
  color: var(--primary-light);
  font-weight: 600;
  margin-left: 6px;
}

.adv-clear-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--accent-red);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.adv-clear-btn:hover {
  background: rgba(239, 68, 68, 0.08);
}

/* 3-column / auto-wrapping grid that prevents squishing and overlaps */
.adv-search-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); /* Prevents overlap/squishing */
  gap: 16px 20px;
}

.adv-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* Simple, clean, elegant label styling without icons */
.adv-field label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--on-surface-var);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
}

/* Hide the material icons inside labels to simplify UI */
.adv-field label .material-icons-round {
  display: none;
}

/* Unified and slim inputs */
.adv-input {
  background: var(--surface-low);
  border: 1px solid var(--outline-var); /* 1px border for simpler look */
  border-radius: var(--radius-md);
  padding: 6px 12px;
  font-size: 0.85rem;
  color: var(--on-surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
  height: 38px; /* Standardize input height to match filter controls */
  box-sizing: border-box;
}

.adv-input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px var(--primary-soft);
  background: #fff;
  outline: none;
}

/* Patient detail modal responsive */
@media (max-width: 480px) {
  .patient-detail-grid {
    grid-template-columns: 1fr !important;
  }
  #viewPatientBody > div {
    padding: 0 16px 16px !important;
  }
  #viewPatientBody .mini-avatar {
    width: 48px !important;
    height: 48px !important;
    font-size: 1rem !important;
  }
  #viewPatientBody h3 {
    font-size: 1.1rem !important;
  }
  #viewPatientBody > div > div:first-child {
    gap: 12px !important;
  }
}

/* Badge on the main Advanced button */
.adv-active-badge {
  background: var(--primary-light);
  color: #fff;
  border-radius: var(--radius-full);
  padding: 2px 6px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: 6px;
  line-height: 1;
  display: inline-block;
}
