/*
  Agent Prompt Builder - Custom styles
  Scope: visual polish beyond Tailwind utility classes.
*/

:root {
  --card-bg: rgba(15, 23, 42, 0.7);
  --card-border: rgba(51, 65, 85, 0.7);
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 1rem;
  box-shadow: 0 10px 35px rgba(2, 6, 23, 0.35);
}

.btn {
  border: 1px solid rgb(51 65 85);
  background: rgb(15 23 42);
  color: rgb(226 232 240);
  border-radius: 0.75rem;
  padding: 0.5rem 0.9rem;
  font-size: 0.875rem;
  transition: all 150ms ease;
}

.btn:hover {
  border-color: rgb(71 85 105);
  transform: translateY(-1px);
}

.btn-primary {
  background: rgb(14 116 144);
  border-color: rgb(8 145 178);
  color: white;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field.full {
  grid-column: 1 / -1;
}

.field > span {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgb(148 163 184);
}

.field input,
.field textarea,
.field select {
  border: 1px solid rgb(51 65 85);
  background: rgb(2 6 23 / 0.6);
  color: rgb(226 232 240);
  border-radius: 0.7rem;
  padding: 0.55rem 0.7rem;
  font-size: 0.9rem;
  outline: none;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: rgb(34 211 238);
  box-shadow: 0 0 0 2px rgb(34 211 238 / 0.2);
}

.field input.is-valid,
.field textarea.is-valid,
.field select.is-valid {
  border-color: rgb(34 197 94);
}

.field input.is-invalid,
.field textarea.is-invalid,
.field select.is-invalid {
  border-color: rgb(239 68 68);
}

.field-error {
  font-size: 0.75rem;
  color: rgb(248 113 113);
}

.validation-indicator {
  font-size: 0.8rem;
  margin-top: -0.1rem;
  margin-bottom: 0.1rem;
  min-height: 1rem;
}

.validation-indicator.ok {
  color: rgb(74 222 128);
}

.validation-indicator.error {
  color: rgb(248 113 113);
}

.panel-title {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgb(148 163 184);
  margin-bottom: 0.8rem;
}

.preview-root {
  border: 1px solid rgb(30 41 59);
  border-radius: 0.9rem;
  padding: 0.85rem;
  background: rgb(2 6 23 / 0.45);
  max-height: 420px;
  overflow: auto;
}

.preview-grid {
  display: grid;
  gap: 0.7rem;
}

.preview-card {
  border: 1px solid rgb(30 41 59);
  border-radius: 0.7rem;
  background: rgb(2 6 23 / 0.5);
}

.preview-card h4 {
  margin: 0;
  padding: 0.6rem 0.7rem;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgb(148 163 184);
  border-bottom: 1px solid rgb(30 41 59);
}

.code-block {
  margin: 0;
  padding: 0.7rem;
  font-size: 0.75rem;
  line-height: 1.45;
  color: rgb(226 232 240);
  overflow: auto;
}

.step-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.step-badge {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  border: 1px solid rgb(71 85 105);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
}

.step-ok {
  border-color: rgb(22 163 74);
  color: rgb(74 222 128);
}

.step-error {
  border-color: rgb(185 28 28);
  color: rgb(248 113 113);
}

.validation-success,
.validation-summary-box {
  border: 1px solid rgb(51 65 85);
  border-radius: 0.75rem;
  background: rgb(2 6 23 / 0.45);
  padding: 0.75rem;
  font-size: 0.8rem;
}

.validation-success {
  color: rgb(110 231 183);
}

.validation-summary-box p {
  margin: 0 0 0.5rem;
  color: rgb(248 113 113);
}

.summary-step h5 {
  margin: 0.3rem 0;
  color: rgb(148 163 184);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.summary-step ul {
  margin: 0;
  padding-left: 1rem;
  color: rgb(248 113 113);
}

.import-dropzone {
  border: 1px dashed rgb(71 85 105);
  border-radius: 0.8rem;
  padding: 0.9rem;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
  background: rgb(2 6 23 / 0.4);
}

.import-dropzone.drag-active {
  border-color: rgb(34 211 238);
  background: rgb(8 47 73 / 0.5);
}

.tok-key { color: #93c5fd; }
.tok-str { color: #86efac; }
.tok-bool { color: #f9a8d4; }
.tok-num { color: #fcd34d; }

.diff-root {
  display: grid;
  gap: 0.75rem;
}

.diff-file {
  border: 1px solid rgb(51 65 85);
  border-radius: 0.75rem;
  overflow: hidden;
  background: rgb(2 6 23 / 0.35);
}

.diff-file-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid rgb(30 41 59);
}

.diff-file-head h5 {
  margin: 0;
  font-size: 0.8rem;
}

.diff-grid {
  max-height: 260px;
  overflow: auto;
}

.diff-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid rgb(30 41 59 / 0.6);
}

.diff-cell {
  padding: 0.35rem 0.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
}

.diff-cell code {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.73rem;
}

.diff-left { border-right: 1px solid rgb(30 41 59 / 0.8); }
.diff-added { background: rgb(20 83 45 / 0.25); }
.diff-removed { background: rgb(127 29 29 / 0.25); }
.diff-modified { background: rgb(161 98 7 / 0.2); }

.wd-add { background: rgb(22 163 74 / 0.4); color: rgb(220 252 231); }
.wd-del { background: rgb(220 38 38 / 0.4); color: rgb(254 226 226); }

.merge-spacer {
  width: 14px;
  display: inline-block;
}

.github-panel {
  border: 1px solid rgb(51 65 85);
  border-radius: 0.9rem;
  padding: 0.9rem;
  background: rgb(2 6 23 / 0.45);
}

.github-status {
  font-size: 0.75rem;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  border: 1px solid rgb(71 85 105);
}

.github-status.connected {
  color: rgb(74 222 128);
  border-color: rgb(22 163 74);
}

.github-status.disconnected {
  color: rgb(248 113 113);
  border-color: rgb(185 28 28);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgb(2 6 23 / 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: rgb(15 23 42);
  border: 1px solid rgb(51 65 85);
  border-radius: 1rem;
  padding: 1rem;
  width: min(540px, 92vw);
}

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

  .diff-row {
    grid-template-columns: 1fr;
  }

  .diff-left {
    border-right: 0;
    border-bottom: 1px solid rgb(30 41 59 / 0.8);
  }
}
