/* ==========================================================================
   Modal shell & shared form primitives
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  background: rgba(14, 30, 25, 0.55);
  opacity: 0;
  transition: opacity 180ms ease;
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}

.modal-overlay.is-open {
  opacity: 1;
}

.modal-card {
  width: min(710px, 100%);
  max-height: calc(100vh - 48px);
  padding: 25px 27px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 28px;
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 201, 74, 0.07), transparent 28%),
    var(--surface);
  box-shadow: 0 40px 95px rgba(8, 24, 18, 0.3);
  opacity: 0;
  transform: translateY(16px) scale(0.985);
  transition: opacity 200ms ease, transform 240ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.modal-overlay.is-open .modal-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.composer-modal .modal-card {
  width: min(760px, 100%);
}

.modal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 17px;
  border-bottom: 1px solid var(--line);
}

.modal-heading h2 {
  color: var(--ink);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.045em;
  line-height: 1.3;
}

.modal-heading p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
}

.modal-close {
  margin-top: -2px;
  color: var(--muted);
  background: var(--surface-soft);
}

.form-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
}

.form-field > label,
.form-field > .field-label-row label {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.form-field > small {
  color: var(--muted-light);
  font-size: 8.5px;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.char-count {
  color: var(--muted-light);
  font-family: var(--font-display);
  font-size: 9px;
}

.text-input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: 0;
  color: var(--ink);
  background: #fbf7ef;
  font-size: 12px;
  line-height: 1.7;
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.text-input::placeholder {
  color: var(--muted-light);
}

.text-input:focus {
  border-color: rgba(28, 155, 131, 0.4);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(28, 155, 131, 0.065);
}

.text-input--title {
  height: 45px;
  padding: 0 13px;
  font-size: 14.5px;
  font-weight: 700;
}

.text-input--body {
  min-height: 156px;
  resize: vertical;
}

.input-wrap {
  display: flex;
  align-items: center;
  gap: 0;
  height: 47px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fbf7ef;
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.input-wrap:focus-within {
  border-color: rgba(28, 155, 131, 0.4);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(28, 155, 131, 0.065);
}

.input-icon {
  width: 16px;
  height: 16px;
  flex: none;
  margin-right: 9px;
  color: var(--muted-light);
}

.input-wrap input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 12px;
}

.input-wrap input::placeholder {
  color: var(--muted-light);
}

.select-wrap {
  position: relative;
  display: flex;
  align-items: center;
  height: 47px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fbf7ef;
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.select-wrap:focus-within {
  border-color: rgba(28, 155, 131, 0.4);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(28, 155, 131, 0.065);
}

.select-wrap select {
  width: 100%;
  height: 100%;
  padding: 0 25px 0 0;
  border: 0;
  outline: 0;
  appearance: none;
  color: var(--ink);
  background: transparent;
  font-size: 11.5px;
  cursor: pointer;
}

.select-chevron {
  position: absolute;
  right: 13px;
  width: 14px;
  height: 14px;
  color: var(--muted-light);
  pointer-events: none;
}

.form-error {
  padding: 9px 11px;
  border: 1px solid rgba(205, 67, 42, 0.14);
  border-radius: 10px;
  color: #a83c28;
  background: rgba(255, 111, 78, 0.07);
  font-size: 10px;
  line-height: 1.6;
}

.shake {
  animation: form-shake 360ms ease;
}

@keyframes form-shake {
  0%, 100% { transform: translateX(0); }
  22% { transform: translateX(-4px); }
  45% { transform: translateX(4px); }
  68% { transform: translateX(-2px); }
  85% { transform: translateX(2px); }
}

/* ==========================================================================
   Composer
   ========================================================================== */

.composer-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 17px;
}

