/* ============================================================================
   SOUČÁSTKY — tlačítka, štítky, karty, formuláře, oznámení, chat
   ========================================================================== */

/* -- Tlačítka -------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .625rem;
  height: 3.5rem;
  padding: 0 1.625rem;
  border-radius: 999px;
  font-weight: 500;
  font-size: .9375rem;
  line-height: 1.25rem;
  white-space: nowrap;
  cursor: pointer;
  transition:
    transform var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease),
    background-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn .icon { width: 1.125rem; height: 1.125rem; }

.btn--main { background: var(--accent); color: #fff; box-shadow: var(--sh-accent); }
.btn--main:hover { background: var(--accent-2); }
.btn--ghost { background: var(--surface); box-shadow: var(--sh-1); }
.btn--ghost:hover { box-shadow: 0 6px 16px -8px rgba(12, 16, 32, .3), var(--sh-1); }
.btn--dark { background: var(--ink); color: #fff; }
.btn--dark:hover { background: var(--accent); }
.btn--white { background: #fff; color: var(--ink); }
.btn--glass { background: rgba(255, 255, 255, .16); color: #fff; }
.btn--glass:hover { background: rgba(255, 255, 255, .26); }
.btn--line { box-shadow: inset 0 0 0 1px var(--line); }
.btn--line:hover { box-shadow: inset 0 0 0 1px var(--ink); }
.btn--sm { height: 2.75rem; padding: 0 1.25rem; font-size: .875rem; }
.btn--block { width: 100%; }
.btn[aria-busy='true'] { opacity: .7; pointer-events: none; }

.btns { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }

/* Odkaz s kulatou šipkou. */
.more {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  font-size: .9375rem;
  font-weight: 600;
  line-height: 1.25rem;
  white-space: nowrap;
}
.more__dot, .go {
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  transition: background-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.more__dot { width: 2.5rem; height: 2.5rem; }
.more__dot .icon { width: 1rem; height: 1rem; }
.more:hover .more__dot { background: var(--accent); transform: translate(2px, -2px); }
.go { width: 3rem; height: 3rem; }
.go .icon { width: 1.125rem; height: 1.125rem; }

.link { color: var(--accent); font-weight: 500; text-decoration: underline; text-underline-offset: .2em; }
.textlink {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: .875rem;
  font-weight: 500;
  line-height: 1.25rem;
  color: var(--ink-2);
  cursor: pointer;
}
.textlink:hover { color: var(--accent); }
.textlink .icon { width: 1rem; height: 1rem; }

/* -- Štítky ---------------------------------------------------------------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: .4375rem;
  height: 1.75rem;
  padding: 0 .6875rem;
  border-radius: 999px;
  background: var(--bg);
  font-size: .8125rem;
  font-weight: 500;
  line-height: 1rem;
  color: var(--ink-2);
  white-space: nowrap;
}
.chip--white { background: var(--surface); }
.chip--accent { background: var(--accent-soft); color: var(--accent-2); }
.chip--sm { height: 1.5rem; padding: 0 .5625rem; font-size: .75rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }

/* Stav projektu: běží / rozpracováno / návrh. Tečka říká totéž co text. */
.status { background: var(--surface-2); color: var(--ink-2); }
.status::before { content: ''; flex: none; width: .375rem; height: .375rem; border-radius: 50%; background: var(--muted); }
.status--live { background: var(--ok-soft); color: var(--ok-ink); }
.status--live::before { background: var(--ok); }
.status--wip { background: var(--warn-soft); color: var(--warn-ink); }
.status--wip::before { background: var(--warn); }
.status--finishing { background: var(--accent-soft); color: var(--accent-2); }
.status--finishing::before { background: var(--accent); }

/* „Beru nové zakázky" */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  height: 2.125rem;
  padding: 0 .875rem 0 .5625rem;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--sh-1);
  font-size: .8125rem;
  font-weight: 500;
  line-height: 1rem;
  color: var(--ink-2);
}
.badge__dot {
  display: grid;
  place-items: center;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--ok-soft);
}
.badge__dot::after { content: ''; width: .5rem; height: .5rem; border-radius: 50%; background: var(--ok); }
.footer .badge { background: var(--dark-2); box-shadow: none; color: #fff; }
.footer .badge__dot { background: rgba(31, 164, 99, .25); }

/* -- Karty ----------------------------------------------------------------- */

.card {
  padding: clamp(1.5rem, 1.2rem + 1.3vw, 2rem);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-1);
}
.sec--white .card { background: var(--bg); box-shadow: none; }
.sec--white .card .chip { background: var(--surface); }
.card--accent { background: var(--accent-soft); box-shadow: none; }

