/* ═══════════════════════════════════════════════════════════
   codex-proposals.css — community card-edit proposals

   Two surfaces:
     1. #proposalModal  — the submit form (diff editor, tags, prices)
     2. #/proposals     — the public hold-all list + detail view

   Uses the global design tokens (var(--surface)/--border/--accent/--pos/
   --neg/--text/--text-dim/--radius-md) so light + dark adapt automatically.
   ═══════════════════════════════════════════════════════════ */

/* ── "Suggest an edit" CTA (card modal report notice) ──────────
   Sits beside the plain .card-report-link inside .card-report-notice.
   Styled as a small accent pill so it reads as the richer, primary action.
   Uses theme tokens so dark + light both adapt. */
#cardModal .card-suggest-link,
.card-report-notice .card-suggest-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  padding: 2px 10px;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 999px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
#cardModal .card-suggest-link:hover,
.card-report-notice .card-suggest-link:hover {
  background: var(--accent);
  color: var(--bg, #fff);
}

/* ── Submit modal ──────────────────────────────────────────── */
.proposal-modal-content {
  max-width: 720px;
  width: min(720px, 94vw);
}
.proposal-modal-body {
  padding: 16px 20px;
  max-height: 70vh;
  overflow-y: auto;
}
.proposal-intro {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin: 0 0 12px;
  line-height: 1.45;
}
.proposal-card-context {
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 14px;
  font-size: 0.95rem;
}

.proposal-diff-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.proposal-diff-row {
  display: grid;
  grid-template-columns: minmax(110px, 160px) minmax(80px, 1fr) minmax(120px, 1.4fr);
  gap: 6px 12px;
  align-items: start;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.proposal-diff-header,
.proposal-diff-subhead {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  font-weight: 700;
}
.proposal-diff-subhead {
  grid-template-columns: 1fr;
  margin-top: 10px;
  border-bottom: 2px solid var(--border);
}
.proposal-diff-label {
  font-weight: 600;
  font-size: 0.85rem;
  padding-top: 7px; /* optically align the label with the input text */
}
.proposal-diff-current {
  color: var(--text-dim);
  font-size: 0.85rem;
  word-break: break-word;
  padding-top: 7px;
}
.proposal-diff-header .proposal-diff-head {
  padding-top: 0;
}

/* Section dividers that group the long field list (Names / Card details / … ) */
.proposal-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 2px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.proposal-section-head::before {
  content: '';
  flex: 0 0 auto;
  width: 3px;
  height: 13px;
  border-radius: 2px;
  background: var(--accent);
}
.proposal-grid-hint {
  font-size: 0.76rem;
  color: var(--text-dim);
  margin: 2px 0 0;
}
/* Inline hint under a field input (value range / format) */
.proposal-field-hint {
  display: block;
  margin-top: 3px;
  font-size: 0.72rem;
  color: var(--text-dim);
  opacity: 0.85;
}
.proposal-diff-empty {
  opacity: 0.5;
  font-style: italic;
}
.proposal-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface2, var(--surface));
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  box-sizing: border-box;
}
.proposal-input:focus {
  outline: none;
  border-color: var(--accent);
}
.proposal-input.field-error {
  border-color: var(--neg);
}
.proposal-textarea {
  resize: vertical;
  min-height: 48px;
}
.proposal-select {
  cursor: pointer;
}

/* "Add a price row" / "Add a source language" inline controls in the diff grid */
.proposal-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 0 4px;
}
.proposal-add-row .proposal-add-lang {
  width: auto;
  flex: 0 0 auto;
  min-width: 96px;
}
.proposal-add-row-btn {
  font-size: 0.82rem;
  padding: 4px 12px;
  white-space: nowrap;
}

.proposal-tags {
  margin: 16px 0 8px;
}
.proposal-tags > label {
  font-weight: 600;
  font-size: 0.85rem;
  display: block;
  margin-bottom: 6px;
}
.proposal-tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.proposal-tag-chip {
  border: 1px solid var(--border);
  background: var(--surface2, var(--surface));
  color: var(--text);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.8rem;
  cursor: pointer;
}
.proposal-tag-chip--add {
  border-color: var(--pos);
  color: var(--pos);
  background: color-mix(in srgb, var(--pos) 12%, transparent);
}
.proposal-tag-x {
  opacity: 0.6;
}
.proposal-tag-add {
  display: flex;
  gap: 8px;
}
.proposal-tag-add .proposal-input {
  flex: 1;
}

