/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 */

/* ---------- Унифицированные form-контролы ---------- */
/* Используются для согласованного вида input/select/checkbox в формах,
   когда нативный вид браузера ломает сетку. */
.app-input,
.app-select,
.app-textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
  color: #111827;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.app-input,
.app-select {
  height: 40px;
  padding: 0 12px;
}
.app-textarea {
  padding: 10px 12px;
  min-height: 80px;
  line-height: 1.45;
  resize: vertical;
}
.app-input::placeholder,
.app-textarea::placeholder { color: #9ca3af; }
.app-input:focus,
.app-select:focus,
.app-textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}
.app-input[readonly],
.app-textarea[readonly] {
  background: #f9fafb;
  color: #6b7280;
  cursor: default;
}
.app-input[disabled],
.app-select[disabled],
.app-textarea[disabled] {
  background: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
}

.app-select {
  padding-right: 34px;
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%236b7280'><path stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M6 8l4 4 4-4'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
}

/* Boolean-контрол в виде toggle switch.
   Семантически остаётся <input type="checkbox"> — серверный код и тесты не меняются. */
.app-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 44px;
  height: 24px;
  border: 1px solid #d1d5db;
  border-radius: 9999px;
  background: #e5e7eb;
  cursor: pointer;
  display: inline-block;
  position: relative;
  flex-shrink: 0;
  transition: background 150ms ease, border-color 150ms ease;
  vertical-align: middle;
}
.app-checkbox::before {
  content: "";
  position: absolute;
  top: 1px;
  left: 1px;
  width: 20px;
  height: 20px;
  border-radius: 9999px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  transition: transform 150ms ease;
}
.app-checkbox:hover { border-color: #9ca3af; }
.app-checkbox:checked {
  background: #4f46e5;
  border-color: #4f46e5;
}
.app-checkbox:checked::before {
  transform: translateX(20px);
}
.app-checkbox:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}
.app-checkbox[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Базовая кнопка — h-10, под высоту .app-input. Использовать как
   <button class="btn"> или <a class="btn">.
   Модификаторы: .btn-primary (индиго), .btn-danger (красный outline). */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 16px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.btn:hover { background: #f9fafb; border-color: #9ca3af; color: #111827; }

.btn-primary {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #fff;
}
.btn-primary:hover { background: #4338ca; border-color: #4338ca; color: #fff; }

.btn-danger {
  color: #b42318;
  border-color: #fecdca;
}
.btn-danger:hover { background: #fef3f2; border-color: #fda29b; color: #912018; }

/* Маленькая кнопка для действий в таблицах ("Открыть", "Редактировать", "Превью PDF").
   Соответствует .btn-sm в wireframes.html. */
.btn-sm {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.btn-sm:hover { background: #f9fafb; border-color: #9ca3af; color: #111827; }
.btn-sm.btn-danger { color: #b42318; border-color: #fecdca; }
.btn-sm.btn-danger:hover { background: #fef3f2; border-color: #fda29b; color: #912018; }
.btn-sm + .btn-sm { margin-left: 6px; }

/* Чип плейсхолдера в TipTap-редакторе и в палитре. */
.placeholder-chip {
  display: inline-block;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #3730a3;
  border-radius: 4px;
  padding: 0 6px;
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 0.85em;
  white-space: nowrap;
  user-select: none;
}
.placeholder-chip:hover { background: #e0e7ff; }
@media print {
  .placeholder-chip {
    background: transparent; border: 0; padding: 0;
    color: inherit; font-family: inherit;
  }
}

/* Область редактирования TipTap. */
.template-editor-area .ProseMirror {
  outline: none;
  min-height: 360px;
}
.template-editor-area .ProseMirror p { margin: 0.5em 0; }
.template-editor-area table.line-items {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
}
.template-editor-area table.line-items th,
.template-editor-area table.line-items td {
  border: 1px solid #d0d5dd;
  padding: 4px 8px;
  font-size: 0.9em;
  text-align: left;
}
.template-editor-area table.line-items th {
  background: #f9fafb;
  font-weight: 600;
}
.template-editor-area table.line-items tr[data-loop-row="true"] {
  background: #eef2ff;
}
.template-editor-area .ProseMirror-selectednode {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
}

/* Скрыть scroll внутри редактора, если контент длинный. */
.template-editor-area { overflow-x: auto; }