.icon-box {
  display: grid;
  place-items: center;
  flex: none;
  width: 3rem;
  height: 3rem;
  border-radius: .9375rem;
  background: var(--accent-soft);
  color: var(--accent);
}
.icon-box .icon { width: 1.375rem; height: 1.375rem; }

/* Úroveň dovednosti: pět dílků. */
.level { display: flex; gap: .25rem; }
.level span { flex: 1; height: .375rem; border-radius: 3px; background: var(--surface-2); }
.level span[data-on='1'] { background: var(--accent); }

/* Čísla */
.stat b {
  display: block;
  font-size: clamp(2.25rem, 1.9rem + 1.5vw, 3rem);
  font-weight: 600;
  letter-spacing: -.045em;
  line-height: 1.1;
}
.stat > span { display: block; margin-top: .375rem; font-size: .875rem; line-height: 1.25rem; color: var(--muted); }

/* Seznam údajů: popisek vlevo, hodnota vpravo. */
.deflist { border-top: 1px solid var(--line); }
.deflist > div {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
  font-size: .9375rem;
  line-height: 1.375rem;
}
.deflist dt { color: var(--muted); }
.deflist dd { margin: 0; font-weight: 600; text-align: right; }

/* -- Oznámení -------------------------------------------------------------- */

.notice {
  display: flex;
  gap: .75rem;
  padding: 1rem 1.125rem;
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--sh-1);
  font-size: .9375rem;
  line-height: 1.5;
  color: var(--ink-2);
}
.notice .icon { margin-top: .125rem; color: var(--accent); }
.notice--err { background: var(--err-soft); box-shadow: none; color: var(--err-ink); }
.notice--err .icon { color: var(--err); }
.notice--ok { background: var(--ok-soft); box-shadow: none; color: var(--ok-ink); }
.notice--ok .icon { color: var(--ok); }

.empty {
  display: grid;
  justify-items: center;
  gap: .875rem;
  padding: 4rem 1.5rem;
  border-radius: var(--r-lg);
  background: var(--surface);
  text-align: center;
  color: var(--ink-2);
}
.empty > .icon { width: 2rem; height: 2rem; color: var(--muted); }
.empty h2, .empty h3 { font-size: 1.375rem; letter-spacing: -.025em; color: var(--ink); }
.empty p { max-width: 46ch; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: var(--z-toast);
  max-width: min(32rem, calc(100vw - 2rem));
  padding: .875rem 1.25rem;
  border-radius: 1rem;
  background: var(--ink);
  color: #fff;
  font-size: .9375rem;
  line-height: 1.45;
  box-shadow: var(--sh-2);
  opacity: 0;
  transform: translate(-50%, .75rem);
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* -- Formuláře ------------------------------------------------------------- */

.field { display: grid; gap: .5rem; align-content: start; }
.field__label { display: flex; gap: .375rem; font-size: .875rem; font-weight: 600; line-height: 1.25rem; }
.field__req { color: var(--accent); }
.field__hint { font-size: .8125rem; line-height: 1.25rem; color: var(--muted); }
.field__error {
  display: flex;
  gap: .375rem;
  font-size: .8125rem;
  font-weight: 500;
  line-height: 1.25rem;
  color: var(--err-ink);
}
.field__error .icon { width: 1rem; height: 1rem; margin-top: .125rem; }

.input, .select, .textarea {
  width: 100%;
  min-height: 3.375rem;
  padding: .875rem 1.125rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg);
  font-size: 1rem;
  line-height: 1.5;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.textarea { min-height: 10.5rem; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .select:hover, .textarea:hover { border-color: #C5CAD6; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-soft);
  outline: none;
}
.input[aria-invalid='true'], .textarea[aria-invalid='true'] { border-color: var(--err); box-shadow: 0 0 0 4px var(--err-soft); }
.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.75rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23646B7E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.125rem;
  cursor: pointer;
}

.check { display: flex; gap: .75rem; align-items: flex-start; font-size: .875rem; line-height: 1.5; color: var(--ink-2); cursor: pointer; }
.check input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 1.375rem;
  height: 1.375rem;
  margin: 0;
  border: 1px solid #C5CAD6;
  border-radius: .4375rem;
  background: var(--surface) center / 0 no-repeat;
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.check input:checked {
  border-color: var(--accent);
  background-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 13 4 4L19 7'/%3E%3C/svg%3E");
  background-size: .875rem;
}
.check input[aria-invalid='true'] { border-color: var(--err); }
.check a { color: var(--accent); text-decoration: underline; text-underline-offset: .2em; }

/* -- Rozbalovací otázky (details) ----------------------------------------- */

.accordion { display: grid; gap: .75rem; }
.accordion__item { border-radius: var(--r-md); background: var(--surface); box-shadow: var(--sh-1); }
.accordion__item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.375rem 1.5rem;
  font-size: clamp(1rem, .96rem + .2vw, 1.125rem);
  font-weight: 600;
  letter-spacing: -.015em;
  line-height: 1.35;
  cursor: pointer;
  list-style: none;
}
.accordion__item summary::-webkit-details-marker { display: none; }
.accordion__sign {
  position: relative;
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--bg);
  transition: background-color var(--t-fast) var(--ease);
}
.accordion__sign::before, .accordion__sign::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: .75rem;
  height: 2px;
  margin: -1px 0 0 -.375rem;
  border-radius: 1px;
  background: var(--ink);
  transition: transform var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.accordion__sign::after { transform: rotate(90deg); }
