/* Prod Utils Studio — оформление редактора.
   Нейтральная тёмная база, чтобы превью фотографий читалось без искажений. */

:root {
  --bg: #12141a;
  --bg-panel: #1a1d26;
  --bg-elevated: #222634;
  --border: #2c3040;
  --text: #e6e8ee;
  --text-muted: #9aa1b4;
  --accent: #4c8dff;
  --accent-strong: #2f6fe0;
  --danger: #ff6b6b;
  --ok: #4ade80;
  --warn: #fbbf24;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  margin: 0 0 8px;
  font-weight: 600;
}

/* -- каркас ------------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 20px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
}

.topnav a {
  color: var(--text-muted);
}

.page {
  padding: 20px;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  margin: 0;
  font-size: 18px;
}

.panel-subtitle {
  margin: 4px 0 0;
  color: var(--text-muted);
}

.panel-body {
  padding: 20px;
}

/* -- сообщения ---------------------------------------------------------- */

.flashes {
  margin-bottom: 16px;
}

.flash {
  padding: 10px 14px;
  border-radius: var(--radius);
  margin: 0 0 8px;
  border: 1px solid var(--border);
}

.flash-info {
  border-color: var(--accent);
  background: rgba(76, 141, 255, 0.12);
}

.flash-error {
  border-color: var(--danger);
  background: rgba(255, 107, 107, 0.12);
}

.empty {
  color: var(--text-muted);
  font-style: italic;
}

/* -- кнопки и поля ------------------------------------------------------ */

.button {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

.button:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.button-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.button-primary:hover {
  background: var(--accent-strong);
}

.button-go {
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 10px 26px;
}

.field {
  display: block;
  margin-bottom: 12px;
}

.field > span {
  display: block;
  margin-bottom: 4px;
  color: var(--text-muted);
}

.field-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.field-inline > span {
  margin: 0;
  min-width: 120px;
}

input[type="text"],
input[type="email"],
input[type="password"],
select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  min-width: 220px;
}

input[type="color"] {
  width: 56px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}

.inline-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* -- ползунки ----------------------------------------------------------- */

.slider {
  display: grid;
  grid-template-columns: 130px 1fr 54px;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.slider-label {
  color: var(--text-muted);
}

.slider input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.slider-value {
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--text-muted);
}

/* -- переключатели ------------------------------------------------------ */

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
  cursor: pointer;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  width: 34px;
  height: 18px;
  border-radius: 9px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  position: relative;
  transition: background 0.15s ease;
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 0.15s ease, background 0.15s ease;
}

.toggle input:checked + .toggle-track {
  background: rgba(76, 141, 255, 0.35);
  border-color: var(--accent);
}

.toggle input:checked + .toggle-track .toggle-thumb {
  transform: translateX(16px);
  background: var(--accent);
}

/* -- редактор ------------------------------------------------------------ */

.editor {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
}

.editor-heading {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.editor-slots,
.editor-controls {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.editor-canvas {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.slot {
  margin-bottom: 14px;
}

.slot-active .slot-frame {
  border-color: var(--accent);
}

.slot-frame {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 2px dashed var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-elevated);
}

.slot-frame.phx-drop-target {
  border-color: var(--accent);
  background: rgba(76, 141, 255, 0.12);
}

.slot-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.slot-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  padding: 8px;
}

.slot-upload {
  position: absolute;
  right: 6px;
  bottom: 6px;
}

.slot-upload input[type="file"] {
  width: 28px;
  height: 28px;
  opacity: 0.35;
  cursor: pointer;
}

.slot-upload:hover input[type="file"] {
  opacity: 1;
}

.slot-caption {
  width: 100%;
  margin-top: 6px;
  padding: 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
}

.slot-progress {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

/* -- форматы и превью ---------------------------------------------------- */

.target-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.target-tab {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
}

.target-tab-active {
  border-color: var(--accent);
  background: rgba(76, 141, 255, 0.16);
}

.target-tab-size {
  font-size: 11px;
  color: var(--text-muted);
}

.preview-frame {
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-conic-gradient(#1c1f29 0% 25%, #161923 0% 50%) 50% / 24px 24px;
  border-radius: 8px;
  overflow: hidden;
}

.preview-image {
  max-width: 100%;
  max-height: 70vh;
  display: block;
}

.preview-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: ui-monospace, "SFMono-Regular", monospace;
}

.preview-message {
  color: var(--accent);
}

/* -- группы контролов ---------------------------------------------------- */

.controls-group {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px 12px;
  margin: 0 0 12px;
}

.controls-group legend {
  padding: 0 6px;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.controls-inherit {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 12px;
}

.controls-actions {
  display: flex;
  gap: 10px;
}

/* -- кривые --------------------------------------------------------------- */

.curve-block {
  margin-bottom: 12px;
}

.curve-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.curve-editor {
  height: 150px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
  touch-action: none;
}

.curve-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.curve-bg {
  fill: #0d0f14;
}

.curve-grid {
  stroke: var(--border);
  stroke-width: 0.6;
  stroke-dasharray: 3 3;
}

.curve-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
}

.curve-point {
  fill: var(--accent);
  stroke: #0d0f14;
  stroke-width: 1;
  cursor: grab;
}

/* -- задания и медиа ------------------------------------------------------ */

.job-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}

.job-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.job-status {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--border);
}

.job-succeeded {
  color: var(--ok);
  border-color: var(--ok);
}

.job-failed {
  color: var(--danger);
  border-color: var(--danger);
}

.job-running,
.job-queued {
  color: var(--warn);
  border-color: var(--warn);
}

.job-error {
  color: var(--danger);
  font-size: 12px;
}

.media-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.media-table th,
.media-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.media-table th {
  color: var(--text-muted);
  font-weight: 500;
}

.hash {
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 11px;
  color: var(--text-muted);
}

/* -- вход ------------------------------------------------------------------ */

.login {
  max-width: 380px;
  margin: 80px auto;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.login-title {
  margin-bottom: 4px;
}

.login-subtitle {
  margin: 0 0 20px;
  color: var(--text-muted);
}

.login-form .button {
  width: 100%;
  margin-top: 8px;
}

/* -- модальные окна -------------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.modal-card {
  position: relative;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  min-width: 320px;
}

@media (max-width: 1200px) {
  .editor {
    grid-template-columns: 1fr;
  }
}
