/* components.css — каталог компонентов PEREPLAN v2 */

/* === Кнопки === */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-size: 16px; font-weight: 500; line-height: 1.2;
  text-decoration: none;
  background: transparent; color: var(--c-text);
  transition: background-color var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease),
              transform 80ms var(--ease);
  cursor: pointer;
  user-select: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: .55; cursor: not-allowed; pointer-events: none;
}

.btn-primary {
  background: var(--c-brand); color: var(--c-on-brand);
  border-color: var(--c-brand);
}
.btn-primary:hover { background: var(--c-brand-dark); border-color: var(--c-brand-dark); text-decoration: none; }

.btn-secondary {
  background: var(--c-surface); color: var(--c-brand-dark);
  border-color: var(--c-border);
}
.btn-secondary:hover { background: var(--c-bg); border-color: var(--c-border-strong); text-decoration: none; }

.btn-ghost {
  background: transparent; color: var(--c-brand-dark);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--c-brand-50); text-decoration: none; }

.btn-danger {
  background: var(--c-danger); color: #fff;
  border-color: var(--c-danger);
}
.btn-danger:hover { background: var(--c-danger-hover); border-color: var(--c-danger-hover); text-decoration: none; }

.btn-block { width: 100%; }
.btn-lg { min-height: 56px; padding: 14px 24px; font-size: 17px; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 14px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0;
  border: 1px solid var(--c-border);
  background: var(--c-surface); color: var(--c-text);
  border-radius: var(--r-sm);
  cursor: pointer; transition: background-color var(--t-fast);
}
.icon-btn:hover { background: var(--c-bg); }
.icon-btn svg { width: 20px; height: 20px; }

/* === Иконки === */
.icon { width: 20px; height: 20px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }

/* === Карточки === */
.card {
  background: var(--c-surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: var(--sp-5);
}
.card-bordered { box-shadow: none; border: 1px solid var(--c-border); }
.card-tight    { padding: var(--sp-4); border-radius: var(--r-md); }
.card-hover {
  transition: transform var(--t-fast), box-shadow var(--t-fast);
  cursor: pointer;
}
.card-hover:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
.card-cta {
  background: var(--c-brand-50);
  border: 1px solid var(--c-brand-100);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
}

/* === Slot card (главный компонент v2) === */
.slot-card {
  background: var(--c-surface);
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
  border-left: 3px solid var(--c-grey);
  padding: var(--sp-4);
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: var(--sp-3);
  align-items: start;
  transition: box-shadow var(--t-fast);
}
.slot-card:hover { box-shadow: var(--shadow-2); }
.slot-card.is-missing  { border-left-color: var(--c-danger); }
.slot-card.is-uploaded { border-left-color: var(--c-info); }
.slot-card.is-review   { border-left-color: var(--c-warning); }
.slot-card.is-approved { border-left-color: var(--c-success); }
.slot-card.is-rejected { border-left-color: var(--c-danger); }
.slot-card.is-not-req  { border-left-color: var(--c-grey); opacity: .7; }

.slot-card__icon {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  background: var(--c-brand-50);
  color: var(--c-brand-dark);
  display: inline-flex; align-items: center; justify-content: center;
}
.slot-card__body { min-width: 0; }
.slot-card__title { font-size: 16px; font-weight: 500; margin: 0 0 2px; color: var(--c-text); }
.slot-card__meta  { font-size: 13px; color: var(--c-muted); }
.slot-card__files { margin-top: var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-2); }
.slot-card__actions { display: flex; flex-direction: column; gap: var(--sp-2); align-items: flex-end; }

/* === Бейджи статуса (цвет + иконка + текст) === */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 12px; font-weight: 500; line-height: 1.3;
  background: var(--c-grey-bg); color: var(--c-grey-text);
  white-space: nowrap;
}
.badge .icon { width: 12px; height: 12px; }
.badge-success { background: var(--c-success-bg); color: var(--c-success-text); }
.badge-warning { background: var(--c-warning-bg); color: var(--c-warning-text); }
.badge-danger  { background: var(--c-danger-bg);  color: var(--c-danger-text); }
.badge-info    { background: var(--c-info-bg);    color: var(--c-info-text); }
.badge-purple  { background: var(--c-purple-bg);  color: var(--c-purple-text); }
.badge-muted   { background: var(--c-grey-bg);    color: var(--c-grey-text); }
.badge-brand   { background: var(--c-brand-50);   color: var(--c-brand-dark); }

