/* styles/tasks.css
 * Очередь задач персонажа. ПК: левее большого портрета, на одной
 * нижней линии. Телефон: панель переезжает в общий док с вкладками
 * (см. mobile.css) и показывает только активную вкладку.
 */

#tasks-panel {
  position: fixed;
  right: 546px;
  bottom: 20px;
  width: 220px;
  max-height: calc(100vh - 170px);
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 9px 9px 8px;
  box-sizing: border-box;
  background: rgba(20, 20, 20, 0.88);
  border: 2px solid #555;
  border-radius: 8px;
  color: #d8d0c0;
  font-family: sans-serif;
  z-index: 58;
  overflow: hidden;
  user-select: none;
}

.tasks-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 18px;
}

.tasks-heading {
  flex: 1;
  color: #c0a060;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Поле поиска задачи: вместо кнопки «+» — начал печатать, выбрал из списка. */
.tasks-search-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px;
  border: 1px solid #4a3f2a;
  border-radius: 5px;
  background: #17150f;
}

.tasks-search-wrap:focus-within {
  border-color: #c0a060;
  background: #1d1a13;
}

.tasks-search-icon {
  flex: 0 0 auto;
  font-size: 10px;
  opacity: 0.7;
}

.tasks-search {
  flex: 1 1 auto;
  min-width: 0;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: #e2d4b8;
  font: inherit;
  font-size: 11px;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

.tasks-search::placeholder {
  color: #7a6e58;
  opacity: 1;
}

.tasks-owner {
  margin-top: -3px;
  padding-bottom: 2px;
  color: #a89a80;
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-bottom: 1px solid rgba(160, 140, 100, 0.25);
}

.tasks-add-menu {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 4px;
  max-height: 148px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  background: #17150f;
  border: 1px solid #5a4a2a;
  border-radius: 5px;
}

.tasks-add-menu[hidden] {
  display: none !important;
}

.tasks-add-empty {
  padding: 6px 7px;
  color: #8a8070;
  font-size: 11px;
  text-align: center;
}

.tasks-add-menu button {
  padding: 6px 7px;
  border: 1px solid #4a3f2a;
  border-radius: 4px;
  background: #242018;
  color: #e2d4b8;
  font: inherit;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
}

.tasks-add-menu button:hover,
.tasks-add-menu button:focus-visible,
.tasks-add-menu button.is-active {
  background: #332b1e;
  border-color: #a8894f;
}

.tasks-add-menu button.is-active {
  border-color: #c0a060;
  color: #f0d8a0;
}

.tasks-list {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.tasks-empty {
  padding: 14px 4px;
  color: #8a8070;
  font-size: 11px;
  text-align: center;
}

.task-row {
  display: grid;
  grid-template-columns: 18px 18px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 3px;
  min-height: 42px;
  padding: 4px 3px;
  box-sizing: border-box;
  border: 1px solid #3c3428;
  border-radius: 5px;
  background: #201d17;
}

.task-row.is-paused {
  border-color: #51452f;
  opacity: 0.82;
}

.task-row.is-blocked {
  border-color: #7a3c30;
}

.task-row.is-dragging {
  position: relative;
  z-index: 5;
  border-color: #d0aa5a;
  background: #2d271b;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
}

.task-grip {
  width: 18px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #7a6e58;
  font-size: 13px;
  line-height: 1;
  cursor: grab;
  touch-action: none;
}

.task-grip:hover,
.task-grip:focus-visible {
  background: #332b1e;
  color: #d0b477;
}

.task-grip:active {
  cursor: grabbing;
}

.task-priority {
  color: #8e7d5f;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.task-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.task-title {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  font-size: 11px;
}

.task-icon {
  flex: 0 0 auto;
  font-size: 12px;
}

.task-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.task-badge {
  flex: 0 0 auto;
  padding: 1px 3px;
  border: 0;
  border-radius: 3px;
  background: rgba(160, 130, 70, 0.18);
  color: #bda77a;
  font: inherit;
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  cursor: pointer;
}

.task-badge:hover,
.task-badge:focus-visible {
  background: rgba(200, 170, 100, 0.3);
  color: #e6d3a4;
}

.task-badge.task-kind-urgent {
  background: rgba(170, 70, 55, 0.26);
  color: #e5a08e;
}

.task-badge.task-kind-important {
  background: rgba(170, 135, 60, 0.24);
  color: #e0c27e;
}

.task-badge.task-kind-background {
  background: rgba(95, 115, 150, 0.2);
  color: #9fb4d0;
}

.task-badge.is-order {
  box-shadow: inset 0 0 0 1px rgba(230, 180, 120, 0.55);
}

.task-mode {
  flex: 0 0 auto;
  min-width: 20px;
  padding: 0 3px;
  border: 1px solid #4b402f;
  border-radius: 3px;
  background: transparent;
  color: #81755f;
  font: inherit;
  cursor: pointer;
}

.task-mode.is-active {
  border-color: #8f794e;
  background: rgba(160, 130, 70, 0.2);
  color: #e0c27e;
}

.task-mode:hover,
.task-mode:focus-visible {
  color: #f0dfb5;
}

.task-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.task-modes {
  display: flex;
  flex: 0 0 auto;
  gap: 3px;
}

.task-remove {
  width: 18px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #706656;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.task-remove:hover,
.task-remove:focus-visible {
  background: #4a2620;
  color: #e0a090;
}

/* --- Телефонные вкладки: сам бар --- */
#mobile-panel-tabs {
  position: fixed;
  right: 8px;
  bottom: 8px;
  z-index: 71;
  display: none;
  gap: 3px;
  padding: 4px;
  max-width: calc(var(--ui-vw, 100vw) - 16px);
  box-sizing: border-box;
  background: rgba(20, 20, 20, 0.9);
  border: 1px solid #555;
  border-radius: 6px;
}

#mobile-panel-tabs button {
  min-width: 0;
  flex: 1 1 0;
  padding: 6px 5px;
  border: 1px solid #3c3428;
  border-radius: 4px;
  background: #201d17;
  color: #b8a888;
  font: inherit;
  font-size: 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  touch-action: manipulation;
}

#mobile-panel-tabs button.active {
  background: #3b3322;
  border-color: #c0a060;
  color: #f0d8a0;
}

/* На узком экране места между отрядом и портретом уже нет: поднимаем
 * очередь над панелью приказов. Правило нужно и телефону в альбомной
 * ориентации — там ПК-раскладка, а вёрстка шире ладони не бывает. */
@media (max-width: 1240px) {
  #tasks-panel {
    right: 20px;
    /* 20 (низ приказов) + 216 (их высота) + 4 зазор. */
    bottom: 240px;
    width: 240px;
    max-height: calc(100vh - 348px);
  }
}
