/* Стол заказов (orderdesc.tpl + engine/mods/orderdesc). Только переменные тем из knigi2.css.
   JS (js/orderdesc.js) опирается на классы .orderdesc-*, #odrow-{id}, #orderdescTitle, .show-alerts, .showLoad. */

.k-od { display: flex; flex-direction: column; gap: 20px; }

.k-od__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; }
.k-od__titles { flex: 1 1 360px; min-width: 0; }
.k-od__titles .k-title { margin: 0 0 8px; }
.k-od__lead { margin: 0; max-width: 62ch; color: var(--muted); line-height: 1.55; }
.k-od__head .orderdesc-add { flex: none; }
.orderdesc-add svg { transition: transform 140ms var(--ease, ease); }
.orderdesc-add.current svg { transform: rotate(45deg); }

.k-od__note {
	margin: 0; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius);
	background: var(--surface); color: var(--muted); font-size: 15px; line-height: 1.5;
}
.k-od__note strong { color: var(--text); font-weight: 600; }

/* Форма добавления: разметку подставляет AJAX (action=form) */
.k-od__form { display: none; }
.k-od__form:not(:empty) {
	padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface);
}
.k-od__form > * + * { margin-top: 16px; }
.k-od__label { display: block; margin-bottom: 8px; font-weight: 600; }
.k-od__form input[type="text"] { width: 100%; min-height: 48px; }
.k-od__checks { display: flex; flex-direction: column; gap: 4px; }
.k-od__checks label, .k-od__mass label { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.k-od__checks input, .k-od__mass input[type="checkbox"], .k-od__row > input[type="checkbox"] {
	width: 18px; height: 18px; margin: 0; accent-color: var(--accent-text);
}
.k-od__actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Похожие книги, найденные по названию (ответ action=related) */
.k-od__related { display: none; margin: 8px 0 0; padding: 0; list-style: none; }
.k-od__related:not(:empty) { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface2); }
.k-od__related li { padding: 10px 14px; border-top: 1px solid var(--border); }
.k-od__related li:first-child { border-top: 0; }
.k-od__related a { color: var(--text); }
.k-od__related a:hover { color: var(--accent-text); }

/* Фильтры по статусу */
.orderdesc-statusinfo { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.orderdesc-statusinfo a {
	display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px;
	border: 1px solid var(--line); border-radius: 999px; color: var(--text); font-size: 15px;
	transition: background-color 140ms var(--ease, ease), border-color 140ms var(--ease, ease);
}
.orderdesc-statusinfo a:hover { background: var(--hover, var(--surface2)); }
.orderdesc-statusinfo a[aria-current="page"] { border-color: var(--text); background: var(--surface2); font-weight: 500; }

/* Метки статуса: точка-корешок */
.od-all, .od-wait, .od-done, .od-deny, .od-top {
	display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--muted);
}
.od-all { background: transparent; box-shadow: inset 0 0 0 2px var(--muted); }
.od-wait { background: var(--muted); }
.od-done { background: var(--success); }
.od-deny { background: var(--danger); }
.od-top { background: var(--spine-4); }

/* Список заказов */
.k-od__list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border); }
.k-od__row {
	display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--border);
}
.k-od__row > i { margin-top: 2px; }
.k-od__body { flex: 1; min-width: 0; }
.k-od__title { color: var(--text); font-size: 16px; font-weight: 500; line-height: 1.4; overflow-wrap: anywhere; }
.k-od__title a { color: var(--accent-text); }
.k-od__title .orderdesc-edit { margin-left: 6px; font-size: 14px; font-weight: 400; }
.k-od__meta { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 4px; color: var(--muted); font-size: 14px; }
.k-od__meta a { color: var(--muted); }
.k-od__meta a:hover { color: var(--text); }
.k-od__status { color: var(--text); }
.k-od__empty { padding: 32px 0; color: var(--muted); text-align: center; }

/* Поддержать заказ: счётчик с одной стрелкой */
.orderdesc-rating {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: none;
	min-width: 64px; min-height: 44px; padding: 0 12px;
	border: 1px solid var(--line); border-radius: var(--radius); background: transparent;
	color: var(--text); font: inherit; font-size: 15px; font-variant-numeric: tabular-nums; cursor: pointer;
	transition: background-color 140ms var(--ease, ease), border-color 140ms var(--ease, ease), color 140ms var(--ease, ease);
}
.orderdesc-rating::before {
	content: ""; width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent;
	border-bottom: 7px solid currentColor;
}
.orderdesc-rating:hover { background: var(--hover, var(--surface2)); }
.orderdesc-rating-green, .orderdesc-rating-green:hover { border-color: var(--success); color: var(--success); cursor: default; }

/* Массовое удаление (админ) и пагинация */
.k-od__mass { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.k-od__nav { display: flex; justify-content: center; }

/* Всплывающие сообщения и загрузка (создаёт js/orderdesc.js в body) */
.show-alerts {
	position: fixed; z-index: 1000; left: 50%; bottom: 24px; transform: translateX(-50%);
	display: flex; flex-direction: column; align-items: center; gap: 8px; width: max-content; max-width: calc(100vw - 32px);
	pointer-events: none;
}
.show-alerts > div:not(.showLoad) {
	display: none; padding: 12px 18px; border-radius: var(--radius); background: var(--text); color: var(--bg);
	font-size: 15px; box-shadow: var(--shadow, none); pointer-events: auto;
}
.showLoad {
	width: 28px; height: 28px; border-radius: 50%;
	border: 3px solid var(--line); border-top-color: var(--accent-text);
	animation: k-od-spin 800ms linear infinite;
}
@keyframes k-od-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .showLoad { animation-duration: 2s; } }

@media (max-width: 560px) {
	.k-od__head .orderdesc-add { width: 100%; justify-content: center; }
	.k-od__row { align-items: flex-start; gap: 12px; }
	.k-od__row > i { margin-top: 7px; }
	.orderdesc-rating { min-width: 56px; padding: 0 10px; }
}
