/* Start page: the request history (js/start.js) — «Історія», «Нова розмова», recent requests. */

.start-tools {
  display: flex; gap: 8px; justify-content: center; margin: 0 0 18px; flex-wrap: wrap;
  animation: fx-rise 0.5s var(--ease-out) backwards;
}
.chatting .start-tools { position: sticky; top: calc(var(--header-h) + 8px); z-index: 4; margin-bottom: 10px; }
.start-tool {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 15px 8px 12px; border-radius: 999px;
  border: 1px solid var(--color-border); background: var(--pill-bg, rgba(255, 255, 255, 0.05));
  color: var(--color-text); font: inherit; font-size: 13.5px; font-weight: 800; cursor: pointer;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: border-color 0.2s, transform 0.2s var(--ease-out), background-color 0.2s;
}
.start-tool:hover { border-color: var(--color-border-strong); transform: translateY(-1px); }
.start-tool[aria-expanded="true"] { border-color: var(--color-accent); color: var(--color-accent); }
.start-tool svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.start-tool[hidden] { display: none; }

/* the panel on the left */
.hist-veil { position: fixed; inset: 0; z-index: 69; background: rgba(0, 0, 0, 0.35); backdrop-filter: blur(2px); animation: hist-fade 0.25s ease; }
.hist-veil[hidden], .hist[hidden] { display: none; }
@keyframes hist-fade { from { opacity: 0; } }
.hist {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 70; width: min(380px, 92vw);
  display: flex; flex-direction: column; background: var(--color-surface); color: var(--color-text);
  box-shadow: 30px 0 80px -30px rgba(0, 0, 0, 0.7), inset -1px 0 0 var(--color-border);
  animation: hist-in 0.35s var(--ease-out);
}
@keyframes hist-in { from { transform: translateX(-30px); opacity: 0; } }
.hist-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 20px 12px; }
.hist-head strong { font-size: 18px; }
.hist-close {
  width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--color-surface-2);
  color: var(--color-text); font-size: 22px; cursor: pointer;
}
.hist-list { flex: 1; overflow-y: auto; padding: 4px 14px 20px; display: grid; align-content: start; gap: 6px; }
.hist-list > .loader { justify-self: center; margin-top: 30px; }
.hist-empty { color: var(--color-muted); text-align: center; padding: 30px 12px; }

.hist-row { position: relative; animation: fx-rise 0.35s var(--ease-out) backwards; transition: opacity 0.25s, transform 0.25s; }
.hist-row.gone { opacity: 0; transform: translateX(-20px); }
.hist-row .hist-item { padding-right: 40px; }
.hist-del {
  position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border: 0; border-radius: 50%;
  background: transparent; color: var(--color-muted); font-size: 17px; line-height: 1; cursor: pointer; opacity: 0;
  transition: opacity 0.2s, background-color 0.2s, color 0.2s;
}
.hist-row:hover .hist-del, .hist-del:focus-visible { opacity: 1; }
.hist-del:hover { background: rgba(192, 57, 43, 0.16); color: var(--color-danger); }
@media (hover: none) { .hist-del { opacity: 0.7; } }
.hist-item, .recent-item {
  display: grid; gap: 4px; width: 100%; padding: 12px 14px; border: 1px solid transparent; border-radius: 16px;
  background: var(--color-surface-2); color: var(--color-text); font: inherit; text-align: left; cursor: pointer;
  transition: border-color 0.2s, transform 0.2s var(--ease-out), background-color 0.2s;
}
.hist-item:hover, .recent-item:hover { border-color: var(--color-border-strong); transform: translateX(2px); }
.hist-item[aria-current="true"] { border-color: var(--color-accent); }
.hist-top { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.hist-top b { flex: 1; min-width: 0; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-price { flex: none; font-weight: 800; font-size: 14px; color: var(--color-price); font-variant-numeric: tabular-nums; }
.hist-meta { font-size: 12.5px; color: var(--color-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* recent requests on the empty page */
.recent { width: min(760px, 100%); margin: 30px auto 0; text-align: left; animation: fx-rise 0.6s var(--ease-out) 0.1s backwards; }
.recent[hidden], .chatting .recent { display: none; }
.recent-title { font-size: 13px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-muted); margin: 0 0 10px 4px; }
.recent-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.recent-item { background: var(--pill-bg, rgba(255, 255, 255, 0.04)); border-color: var(--color-border); backdrop-filter: blur(12px); }
.recent-item:hover { transform: translateY(-2px); }

.order-min { margin: 8px 0 0; color: var(--color-warn); font-weight: 700; }
.order-min:empty { display: none; }
a.order-open { display: inline-flex; justify-content: center; text-decoration: none; }

@media (max-width: 560px) {
  .recent-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .start-tools, .hist, .hist-veil, .recent { animation: none; }
}