/* === Progress / прогресс-бар === */
.progress {
  width: 100%; height: 6px;
  background: var(--c-border);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.progress > .progress__fill {
  height: 100%;
  background: var(--c-brand);
  border-radius: inherit;
  transition: width var(--t-slow) var(--ease);
}
.progress.is-success > .progress__fill { background: var(--c-success); }
.progress.is-warning > .progress__fill { background: var(--c-warning); }
.progress.is-danger  > .progress__fill { background: var(--c-danger); }

/* HTML5 native <progress> для upload */
progress.upload-progress {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px;
  border: 0; border-radius: var(--r-pill);
  background: var(--c-border); overflow: hidden;
}
progress.upload-progress::-webkit-progress-bar { background: var(--c-border); border-radius: var(--r-pill); }
progress.upload-progress::-webkit-progress-value { background: var(--c-brand); border-radius: var(--r-pill); transition: width var(--t-fast); }
progress.upload-progress::-moz-progress-bar { background: var(--c-brand); border-radius: var(--r-pill); }

.upload-row {
  display: grid; grid-template-columns: 1fr auto; gap: var(--sp-2);
  padding: var(--sp-3);
  background: var(--c-bg);
  border-radius: var(--r-sm);
  font-size: 14px;
}
.upload-row__name { font-weight: 500; color: var(--c-text); }
.upload-row__progress { grid-column: 1 / -1; }
.upload-row__meta { font-size: 13px; color: var(--c-muted); }

/* === Stepper стадий === */
.stepper {
  display: flex; align-items: center;
  gap: var(--sp-2); padding: var(--sp-2) 0;
  overflow-x: auto;
}
.stepper__step {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--c-bg); color: var(--c-muted);
  font-size: 13px; font-weight: 500; white-space: nowrap;
  border: 1px solid var(--c-border);
}
.stepper__step.is-done    { background: var(--c-success-bg); color: var(--c-success-text); border-color: transparent; }
.stepper__step.is-active  { background: var(--c-brand); color: var(--c-on-brand); border-color: transparent; }
.stepper__step.is-blocked { background: var(--c-danger-bg); color: var(--c-danger-text); border-color: transparent; }
.stepper__dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* === Поиск === */
.search-input {
  display: flex; align-items: center; gap: var(--sp-2);
  width: 100%;
  height: 48px;
  padding: 0 var(--sp-4);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.search-input:focus-within {
  border-color: var(--c-brand);
  box-shadow: 0 0 0 3px rgba(18,106,238,.15);
}
.search-input input {
  flex: 1 1 auto;
  border: 0; outline: none; background: transparent;
  font-size: 16px; color: var(--c-text);
}
.search-input input::placeholder { color: var(--c-soft); }
.search-input .icon { color: var(--c-muted); }
@media (max-width: 768px) { .search-input { height: 56px; font-size: 17px; } }

.search-results {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-3);
  max-height: 60vh; overflow-y: auto;
  margin-top: var(--sp-2);
}
.search-group__title {
  padding: var(--sp-2) var(--sp-3);
  font-size: 11px; font-weight: 500;
  color: var(--c-muted); text-transform: uppercase; letter-spacing: .06em;
}
.search-item {
  display: block; padding: var(--sp-3) var(--sp-4);
  color: var(--c-text); text-decoration: none;
  border-top: 1px solid var(--c-border);
}
.search-item:hover { background: var(--c-bg); text-decoration: none; }

/* === Inputs === */
.input-text, .input-textarea, .input-select {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  background: var(--c-surface);
  color: var(--c-text);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  font-size: 16px; line-height: 1.4;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input-text:focus, .input-textarea:focus, .input-select:focus {
  outline: none; border-color: var(--c-brand);
  box-shadow: 0 0 0 3px rgba(18,106,238,.15);
}
.input-textarea { min-height: 96px; resize: vertical; font-family: inherit; }
.input-error { border-color: var(--c-danger); }
.input-hint { font-size: 13px; color: var(--c-muted); margin-top: 4px; }
.input-hint.error { color: var(--c-danger-text); }
.input-label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; color: var(--c-text); }

/* === Accordion (grid 0fr ↔ 1fr) === */
.accordion {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows var(--t-med) var(--ease);
}
.accordion[aria-expanded="true"] { grid-template-rows: 1fr; }
.accordion__inner { overflow: hidden; min-height: 0; }

