/* =========================================================
   Static Noir Mint Dark — Create Post
   • Casts inside index home container
   • Glass card (~0.8), gradient title bar
   • Vertical category options with pill toggles
   • Unified buttons (Publish gradient, Cancel ghost)
   • Image uploads: styled file input + dropzone look
   ========================================================= */

/* ---------- Layout (inside main-content) ---------- */
.create-wrapper {
  width: min(100%, var(--form-max));
  margin: 8px auto 18px;
  padding-inline: var(--gutter);
  color: var(--text);
}

/* Card */
.create-form {
  background: var(--glass);
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  backdrop-filter: saturate(1.1) blur(2px);
  padding: var(--pad);
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden; /* keep header radii clean */
}

/* Title bar — full gradient */
.create-title {
  margin: calc(var(--pad) * -1) calc(var(--pad) * -1) 12px;
  padding: 12px 14px;
  background: var(--grad-primary);
  color: var(--title-color); /* unified title color */
  text-align: center;
  border-top-left-radius: calc(var(--radius) - 2px);
  border-top-right-radius: calc(var(--radius) - 2px);
  font-weight: 800;
  line-height: 1.2;
  font-size: 1.35rem;
}

/* Flash messages */
.message {
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.05);
  color: var(--text);
}
.message.error {
  background: rgba(255,86,86,.12);
  border-color: rgba(255,86,86,.35);
  color: var(--error-text-color);
}
.message.success {
  background: rgba(56,189,148,.12);
  border-color: rgba(56,189,148,.35);
  color: var(--success-text-color);
}

/* Labels & inputs */
.create-label {
  font-weight: 700;
  color: var(--text);
  display: block;
}
.hint {
  font-weight: 600;
  color: var(--muted);
  font-size: .92rem;
}

.create-input,
.create-textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
  color: var(--text);
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}
.create-input { height: var(--field-h); }
.create-textarea { min-height: 200px; resize: vertical; }

.create-input::placeholder,
.create-textarea::placeholder { color: rgba(230,238,245,.55); }

.create-input:focus,
.create-textarea:focus {
  border-color: rgba(56,189,148,.45);
  box-shadow: var(--glow);
}

/* ===========================
   Images (upload)
   =========================== */
.create-images {
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,.035);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Single, multi-select input styled like a dropzone button */
.file-input {
  width: 100%;
  color: var(--text);
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}
.file-input:hover { background: rgba(255,255,255,.06); box-shadow: var(--glow); }
.file-input:focus-visible { outline: 2px solid rgba(56,189,148,.55); outline-offset: 2px; }

/* Beautify the button portion of the file input */
.file-input::file-selector-button {
  margin-right: 12px;
  padding: 8px 12px;
  border: none;
  border-radius: 10px;
  background: var(--grad-primary);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .25s ease;
}
.file-input:hover::file-selector-button { transform: translateY(-1px); box-shadow: var(--glow); }

/* Optional previews (if you add them later) */
.upload-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
}
.upload-previews .thumb {
  aspect-ratio: 1/1;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.18);
  overflow: hidden;
}
.upload-previews .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Category pills */
.category-option {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  white-space: nowrap;
}
.category-option input {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
  display: inline-grid;
  place-items: center;
  transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
  cursor: pointer;
}
.category-option input:focus-visible { box-shadow: var(--glow); outline: none; }
.category-option input:checked {
  background: rgba(56,189,148,.25);
  border-color: rgba(56,189,148,.65);
}
.category-option span {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.05);
  font-weight: 700;
  transition: box-shadow .2s ease, transform .12s ease, border-color .2s ease;
}
.category-option:hover span { box-shadow: var(--glow); transform: translateY(-1px); }

/* Actions */
.create-actions {
  display: flex;
  gap: 10px 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 6px;
}

/* Publish = primary gradient */
.publish-btn { background: var(--grad-primary); color: var(--text); }
.publish-btn:hover { transform: translateY(-1px); box-shadow: var(--glow); }
.publish-btn:focus-visible { outline: 2px solid rgba(56,189,148,.55); outline-offset: 2px; }

/* Cancel = ghost */
.cancel-btn {
  background: rgba(255,255,255,.05);
  color: var(--text);
  border: 1px solid var(--border);
}
.cancel-btn:hover { transform: translateY(-1px); box-shadow: var(--glow); }
.cancel-btn:focus-visible { outline: 2px solid rgba(56,189,148,.55); outline-offset: 2px; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .file-input { padding: 12px; }
  .file-input::file-selector-button { padding: 10px 12px; }
}

/* === Added: edit_post/edit_comment template class coverage === */
/* These templates use create-post-* naming + id-only inputs. We style them to match the Create Post theme. */

.create-post-wrapper {
  width: min(100%, var(--form-max));
  margin: 8px auto 18px;
  padding-inline: var(--gutter);
  color: var(--text);
}

.create-post-card {
  background: var(--glass);
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  backdrop-filter: saturate(1.1) blur(2px);
  padding: var(--pad);
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

/* Title inside the card (Edit Post / Edit Comment) */
.create-post-card > h1 {
  margin: calc(var(--pad) * -1) calc(var(--pad) * -1) 12px;
  padding: 12px 14px;
  background: var(--grad-primary);
  color: var(--title-color);
  text-align: center;
  border-top-left-radius: calc(var(--radius) - 2px);
  border-top-right-radius: calc(var(--radius) - 2px);
  font-weight: 800;
  line-height: 1.2;
  font-size: 1.35rem;
}

/* Form labels + controls (id-only fields) */
.create-post-form label,
.create-post-form legend {
  font-weight: 700;
  color: var(--text);
  display: block;
}

.create-post-form input[type="text"],
.create-post-form input[type="password"],
.create-post-form input[type="email"],
.create-post-form select,
.create-post-form textarea,
.create-post-form #title,
.create-post-form #body {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
  color: var(--text);
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.create-post-form input[type="text"],
.create-post-form input[type="password"],
.create-post-form input[type="email"],
.create-post-form select,
.create-post-form #title {
  height: var(--field-h);
}