.proposal-form-group {
  margin: 12px 0;
}
.proposal-form-group > label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 4px;
}
.proposal-form-row--half {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.proposal-image-control {
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 10px);
  padding: 14px 16px 16px;
  margin: 14px 0;
}
.proposal-image-control legend {
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0 6px;
}
.proposal-image-meta {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

/* Styled file picker / drag-and-drop zone (replaces the native file input) */
.proposal-file {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 96px;
  padding: 16px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-md, 10px);
  background: var(--surface2, var(--surface));
  color: var(--text-dim);
  cursor: pointer;
  text-align: center;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease;
}
.proposal-file:hover,
.proposal-file:focus-within {
  border-color: var(--accent);
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}
.proposal-file.dragover {
  border-style: solid;
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--text);
}
.proposal-file-icon {
  color: var(--accent);
  opacity: 0.9;
}
.proposal-file-text {
  font-size: 0.85rem;
  font-weight: 500;
}
.proposal-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.proposal-file-name {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface);
  font-size: 0.82rem;
}
.proposal-file-name[hidden] {
  display: none; /* CSS display would otherwise override the hidden attribute */
}
.proposal-file-name .prop-file-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.proposal-file-name .prop-file-size {
  flex: 0 0 auto;
  color: var(--text-dim);
}
.proposal-file-remove {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 4px;
}
.proposal-file-remove:hover {
  color: var(--neg);
  background: color-mix(in srgb, var(--neg) 14%, transparent);
}
.prop-image-preview {
  margin-top: 10px;
}
.prop-preview-img {
  max-height: 220px;
  max-width: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--border);
}
@media (max-width: 560px) {
  .proposal-image-meta {
    grid-template-columns: 1fr;
  }
}

/* Public-view image thumbnails (sandboxed ?img= derivatives) */
.prop-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.prop-thumb {
  height: 90px;
  width: auto;
  max-width: 140px;
  object-fit: cover;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--border);
}
.proposal-hint {
  display: block;
  color: var(--text-dim);
  font-size: 0.78rem;
  margin-top: 4px;
}
.validation-error {
  color: var(--neg);
  font-size: 0.78rem;
  margin-top: 4px;
}

@media (max-width: 560px) {
  .proposal-diff-row {
    grid-template-columns: 1fr;
    gap: 3px;
  }
  .proposal-diff-header {
    display: none;
  }
  .proposal-form-row--half {
    grid-template-columns: 1fr;
  }
}

/* ── Public #/proposals view ───────────────────────────────── */
.prop-page {
  max-width: 880px;
  margin: 0 auto;
}
.prop-hero .prop-add-cta {
  margin-top: 12px;
}

.prop-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
}
.prop-filter-label {
  font-weight: 600;
  color: var(--text-dim);
  margin-right: 4px;
  font-size: 0.85rem;
}
.prop-chip {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 4px 12px;
  cursor: pointer;
  font-size: 0.82rem;
}
.prop-chip:hover {
  border-color: var(--accent);
}
.prop-chip.active {
  background: var(--accent);
  color: var(--bg, #fff);
  border-color: transparent;
}

.prop-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}
.prop-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  padding: 14px 16px;
  background: var(--surface);
}
.prop-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.prop-card-title {
  font-weight: 700;
}

.prop-kind-badge,
.prop-status-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.prop-kind-badge {
  background: var(--surface2, var(--surface));
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.prop-status-badge {
  margin-left: auto;
}
.prop-status-applied {
  background: color-mix(in srgb, var(--pos) 16%, transparent);
  color: var(--pos);
}
.prop-status-published {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
}

.prop-diff-row {
  display: grid;
  grid-template-columns: minmax(90px, 150px) 1fr auto 1fr;
  gap: 8px;
  align-items: baseline;
  padding: 4px 0;
  font-size: 0.9rem;
}
.prop-diff-label {
  font-weight: 600;
  color: var(--text-dim);
}
.prop-diff-from {
  color: var(--neg);
  text-decoration: line-through;
  word-break: break-word;
}
.prop-diff-to {
  color: var(--pos);
  word-break: break-word;
}
.prop-diff-arrow {
  opacity: 0.5;
}

.prop-tag-row {
  display: inline-flex;
  gap: 4px;
  margin-right: 8px;
  font-size: 0.85rem;
}
.prop-tag-add .prop-tag-op {
  color: var(--pos);
  font-weight: 700;
}
.prop-tag-remove .prop-tag-op {
  color: var(--neg);
  font-weight: 700;
}

.prop-img-note,
.prop-note {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 8px;
}
.prop-note {
  white-space: pre-wrap;
  word-break: break-word;
}

.prop-card-foot {
  display: flex;
  gap: 12px;
  margin-top: 10px;
  font-size: 0.76rem;
  color: var(--text-dim);
}
.prop-commit {
  font-family: var(--font-mono, monospace);
}

.prop-empty,
.prop-loading {
  text-align: center;
  padding: 40px 0;
  color: var(--text-dim);
}

@media (max-width: 560px) {
  .prop-diff-row {
    grid-template-columns: 1fr;
  }
  .prop-diff-arrow {
    display: none;
  }
  .prop-status-badge {
    margin-left: 0;
  }
}