details.disc {
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
}
details.disc > summary {
  cursor: pointer; list-style: none;
  padding: var(--sp-3) var(--sp-4);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-2);
  font-weight: 500;
}
details.disc > summary::-webkit-details-marker { display: none; }
details.disc > summary::after {
  content: '';
  width: 10px; height: 10px;
  border-right: 2px solid var(--c-muted);
  border-bottom: 2px solid var(--c-muted);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform var(--t-med) var(--ease);
}
details.disc[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
details.disc > .disc__body { padding: 0 var(--sp-4) var(--sp-4); }

/* === Modal === */
.modal-back {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-4);
}
.modal {
  background: var(--c-surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  max-width: 480px; width: 100%;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: var(--sp-5);
}
.modal__header { margin-bottom: var(--sp-3); }
.modal__footer { display: flex; gap: var(--sp-2); justify-content: flex-end; margin-top: var(--sp-4); }

/* === Bottom sheet (mobile) === */
@media (max-width: 768px) {
  .modal-back { align-items: flex-end; padding: 0; }
  .modal {
    max-width: 100%;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    max-height: 90dvh;
    padding-bottom: calc(var(--sp-5) + env(safe-area-inset-bottom));
  }
  .modal::before {
    content: '';
    display: block; width: 36px; height: 4px;
    background: var(--c-border-strong);
    border-radius: 2px;
    margin: 0 auto var(--sp-3);
  }
}

/* === Toast === */
#toast-stack {
  position: fixed; bottom: var(--sp-4); right: var(--sp-4);
  z-index: 200; pointer-events: none;
  display: flex; flex-direction: column; gap: var(--sp-2);
  max-width: calc(100vw - 32px);
}
@media (max-width: 768px) {
  #toast-stack { right: var(--sp-4); left: var(--sp-4); bottom: calc(var(--sp-4) + env(safe-area-inset-bottom)); align-items: center; }
}
.toast {
  pointer-events: auto;
  background: var(--c-toast-bg); color: #fff;
  padding: 12px 18px;
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-3);
  font-size: 14px; line-height: 1.4;
  max-width: 360px;
  animation: toast-in var(--t-med) var(--ease);
}
.toast.is-success { background: var(--c-success); }
.toast.is-warning { background: var(--c-warning); color: #fff; }
.toast.is-error   { background: var(--c-danger); }
.toast.is-info    { background: var(--c-info); }
@keyframes toast-in {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* === Dropzone === */
.dropzone {
  border: 2px dashed var(--c-border);
  border-radius: var(--r-md);
  padding: var(--sp-6);
  text-align: center;
  background: var(--c-surface);
  transition: background-color var(--t-fast), border-color var(--t-fast);
  cursor: pointer;
}
.dropzone:hover { border-color: var(--c-brand); }
.dropzone.is-drag-over {
  background: var(--c-brand-50);
  border-color: var(--c-brand);
}
.dropzone__hint { color: var(--c-muted); font-size: 14px; margin-top: var(--sp-2); }

/* === Empty state === */
.empty-state {
  text-align: center;
  padding: var(--sp-8) var(--sp-4);
  color: var(--c-muted);
}
.empty-state__icon {
  width: 56px; height: 56px;
  margin: 0 auto var(--sp-3);
  background: var(--c-brand-50);
  border-radius: var(--r-md);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--c-brand-dark);
}
.empty-state__title { color: var(--c-text); font-size: 18px; font-weight: 500; margin-bottom: var(--sp-2); }

/* === Skeleton === */
.skel {
  background: linear-gradient(90deg, var(--c-skel-1) 0%, var(--c-skel-2) 50%, var(--c-skel-1) 100%);
  background-size: 200% 100%;
  border-radius: var(--r-sm);
  animation: skel 1.4s linear infinite;
}
.skel-line { height: 14px; margin: 6px 0; }
.skel-card { height: 88px; margin-bottom: var(--sp-2); }
@keyframes skel { from { background-position: 200% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; background: var(--c-skel-1); }
}

/* === File row === */
.file-row {
  display: grid; grid-template-columns: 32px 1fr auto; gap: var(--sp-3);
  align-items: center;
  padding: var(--sp-2) var(--sp-3);
  background: var(--c-bg);
  border-radius: var(--r-sm);
  font-size: 14px;
}
.file-row__name { font-weight: 500; color: var(--c-text); }
.file-row__meta { font-size: 13px; color: var(--c-muted); }

/* === Sticky header в карточке === */
.sticky-header {
  position: sticky; top: var(--header-h); z-index: 20;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding: var(--sp-3) var(--sp-4);
  display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap;
}

/* Tabs / timeline / admin / voice recorder / demo-strip / kv → см. pages.css */