.create-post-form textarea,
.create-post-form #body {
  min-height: 200px;
  resize: vertical;
}

.create-post-form input:focus,
.create-post-form select:focus,
.create-post-form textarea:focus {
  border-color: rgba(56,189,148,.45);
  box-shadow: var(--glow);
}

/* Edit Post: image add/remove controls */
.edit-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin: 8px 0 10px;
}

.edit-image-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.035);
}

.edit-image-thumb {
  display: block;
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.18);
  overflow: hidden;
  aspect-ratio: 16/10;
}

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

.edit-image-remove {
  grid-column: 2;
  font-weight: 700;
  color: var(--muted);
  margin-top: 6px;
}

.create-post-form input[type="file"][name="images"] {
  margin-top: 6px;
}

.create-post-form .help {
  font-size: .92rem;
  color: var(--muted);
  margin-top: 6px;
}

/* Categories (Edit Post) */
.category-fieldset {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,.035);
}

.category-fieldset legend {
  padding: 0 6px;
}

.category-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
}

.category-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.05);
  cursor: pointer;
  transition: box-shadow .2s ease, transform .12s ease, border-color .2s ease, background-color .2s ease;
}

.category-item input {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
  display: inline-grid;
  place-items: center;
  transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
  cursor: pointer;
}

.category-item input:checked {
  background: rgba(56,189,148,.25);
  border-color: rgba(56,189,148,.65);
}

.category-item:hover {
  box-shadow: var(--glow);
  transform: translateY(-1px);
}

/* Actions (Save / Cancel) */
.create-post-actions {
  display: flex;
  gap: 10px 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 6px;
}



/* Edit-post image removal checkbox: show an "x" instead of a checkmark */
.remove-image-checkbox{
  -webkit-appearance:none;
  appearance:none;
  width:18px;
  height:18px;
  border:1px solid var(--border);
  border-radius:6px;
  background:rgba(255,255,255,.03);
  display:inline-grid;
  place-items:center;
  cursor:pointer;
  position:relative;
}
.remove-image-checkbox:checked{
  border-color:rgba(255,90,90,.7);
  background:rgba(255,90,90,.15);
}
.remove-image-checkbox:checked::after{
  content:"×";
  font-size:16px;
  line-height:1;
  font-weight:700;
}



/* --- Edit post: image remove checkbox should show "x" instead of tick --- */
.edit-image-item input[type="checkbox"]{
  -webkit-appearance:none;
  appearance:none;
  width:18px;
  height:18px;
  border-radius:6px;
  border:1px solid rgba(255,255,255,0.22);
  background:rgba(0,0,0,0.25);
  display:grid;
  place-items:center;
  cursor:pointer;
  box-shadow:none;
}
.edit-image-item input[type="checkbox"]::after{
  content:"×";
  font-weight:900;
  font-size:14px;
  line-height:1;
  opacity:0;
  transform:scale(0.7);
}
.edit-image-item input[type="checkbox"]:checked{
  border-color:rgba(255,90,107,0.55);
  background:rgba(255,90,107,0.16);
}
.edit-image-item input[type="checkbox"]:checked::after{
  opacity:1;
  transform:scale(1);
}

/* --- Styled file picker (edit post images) --- */
.file-upload{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  margin-top:8px;
}
.file-upload input[type="file"]{
  position:absolute;
  left:-9999px;
  width:1px;
  height:1px;
  opacity:0;
}
.file-upload-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:10px 14px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,0.18);
  background:rgba(255,255,255,0.05);
  color:rgba(255,255,255,0.92);
  font-weight:800;
  letter-spacing:0.2px;
  cursor:pointer;
  user-select:none;
}
.file-upload-btn:hover{
  background:rgba(255,255,255,0.08);
  border-color:rgba(255,255,255,0.25);
}
.file-upload-hint{
  color:rgba(255,255,255,0.65);
  font-size:0.92rem;
}

/* Normalize button/link sizing so Save and Cancel match (create + edit post pages) */
.create-post-actions .btn,
.create-post-actions a.btn,
.create-post-actions button.btn,
.post-form-actions .btn,
.post-form-actions a.btn,
.post-form-actions button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 10px 14px;
  min-height: 38px;
  box-sizing: border-box;
  text-decoration: none;
}

.create-post-actions button.btn,
.post-form-actions button.btn {
  -webkit-appearance: none;
  appearance: none;
}
/* Force subtle variant to keep identical sizing inside actions (override later rules) */
.create-post-actions .btn.subtle,
.post-form-actions .btn.subtle {
  padding: 10px 14px !important;
  min-height: 38px;
  line-height: 1;
  box-sizing: border-box;
}


/* Audit fix: edit-post image remove label must be next to checkbox (not below image) */
.create-post-form .edit-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.create-post-form .edit-image-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.035);
}
.create-post-form .edit-image-remove-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  order: 1;
}
.create-post-form .edit-image-thumb {
  order: 2;
  width: 100%;
}
.create-post-form .edit-image-remove {
  grid-column: auto;
  margin-top: 0;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.1;
}