.category-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.category-option {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.category-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.category-option-inner {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 9.5px;
  font-weight: 600;
  line-height: 1.3;
  transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.category-option:hover .category-option-inner {
  color: var(--ink);
  border-color: var(--line-strong);
}

.category-option input:checked + .category-option-inner {
  color: color-mix(in srgb, var(--category-color) 74%, #1a2e29);
  border-color: color-mix(in srgb, var(--category-color) 28%, transparent);
  background: color-mix(in srgb, var(--category-color) 11%, #fffdf8);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--category-color) 7%, transparent);
}

.category-option input:focus-visible + .category-option-inner {
  outline: 3px solid rgba(255, 111, 78, 0.35);
  outline-offset: 2px;
}

.image-uploader {
  display: flex;
  min-height: 89px;
  align-items: center;
  justify-content: center;
  padding: 10px;
  overflow: hidden;
  border: 1px dashed rgba(24, 44, 39, 0.2);
  border-radius: 15px;
  background: #faf6ed;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.image-uploader:hover {
  border-color: rgba(28, 155, 131, 0.3);
  background: #fcf9f2;
}

.upload-placeholder {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 11px;
}

.upload-icon {
  display: flex;
  width: 42px;
  height: 42px;
  flex: none;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: var(--teal);
  background: rgba(28, 155, 131, 0.075);
}

.upload-icon .icon {
  width: 19px;
  height: 19px;
}

.upload-placeholder > div {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1px;
}

.upload-placeholder strong {
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 700;
}

.upload-placeholder small {
  color: var(--muted-light);
  font-size: 8.5px;
}

.upload-processing {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--teal);
  font-size: 10px;
}

.upload-preview {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 11px;
}

.upload-preview img {
  width: 100%;
  height: 176px;
  object-fit: cover;
}

.upload-preview-actions {
  position: absolute;
  right: 9px;
  bottom: 9px;
  display: flex;
  gap: 5px;
}

.upload-preview-actions .btn {
  min-height: 29px;
  padding: 5px 9px;
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
  background: rgba(20, 34, 28, 0.44);
  font-size: 8.5px;
  backdrop-filter: blur(8px);
}

.upload-preview-actions .btn:hover {
  background: rgba(20, 34, 28, 0.65);
}

.upload-preview-badge {
  position: absolute;
  top: 9px;
  left: 9px;
  padding: 3px 7px;
  border-radius: 6px;
  color: #fff;
  background: rgba(20, 34, 28, 0.42);
  font-size: 8px;
  font-weight: 600;
  backdrop-filter: blur(6px);
}

.composer-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(215px, 0.62fr);
  align-items: stretch;
  gap: 12px;
}

.tag-field {
  gap: 5px;
}

.anonymous-switch {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #faf6ed;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.anonymous-switch:hover {
  border-color: var(--line-strong);
}

.anonymous-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  display: flex;
  width: 33px;
  height: 19px;
  flex: none;
  align-items: center;
  padding: 2px;
  border-radius: var(--radius-pill);
  background: rgba(24, 44, 39, 0.14);
  transition: background-color 180ms ease;
}

.switch-track > span {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(24, 44, 39, 0.2);
  transition: transform 180ms ease;
}

.anonymous-switch input:checked + .switch-track {
  background: var(--violet);
}

.anonymous-switch input:checked + .switch-track > span {
  transform: translateX(14px);
}

.anonymous-switch input:focus-visible + .switch-track {
  outline: 3px solid rgba(152, 121, 246, 0.35);
  outline-offset: 2px;
}

.anonymous-switch-copy {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.anonymous-switch-copy strong {
  color: var(--ink-soft);
  font-size: 9.5px;
  font-weight: 700;
}

.anonymous-switch-copy small {
  color: var(--muted-light);
  font-size: 7.5px;
  line-height: 1.5;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 1px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.composer-footer > p {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  max-width: 390px;
  color: var(--muted-light);
  font-size: 8px;
  line-height: 1.7;
}

.composer-footer > p .icon {
  width: 12px;
  height: 12px;
  flex: none;
  margin-top: 1px;
  color: var(--sun);
}

.composer-footer-actions {
  display: flex;
  flex: none;
  gap: 7px;
}

.composer-footer-actions .btn {
  min-height: 38px;
  padding: 7px 14px;
  font-size: 11px;
}
