/* Редактирование «на месте», свои меню и календарь, «только просмотр». Файлы стилей подключаются в templates/base.html по порядку. */

/* ===== Редактирование «на месте» (static/teamwork/inline-edit.js) ===== */
/* Поля выглядят как обычный текст и показывают рамку только при наведении и фокусе */
select.inline-select, input.inline-input, input.title-input, textarea.inline-textarea {
  width: auto;
  max-width: 100%;
  height: 32px;
  padding: 0 8px;
  margin-left: -8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color .12s, background .12s, box-shadow .12s;
}
select.inline-select:hover, input.inline-input:hover, input.title-input:hover, textarea.inline-textarea:hover {
  border-color: var(--border-strong);
  background: var(--surface);
}
select.inline-select:focus, input.inline-input:focus, input.title-input:focus, textarea.inline-textarea:focus {
  outline: none;
  border-color: var(--focus);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--focus-ring);
  cursor: text;
}
select.inline-select { appearance: none; -webkit-appearance: none; padding-right: 8px; }
select.inline-select:hover, select.inline-select:focus { padding-right: 24px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8a96' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 7px center; }
input.inline-input[type=date] { font-variant-numeric: tabular-nums; color: var(--text-2); }
input.inline-input[type=date]:not(:hover):not(:focus)::-webkit-calendar-picker-indicator { opacity: 0; }
input.inline-input.overdue { color: var(--danger); font-weight: 600; }
.saving { opacity: .55; pointer-events: none; }

/* Статус — цветной «значок», который можно раскрыть */
select.status-select {
  height: 26px;
  margin-left: 0;
  padding: 0 12px 0 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
}
select.status-select:hover, select.status-select:focus { padding-right: 26px; }
select.status-select option { background: var(--surface); color: var(--text); }

/* Название задачи — большое поле на странице и в панели */
input.title-input { display: block; width: 100%; height: auto; padding: 4px 8px; margin: 0 0 0 -8px; cursor: text; }
input.title-input.page-title { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
input.title-input.panel-title { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 14px; width: calc(100% + 8px); }
.task-page input.title-input { flex: 1; }

textarea.inline-textarea {
  display: block;
  width: calc(100% + 16px);
  height: auto;
  min-height: 90px;
  padding: 8px;
  line-height: 1.55;
  color: var(--text-2);
  cursor: text;
  resize: vertical;
}
textarea.inline-textarea::placeholder { color: var(--muted); }

tr.done select.inline-select:not(select.status-select), tr.done input.inline-input { color: var(--muted); }

/* Уведомление «Сохранено» внизу экрана */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 60;
  transform: translate(-50%, 20px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--accent-ink);
  color: #fff;
  font-weight: 550;
  box-shadow: var(--shadow-hover);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  max-width: calc(100vw - 32px);
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.toast.ok::before { content: "✓ "; color: var(--accent); }
.toast.error { background: var(--danger); }


/* ===== Свои выпадающие списки и календарь (static/teamwork/pickers.js) ===== */
.picker-native { display: none !important; }
.picker-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  height: 30px;
  margin-left: -8px;
  padding: 0 6px 0 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 450;
  box-shadow: none;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .12s, background .12s;
}
.picker-button:hover, .picker-button.open { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.picker-button:focus-visible { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--focus-ring); }
.picker-button:disabled { opacity: .55; }
.picker-label { overflow: hidden; text-overflow: ellipsis; }
.picker-button.empty .picker-label { color: var(--muted); }
/* Стрелка занимает место всегда, а видна только при наведении — поэтому ничего не «прыгает» */
.picker-chevron { width: 13px; height: 13px; color: var(--muted); opacity: 0; transition: opacity .12s; }
.picker-button:hover .picker-chevron, .picker-button.open .picker-chevron { opacity: 1; }
.picker-date .icon { width: 14px; height: 14px; color: var(--muted); }
.picker-date { color: var(--text-2); font-variant-numeric: tabular-nums; }
.picker-date.overdue, .picker-date.overdue .icon { color: var(--danger); font-weight: 600; }
.picker-button .avatar { width: 22px; height: 22px; font-size: 10px; }

/* Статус — цветной «значок» */
.picker-button.status-pill { height: 26px; margin-left: 0; padding: 0 6px 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; gap: 4px; }
.picker-button.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-right: 3px; }
.picker-button.status-pill:hover, .picker-button.status-pill.open { border-color: currentColor; }
.picker-button.status-pill .picker-chevron { color: currentColor; }