.accordion__item[open] .accordion__sign { background: var(--accent); }
.accordion__item[open] .accordion__sign::before, .accordion__item[open] .accordion__sign::after { background: #fff; }
.accordion__item[open] .accordion__sign::after { transform: rotate(0deg); }
.accordion__body { padding: 0 1.5rem 1.5rem; max-width: 68ch; color: var(--ink-2); }
.accordion__body p + p { margin-top: .75rem; }

/* -- Filtry a přepínače ---------------------------------------------------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  flex: none;
  height: 2.5rem;
  padding: 0 1rem;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--sh-1);
  font-size: .875rem;
  font-weight: 500;
  line-height: 1.25rem;
  color: var(--ink-2);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.pill .icon { width: 1rem; height: 1rem; }
.pill:hover { color: var(--ink); }
.pill__count { font-size: .8125rem; color: var(--muted); }
.pill[aria-pressed='true'] { background: var(--ink); color: #fff; }
.pill[aria-pressed='true'] .pill__count { color: var(--on-dark-2); }

.segmented { display: flex; padding: .25rem; border-radius: var(--r-sm); background: var(--bg); }
.segmented button {
  display: flex;
  align-items: center;
  gap: .5rem;
  height: 2.5rem;
  padding: 0 .875rem;
  border-radius: .625rem;
  font-size: .875rem;
  font-weight: 500;
  color: var(--ink-2);
}
.segmented button .icon { width: 1rem; height: 1rem; }
.segmented button[aria-selected='true'] { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }

/* -- Chatbot --------------------------------------------------------------- */

.chat-launcher {
  position: fixed;
  right: clamp(1rem, .7rem + 1.2vw, 1.5rem);
  bottom: clamp(1rem, .7rem + 1.2vw, 1.5rem);
  z-index: var(--z-chat);
  display: grid;
  place-items: center;
  width: 3.75rem;
  height: 3.75rem;
  border: 3px solid var(--bg);
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--sh-2);
  transition: transform var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.chat-launcher:hover { transform: translateY(-2px) scale(1.04); background: var(--accent); }
.chat-launcher .icon { width: 1.5rem; height: 1.5rem; }
.chat-launcher::after {
  content: '';
  position: absolute;
  right: -1px;
  top: -1px;
  width: .875rem;
  height: .875rem;
  border: 3px solid var(--bg);
  border-radius: 50%;
  background: var(--ok);
}
/* Chat má smysl jen s JavaScriptem, bez něj by nic nedělal. */
.no-js .chat-launcher, .no-js .chat { display: none; }

.chat {
  position: fixed;
  right: clamp(1rem, .7rem + 1.2vw, 1.5rem);
  bottom: clamp(1rem, .7rem + 1.2vw, 1.5rem);
  z-index: var(--z-chat-open);
  display: flex;
  flex-direction: column;
  width: min(24.5rem, calc(100vw - 2rem));
  height: min(38rem, calc(100vh - var(--header-h) - 2.5rem));
  height: min(38rem, calc(100dvh - var(--header-h) - 2.5rem));
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: 0 0 0 1px rgba(12, 16, 32, .06), 0 28px 60px -20px rgba(12, 16, 32, .45);
  overflow: hidden;
  opacity: 0;
  transform: translateY(.75rem) scale(.98);
  transform-origin: 100% 100%;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.chat.is-open { opacity: 1; transform: none; }

.chat__head {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex: none;
  padding: 1rem 1rem 1rem 1.25rem;
  background: var(--dark);
  color: #fff;
}
.chat__avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: .75rem;
  background: #fff;
  color: var(--ink);
  --logo-size: 1.625rem;
}
.chat__who { flex: 1; min-width: 0; }
.chat__title { font-size: .9375rem; font-weight: 600; line-height: 1.25rem; letter-spacing: -.01em; }
.chat__sub {
  display: flex;
  align-items: center;
  gap: .4375rem;
  font-size: .75rem;
  line-height: 1rem;
  color: var(--on-dark-2);
}
.chat__sub::before { content: ''; flex: none; width: .4375rem; height: .4375rem; border-radius: 50%; background: var(--ok); }
.chat__close {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--dark-2);
  color: #fff;
  transition: background-color var(--t-fast) var(--ease);
}
.chat__close:hover { background: var(--accent); }
.chat__close .icon { width: 1.125rem; height: 1.125rem; }

