/* Legacy list/search must stay hidden when React is active ([hidden] vs display:flex) */
#tasks-list[hidden],
#sidebar-task-search[hidden],
#hotels-list[hidden],
#alerts-list[hidden] {
  display: none !important;
}

/* Faza 3.2 — lista terminów (React) w panelu bocznym */
#sidebar-tasks.sidebar-tasks--react .sidebar-section.flex-grow {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#sidebar-react-root.sidebar-react-active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.sidebar-react-terminy {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 0.35rem;
}

.sidebar-react-search {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.5rem;
  background: var(--bg-secondary, #f1f5f9);
  border-radius: 6px;
  flex-shrink: 0;
}

.sidebar-react-search input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.8rem;
  outline: none;
  min-width: 0;
}

.sidebar-react-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 0 4px;
  margin: 0;
}

.task-card:hover,
.task-card.search-highlight {
  background: var(--bg-hover, #eff6ff);
}

.task-card.no-coords {
  border-left-color: var(--warning, #f59e0b);
}

/* --- Grouping by technician (UX #5) --- */
.sidebar-react-group {
  display: contents;
}

.sidebar-react-group-header {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 4px 8px;
  font-weight: 700;
  font-size: 13px;
  background: var(--bg-surface-alt, var(--bg-secondary, #f1f5f9));
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  margin-top: 4px;
  flex-shrink: 0;
}

.sidebar-react-group-header:first-child {
  margin-top: 0;
}

.sidebar-react-group-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

.sidebar-react-group-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-react-group-count {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--gray-500, #64748b);
  background: var(--bg-primary, #fff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 10px;
  padding: 0 0.3rem;
  min-width: 1rem;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-react-day-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--gray-400, #94a3b8);
  padding: 5px 8px 2px;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.sidebar-react-day-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color, #e2e8f0);
}

/* Toggle button active state */
.sidebar-react-group-toggle.is-active {
  color: var(--primary, #2563eb);
  opacity: 1;
}

.sidebar-react-group-toggle {
  opacity: 0.55;
  flex-shrink: 0;
}

.sidebar-react-group-toggle:hover {
  opacity: 1;
}

.sidebar-react-count {
  font-size: 0.7rem;
  color: var(--text-muted, #64748b);
  text-align: center;
  padding: 0.25rem;
  flex-shrink: 0;
  margin: 0;
}

.sidebar-react-empty {
  padding: 0.35rem 0.5rem;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-react-empty.empty-state--inline {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.35rem 0.5rem;
  min-height: 0;
}

.sidebar-react-empty.empty-state--inline i {
  display: none;
}

.sidebar-react-empty.empty-state--inline p,
.sidebar-react-empty.empty-state--inline span {
  font-size: 0.75rem;
  font-weight: 500;
  margin: 0;
  color: var(--text-muted, #64748b);
}

.sidebar-react-empty.empty-state--inline .btn {
  margin-top: 0;
  padding: 0.15rem 0.45rem;
  font-size: 0.72rem;
  line-height: 1.3;
}

/* --- Hotele (3.3) --- */
#sidebar-hotels.sidebar-hotels--react .sidebar-section.flex-grow {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#sidebar-react-hotels-root.sidebar-react-active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.sidebar-react-hotele {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 0.35rem;
  overflow: hidden;
}

.sidebar-react-hotele__day {
  font-size: 0.72rem;
  color: var(--text-muted, #64748b);
  margin: 0;
  padding: 0.2rem 0.35rem;
  flex-shrink: 0;
}

.sidebar-react-hotele__toolbar {
  flex-shrink: 0;
}

.sidebar-react-accordion {
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  max-height: 45%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar-react-accordion:last-of-type {
  flex: 1;
  max-height: none;
}

.sidebar-react-accordion__btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  border: none;
  background: var(--bg-secondary, #f1f5f9);
  font: inherit;
  font-weight: 600;
  font-size: 0.78rem;
  cursor: pointer;
  text-align: left;
}

.sidebar-react-accordion__title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.sidebar-react-accordion__body {
  overflow-y: auto;
  padding: 0.35rem;
  flex: 1;
  min-height: 0;
}

.sidebar-react-badge {
  font-size: 0.68rem;
  font-weight: 600;
  background: var(--primary, #2563eb);
  color: #fff;
  border-radius: 10px;
  padding: 0 0.35rem;
  min-width: 1.1rem;
  text-align: center;
}

.sidebar-react-hint {
  font-size: 0.72rem;
  color: var(--text-muted, #64748b);
  margin: 0 0 0.35rem;
}

.sidebar-react-hotel-assignments,
.sidebar-react-hotel-saved {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-react-hotel-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0.4rem 0.45rem;
  border: none;
  border-radius: 4px;
  background: var(--bg-primary, #fff);
  font: inherit;
  font-size: 0.75rem;
  text-align: left;
  cursor: pointer;
}

.sidebar-react-hotel-row:hover {
  background: var(--bg-hover, #e8f0fe);
}

.sidebar-react-hotel-row__main {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-react-hotel-row__action {
  font-size: 0.68rem;
  color: var(--primary, #2563eb);
  flex-shrink: 0;
}

.sidebar-react-muted {
  color: var(--text-muted, #94a3b8);
  font-weight: 400;
}

.sidebar-react-saved-card {
  display: flex;
  gap: 0.35rem;
  padding: 0.4rem 0.45rem;
  background: var(--bg-primary, #fff);
  border-radius: 4px;
  border: 1px solid var(--border-color, #e2e8f0);
}

.sidebar-react-hotel--inactive .sidebar-react-saved-card {
  opacity: 0.65;
}

.sidebar-react-saved-card__info {
  flex: 1;
  min-width: 0;
}

.sidebar-react-saved-card__name {
  font-weight: 600;
  font-size: 0.78rem;
}

.sidebar-react-saved-card__addr,
.sidebar-react-saved-card__meta {
  font-size: 0.7rem;
  color: var(--text-muted, #64748b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-react-saved-card__actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

/* --- Alerty (3.4) --- */
#sidebar-alerts.sidebar-alerts--react .sidebar-section.flex-grow {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#sidebar-react-alerts-root.sidebar-react-active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.sidebar-react-alerty {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 0.35rem;
  overflow-y: auto;
}

.sidebar-react-alerty__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex-shrink: 0;
}

.sidebar-react-alert {
  padding: 0.4rem 0.45rem;
  border-radius: 4px;
  border: 1px solid var(--border-color, #e2e8f0);
  background: var(--bg-primary, #fff);
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
}

.sidebar-react-alert.error {
  border-left: 3px solid var(--danger, #dc2626);
}

.sidebar-react-alert.warning {
  border-left: 3px solid var(--warning, #d97706);
}

.sidebar-react-alert.critical {
  border-left: 3px solid #b91c1c;
}

.sidebar-react-alert.muted {
  opacity: 0.75;
}

.sidebar-react-alert__addr {
  font-weight: 600;
  word-break: break-word;
}

.sidebar-react-alert__reason,
.sidebar-react-alert__meta {
  color: var(--text-muted, #64748b);
  font-size: 0.7rem;
  margin-top: 0.15rem;
}

.sidebar-react-alert__subtitle {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.sidebar-react-alert__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.35rem;
}

.sidebar-react-geocode-log {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.72rem;
}

.sidebar-react-geocode-log__item {
  padding: 0.3rem 0;
  border-bottom: 1px dashed var(--border-color, #e2e8f0);
}

.sidebar-react-geocode-log__time {
  display: block;
  color: var(--text-muted, #94a3b8);
  font-size: 0.65rem;
}

/* ===== Faza E / 18.06 — panel boczny: czysty, czytelny, zarządczy ===== */

/* Nagłówek grupy technika */
.sidebar-react-group-header {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 5px 8px 5px 10px;
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-left: 3px solid var(--group-accent, transparent);
  background: color-mix(in srgb, var(--group-accent, transparent) 9%, var(--bg-surface-alt, #f1f5f9));
  border-bottom: 1px solid color-mix(in srgb, var(--group-accent, transparent) 18%, var(--border-color, #e2e8f0));
  border-radius: 0;
  box-shadow: none;
  margin-top: 6px;
}

.sidebar-react-group-header:first-child {
  margin-top: 0;
}

.sidebar-react-group-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 15%, transparent);
}

.sidebar-react-group-contact {
  flex-shrink: 0;
  opacity: 0.45;
  padding: 2px 5px;
  line-height: 1;
  border-radius: 4px;
  transition: opacity 0.12s, background 0.12s;
}

.sidebar-react-group-contact:hover {
  opacity: 1;
  color: var(--primary, #2563eb);
  background: var(--bg-primary, #fff);
}

/* Karty zapisanych hoteli — wyrazniejsze, z lepszym hover */
.sidebar-react-saved-card {
  gap: 0.5rem;
  padding: 0.5rem 0.55rem;
  border-radius: 8px;
  transition: border-color var(--transition-fast, 0.15s), box-shadow var(--transition-fast, 0.15s);
}

.sidebar-react-saved-card:hover {
  border-color: var(--primary, #2563eb);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

.sidebar-react-saved-card__name {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.sidebar-react-saved-card__name::before {
  content: "\f594"; /* fa-hotel */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  color: var(--primary, #2563eb);
  font-size: 0.72rem;
}

/* Wiersz przypisania hotelu — wieksza klikalnosc i akcent */
.sidebar-react-hotel-row {
  padding: 0.5rem 0.55rem;
  border-radius: 8px;
}

.sidebar-react-hotel-row__action {
  font-weight: 600;
}

/* Pasek narzedzi hoteli */
.sidebar-react-hotele__toolbar .btn {
  width: 100%;
  justify-content: center;
}
