/* Платный статус в профиле: плашка, кнопка владельца, модалка (views/paidStatus/*). */

/* ---------- Плашка ---------- */
.paid-status {
  --ps-accent: #3498db;
  --ps-fg: #1f5f8b;
  --ps-bg: rgba(52, 152, 219, 0.10);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  box-sizing: border-box;
  padding: 6px 12px 6px 13px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border: 1px solid color-mix(in srgb, var(--ps-accent) 28%, transparent);
  background: linear-gradient(var(--ps-bg), var(--ps-bg)), rgba(255, 255, 255, 0.88);
  box-shadow: inset 3px 0 0 var(--ps-accent);
  color: var(--ps-fg);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
}
.paid-status__icon {
  flex: 0 0 auto;
  color: var(--ps-accent);
}
.paid-status__text {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}
.paid-status--compact {
  padding: 3px 9px 3px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  gap: 5px;
}

.paid-status--blue   { --ps-accent: #3498db; --ps-fg: #1f5f8b; --ps-bg: rgba(52, 152, 219, 0.10); }
.paid-status--green  { --ps-accent: #27ae60; --ps-fg: #1d6b3f; --ps-bg: rgba(39, 174, 96, 0.10); }
.paid-status--amber  { --ps-accent: #f39c12; --ps-fg: #8a5300; --ps-bg: rgba(243, 156, 18, 0.12); }
.paid-status--rose   { --ps-accent: #e84393; --ps-fg: #9c1f5b; --ps-bg: rgba(232, 67, 147, 0.10); }
.paid-status--violet { --ps-accent: #8e44ad; --ps-fg: #5f2c78; --ps-bg: rgba(142, 68, 173, 0.10); }
.paid-status--slate  { --ps-accent: #64748b; --ps-fg: #3b4656; --ps-bg: rgba(100, 116, 139, 0.12); }

html.dark-theme .paid-status {
  background: linear-gradient(var(--ps-bg), var(--ps-bg)), rgba(30, 30, 30, 0.88);
}
html.dark-theme .paid-status--blue   { --ps-fg: #9fd1f3; --ps-bg: rgba(93, 173, 226, 0.16); }
html.dark-theme .paid-status--green  { --ps-fg: #8fe0b0; --ps-bg: rgba(46, 204, 113, 0.15); }
html.dark-theme .paid-status--amber  { --ps-fg: #f7cd80; --ps-bg: rgba(243, 156, 18, 0.16); }
html.dark-theme .paid-status--rose   { --ps-fg: #f6a8cf; --ps-bg: rgba(232, 67, 147, 0.16); }
html.dark-theme .paid-status--violet { --ps-fg: #d2b0e3; --ps-bg: rgba(155, 89, 182, 0.18); }
html.dark-theme .paid-status--slate  { --ps-fg: #d5dce6; --ps-bg: rgba(148, 163, 184, 0.16); }

.paid-status-book { margin: 6px 0 2px; }

/* ---------- Строка в шапке профиля ---------- */
.paid-status-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  max-width: 640px;
}

.paid-status-manage {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px dashed var(--border-color, #cbd5e1);
  background: rgba(255, 255, 255, 0.85);
  color: var(--text-muted, #6c757d);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.paid-status-manage:hover,
.paid-status-manage:focus-visible {
  color: var(--primary-color, #3498db);
  border-color: var(--primary-color, #3498db);
  border-style: solid;
  outline: none;
}
.paid-status-manage__edit { display: none; }
.paid-status-manage--icon {
  width: 30px;
  padding: 0;
  justify-content: center;
  border-style: solid;
}
.paid-status-manage--icon .paid-status-manage__edit { display: block; }
.paid-status-manage--icon .paid-status-manage__add,
.paid-status-manage--icon .paid-status-manage__label { display: none; }
html.dark-theme .paid-status-manage { background: rgba(30, 30, 30, 0.85); }

/* ---------- Модалка ---------- */
dialog.paid-status-dialog {
  width: calc(100% - 24px);
  max-width: 560px;
  border-radius: 12px;
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.18);
}
dialog.paid-status-dialog > section {
  max-width: 100%;
  min-width: 0;
  padding: 0;
  gap: 0;
  border-radius: 12px;
}
dialog.paid-status-dialog > section > header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}
dialog.paid-status-dialog > section > header > h2 {
  font-size: 17px;
  font-weight: 600;
}
dialog.paid-status-dialog > section > div {
  border-top: none;
  margin-top: 0;
  padding: 16px 18px 18px;
  max-height: calc(90svh - 60px);
}
html.dark-theme dialog.paid-status-dialog > section { background: #1e1e1e; }
html.dark-theme dialog.paid-status-dialog > section > header > h2,
html.dark-theme dialog.paid-status-dialog > section > div { color: #e0e0e0; }

.ps-modal { display: flex; flex-direction: column; gap: 14px; font-size: 14px; }
.ps-modal.is-busy { cursor: progress; }
.ps-modal [hidden] { display: none !important; }
.ps-body { display: flex; flex-direction: column; gap: 16px; }
.ps-loading { padding: 24px 0; text-align: center; color: var(--text-muted, #6c757d); }

.ps-term {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--secondary-color, #f1f5f9);
}
.ps-term__text { color: var(--text-muted, #6c757d); }
.ps-term__balance { margin-left: auto; white-space: nowrap; }
.ps-chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.ps-chip--ok  { background: rgba(46, 204, 113, 0.16); color: #1d7a45; }
.ps-chip--off { background: rgba(108, 117, 125, 0.14); color: var(--text-muted, #6c757d); }
html.dark-theme .ps-chip--ok { color: #8fe0b0; }

.ps-section { display: flex; flex-direction: column; gap: 8px; }
.ps-section + .ps-section { padding-top: 14px; border-top: 1px solid var(--border-color, #e2e8f0); }
.ps-label { font-weight: 600; font-size: 13px; color: inherit; margin: 0; }
.ps-hint { font-size: 12px; color: var(--text-muted, #6c757d); line-height: 1.45; }
.ps-muted { color: var(--text-muted, #6c757d); font-weight: 400; }
.ps-field-error { font-size: 12.5px; color: var(--danger-color, #e74c3c); min-height: 0; }
.ps-field-error:empty { display: none; }
.ps-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ps-actions .btn { margin: 0; }

.ps-preview {
  padding: 12px;
  border-radius: 10px;
  border: 1px dashed var(--border-color, #e2e8f0);
}
.ps-preview .paid-status.is-placeholder .paid-status__text { opacity: .55; font-style: italic; }

.ps-input-wrap { position: relative; }
.ps-modal .ps-input {
  width: 100%;
  box-sizing: border-box;
  height: 38px;
  margin: 0;
  padding: 8px 64px 8px 10px;
  border-radius: 8px;
  font-size: 14px;
}
.ps-counter {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--text-muted, #6c757d);
  pointer-events: none;
}
.ps-counter.is-warn { color: var(--warning-color, #f39c12); font-weight: 600; }

.ps-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.ps-notice--pending { background: rgba(243, 156, 18, 0.12); color: #8a5300; }
.ps-notice--error { background: rgba(231, 76, 60, 0.10); color: #a93226; }
html.dark-theme .ps-notice--pending { color: #f7cd80; }
html.dark-theme .ps-notice--error { color: #f1948a; }
.ps-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--primary-color, #3498db);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
}

.ps-swatches, .ps-icons { display: flex; flex-wrap: wrap; gap: 8px; }
.ps-swatch {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--ps-accent);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: transform .12s ease;
}
.ps-swatch:hover { transform: scale(1.08); }
.ps-swatch[aria-checked="true"] {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--ps-accent);
}
html.dark-theme .ps-swatch[aria-checked="true"] { border-color: #1e1e1e; }
.ps-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border-color, #e2e8f0);
  background: transparent;
  color: var(--text-muted, #6c757d);
  cursor: pointer;
  transition: color .12s ease, border-color .12s ease, background-color .12s ease;
}
.ps-icon:hover { color: var(--primary-color, #3498db); }
.ps-icon[aria-checked="true"] {
  color: var(--primary-color, #3498db);
  border-color: var(--primary-color, #3498db);
  background: rgba(52, 152, 219, 0.08);
}
.ps-icon__none { font-size: 14px; line-height: 1; }
.ps-swatch:focus-visible, .ps-icon:focus-visible { outline: 2px solid var(--primary-color, #3498db); outline-offset: 2px; }

.ps-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ps-history__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--secondary-color, #f1f5f9);
}
.ps-history__text { min-width: 0; overflow-wrap: anywhere; font-size: 13.5px; }
.ps-history__item .btn { flex: 0 0 auto; margin: 0; }

.ps-pay__row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.ps-pay__price { font-size: 16px; }
.ps-pay__price b { font-size: 20px; }

.ps-toast {
  position: sticky;
  bottom: 0;
  align-self: center;
  padding: 8px 14px;
  border-radius: 999px;
  background: #1f2937;
  color: #fff;
  font-size: 13px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
}
.ps-toast:empty { display: none; }
.ps-toast.is-visible { opacity: 1; transform: none; }

/* ---------- Страница модерации ---------- */
.ps-admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin: 10px 0 16px;
}
.ps-admin-stats > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color, #e2e8f0);
}
.ps-admin-stats b { font-size: 18px; }
.ps-admin-stats span { font-size: 12px; color: var(--text-muted, #6c757d); }
.ps-admin-settings { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.ps-admin-settings label { margin: 0; }
.ps-admin-table td { vertical-align: middle; }
.ps-inline-form { display: inline-block; margin: 0 4px 0 0; }
.ps-reject { display: inline-block; vertical-align: top; }
.ps-reject > summary { list-style: none; display: inline-block; }
.ps-reject > summary::-webkit-details-marker { display: none; }
.ps-reject[open] > form { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; }
.ps-reject input[type="text"] { margin: 0; width: 220px; }

@media (max-width: 600px) {
  .paid-status-row { max-width: 100%; }
  .paid-status { font-size: 13px; }
  dialog.paid-status-dialog { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 14px 14px 0 0; }
  dialog.paid-status-dialog > section { border-radius: 14px 14px 0 0; }
  dialog.paid-status-dialog > section > div { padding: 14px; }
  .ps-term__balance { margin-left: 0; width: 100%; }
  .ps-pay__row .ps-actions, .ps-pay__row .ps-actions .btn { width: 100%; }
  .ps-pay__row .ps-actions .btn { text-align: center; box-sizing: border-box; }
}

@media (prefers-reduced-motion: reduce) {
  .ps-swatch, .ps-toast, .paid-status-manage { transition: none; }
}