.chat__log {
  position: relative;   /* skript měří polohu zpráv vůči tomuhle prvku */
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: .5rem;
  min-height: 0;
  padding: 1.25rem 1rem 1rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.chat__log:focus-visible { outline-offset: -3px; border-radius: 0; }

.bubble {
  max-width: 88%;
  padding: .6875rem .9375rem;
  border-radius: 1.125rem;
  font-size: .9375rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  animation: bubble-in .22s var(--ease) both;
}
.bubble__text { white-space: pre-line; text-wrap: wrap; }
.bubble--bot { align-self: flex-start; border-bottom-left-radius: .375rem; background: var(--bg); color: var(--ink); }
.bubble--me { align-self: flex-end; margin-top: .375rem; border-bottom-right-radius: .375rem; background: var(--accent); color: #fff; }
.bubble--me + .bubble--bot { margin-top: .375rem; }
.bubble a { color: var(--accent); font-weight: 500; text-decoration: underline; text-underline-offset: .2em; }
.bubble__link {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  margin-top: .5rem;
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.25rem;
  text-decoration: none !important;
}
.bubble__link::after { content: '→'; transition: transform var(--t-fast) var(--ease); }
.bubble__link:hover::after { transform: translateX(3px); }

/* Tři tečky, než přijde odpověď. */
.bubble--wait { display: flex; gap: .25rem; padding: .9375rem; }
.bubble--wait i { width: .4375rem; height: .4375rem; border-radius: 50%; background: var(--muted); animation: bubble-dot 1s infinite ease-in-out; }
.bubble--wait i:nth-child(2) { animation-delay: .15s; }
.bubble--wait i:nth-child(3) { animation-delay: .3s; }

@keyframes bubble-in { from { opacity: 0; transform: translateY(.375rem); } }
@keyframes bubble-dot { 0%, 60%, 100% { opacity: .35; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }

.chat__form {
  display: flex;
  gap: .5rem;
  flex: none;
  padding: .75rem .75rem .5rem;
  border-top: 1px solid var(--line);
}
.chat__input {
  flex: 1;
  min-width: 0;
  height: 3rem;
  padding: 0 1.125rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--bg);
  font-size: 1rem;
  line-height: 1.5;
  transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.chat__input::placeholder { color: var(--faint); }
.chat__input:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); outline: none; }
.chat__send {
  display: grid;
  place-items: center;
  flex: none;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  transition: background-color var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
}
.chat__send:hover { background: var(--accent-2); }
.chat__send[disabled] { opacity: .45; cursor: default; }
.chat__send .icon { width: 1.125rem; height: 1.125rem; }
.chat__note { flex: none; padding: 0 1rem .75rem; font-size: .75rem; line-height: 1.125rem; text-align: center; color: var(--muted); }

/* Na telefonu zabere chat celou obrazovku. Výšku a posun hlídá skript podle
   toho, kolik místa nechá klávesnice (proměnné --chat-h a --chat-top). */
@media (max-width: 47.5rem) {
  .chat {
    inset: var(--chat-top, 0) 0 auto 0;
    width: auto;
    height: var(--chat-h, 100vh);
    height: var(--chat-h, 100dvh);
    border-radius: 0;
    box-shadow: none;
    transform: translateY(1rem);
  }
  .chat__head { padding-top: max(1rem, env(safe-area-inset-top)); }
  .chat__note { padding-bottom: max(.75rem, env(safe-area-inset-bottom)); }
  .bubble { max-width: 92%; }
}

@media (max-width: 47.5rem) {
  .btn { height: 3.25rem; padding: 0 1.25rem; }
  .btn--sm { height: 2.75rem; }
  .chat-launcher { width: 3.5rem; height: 3.5rem; }
  .accordion__item summary { padding: 1.125rem 1.25rem; }
  .accordion__body { padding: 0 1.25rem 1.25rem; }
}