.picker-popover {
  position: absolute;
  z-index: 70;
  min-width: 200px;
  max-width: 320px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 32px rgba(20, 20, 40, .16), 0 2px 6px rgba(20, 20, 40, .06);
  animation: picker-in .12s ease-out;
}
@keyframes picker-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.picker-menu { max-height: 320px; overflow-y: auto; }
.picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font-weight: 500;
  text-align: left;
  box-shadow: none;
}
.picker-item:hover, .picker-item:focus { background: var(--grey-soft); color: var(--text); outline: none; }
.picker-item.selected { background: var(--accent-soft); }
.picker-item.muted { color: var(--muted); }
.picker-item-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-item .avatar { width: 24px; height: 24px; font-size: 10px; }
.picker-check { color: var(--accent-ink); }
.picker-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }

.picker-calendar { width: 280px; padding: 12px; }
.cal-head { display: flex; align-items: center; margin-bottom: 8px; }
.cal-title { flex: 1; text-align: center; font-weight: 650; }
.cal-nav {
  width: 30px;
  height: 30px;
  padding: 0;
  justify-content: center;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-2);
  font-size: 20px;
  box-shadow: none;
}
.cal-nav:hover { background: var(--grey-soft); color: var(--text); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-weekday { text-align: center; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 4px 0; }
.cal-day {
  height: 34px;
  padding: 0;
  justify-content: center;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  box-shadow: none;
}
.cal-day.weekend { color: var(--muted); }
.cal-day:hover { background: var(--grey-soft); color: var(--text); }
.cal-day.today { box-shadow: inset 0 0 0 1.5px var(--accent-ink); }
.cal-day.selected, .cal-day.selected:hover { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.cal-foot { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.cal-foot .link.muted { color: var(--muted); }

/* Только просмотр: поля выглядят как обычный текст */
.picker-button.readonly, .picker-button.readonly:hover { border-color: transparent; background: transparent; cursor: default; opacity: 1; }
.picker-button.status-pill.readonly:hover { border-color: transparent; }
.picker-button.readonly .picker-chevron { display: none; }
input.title-input[readonly], textarea.inline-textarea[readonly] { cursor: default; }
input.title-input[readonly]:hover, textarea.inline-textarea[readonly]:hover,
input.title-input[readonly]:focus, textarea.inline-textarea[readonly]:focus { border-color: transparent; box-shadow: none; background: transparent; }
input.section-name[readonly]:hover, input.section-name[readonly]:focus { border-color: transparent; box-shadow: none; }

/* Календарь в обычной форме (оклад, отсутствие, дедлайн…): кнопка выглядит как поле формы */
.picker-button.picker-field {
  display: flex;
  width: 100%;
  height: 40px;
  margin-left: 0;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}
.picker-button.picker-field:hover, .picker-button.picker-field.open { border-color: var(--focus); }
.picker-button.picker-field.empty .picker-label { color: var(--muted); }

/* ===== Оформление в духе Notion (27.10.2026) — уточняет правила выше ===== */
/* Поля ввода — здесь, а не в forms.css: должны идти после правил полей «на месте» выше */
/* ===== Поля ввода: светло-серый фон, без рамки до наведения ===== */
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], input[type=number], textarea, select {
  border: 1px solid rgba(55, 53, 47, .16);
  border-radius: var(--radius-sm);
  background: rgba(242, 241, 238, .6);
  padding: 6px 12px;
}
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], input[type=number], select { height: var(--control-h); }
input:focus, textarea:focus, select:focus { background: #fff; border-color: rgba(55, 53, 47, .35); box-shadow: 0 0 0 2px var(--focus-ring); }
form label { font-weight: 500; font-size: 13px; color: var(--text-2); }
input[type=checkbox] { accent-color: #37352f; }

.task-page .page-title, .task-page input.title-input { font-size: 32px; font-weight: 700; }
/* Статус — прямоугольная метка */
.picker-button.status-pill { height: 22px; border-radius: var(--radius-xs); padding: 0 6px 0 7px; font-weight: 500; font-size: 13px; }

/* ===== Поля-кнопки выбора (календарь, списки в формах) — той же высоты и формы, что и поля ===== */
.picker-button.picker-field {
  height: var(--control-h); border: 1px solid rgba(55, 53, 47, .16); border-radius: var(--radius-sm);
  background: rgba(242, 241, 238, .6); padding: 0 12px;
}
.picker-button.picker-field:hover, .picker-button.picker-field.open { background: #fff; border-color: rgba(55, 53, 47, .35); }
.picker-button.picker-field .picker-label { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; }
.picker-popover { border-radius: 12px; border: none; box-shadow: var(--shadow-hover); padding: 6px; }
.picker-item { border-radius: 7px; }
.cal-day { border-radius: 8px; }

/* Название задачи — крупный текст страницы, без серой заливки поля */
input.title-input, textarea.inline-textarea { background: transparent; border-color: transparent; }
input.title-input:hover, textarea.inline-textarea:hover { background: var(--hover); border-color: transparent; }
input.title-input:focus, textarea.inline-textarea:focus { background: #fff; border-color: rgba(55, 53, 47, .2); }
