/* Styles for <rk-card-edit-modal> — shared by is-back/card-edit and is-back/card-gallery.
   All rules are scoped under the element and use an "rk-cem-" prefix so the component
   is safe to drop onto any page regardless of that page's own class names. */

rk-card-edit-modal .rk-cem-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .7);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px; box-sizing: border-box;
}
rk-card-edit-modal .rk-cem-backdrop.hidden { display: none; }
rk-card-edit-modal .rk-cem-box {
  background: #161b22; border: 1px solid #30363d; border-radius: 12px;
  padding: 28px 32px; width: 100%; max-width: 640px; max-height: 90vh;
  overflow-y: auto; font-family: inherit;
}
rk-card-edit-modal .rk-cem-title { margin: 0 0 20px; color: #f0f6fc; font-size: 18px; }

rk-card-edit-modal .rk-cem-field { margin-bottom: 16px; }
rk-card-edit-modal .rk-cem-field label { display: block; font-size: 13px; color: #8b949e; margin-bottom: 5px; }
rk-card-edit-modal .rk-cem-field input,
rk-card-edit-modal .rk-cem-field select {
  width: 100%; background: #0d1117; border: 1px solid #30363d; border-radius: 6px;
  padding: 9px 12px; color: #e6edf3; font-size: 14px; box-sizing: border-box;
  transition: border-color .15s;
}
rk-card-edit-modal .rk-cem-field input:focus,
rk-card-edit-modal .rk-cem-field select:focus { outline: none; border-color: #58a6ff; }
rk-card-edit-modal .rk-cem-hint { font-size: 12px; color: #8b949e; margin-top: 4px; }

rk-card-edit-modal .rk-cem-field-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
rk-card-edit-modal .rk-cem-field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

rk-card-edit-modal .rk-cem-error {
  background: #2d1b1b; border: 1px solid #f85149; color: #f85149; border-radius: 6px;
  padding: 8px 12px; font-size: 13px; margin-bottom: 14px; display: none;
}
rk-card-edit-modal .rk-cem-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
/* Share (and Erase Images when shown) on the left, Cancel + Save on the right */
rk-card-edit-modal .rk-cem-share,
rk-card-edit-modal .rk-cem-erase { margin-right: auto; }
rk-card-edit-modal .rk-cem-share:has(+ .rk-cem-erase:not([style*="none"])) { margin-right: 0; }

rk-card-edit-modal .rk-cem-art-section { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
rk-card-edit-modal .rk-cem-art-pane { background: #0d1117; border: 1px solid #30363d; border-radius: 8px; padding: 12px; }
rk-card-edit-modal .rk-cem-art-pane h4 { margin: 0 0 10px; font-size: 13px; color: #8b949e; font-weight: 600; }
rk-card-edit-modal .rk-cem-art-preview,
rk-card-edit-modal .rk-cem-image-preview {
  aspect-ratio: 1086/1512; border-radius: 6px; overflow: hidden; background: #161b22;
  border: 1px solid #30363d; margin-bottom: 10px; display: flex; align-items: center; justify-content: center;
}
rk-card-edit-modal .rk-cem-art-preview img,
rk-card-edit-modal .rk-cem-image-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
rk-card-edit-modal .rk-cem-no-img { color: #555; font-size: 12px; }
rk-card-edit-modal .rk-cem-art-pane input[type="file"] { width: 100%; font-size: 12px; color: #8b949e; margin-bottom: 8px; }

rk-card-edit-modal .rk-cem-btn {
  border-radius: 6px; padding: 8px 16px; font-size: 14px; font-weight: 600;
  cursor: pointer; border: 1px solid; transition: background .15s; font-family: inherit;
}
rk-card-edit-modal .rk-cem-btn-green { background: #238636; color: #fff; border-color: #2ea043; }
rk-card-edit-modal .rk-cem-btn-green:hover { background: #2ea043; }
rk-card-edit-modal .rk-cem-btn-ghost { background: transparent; color: #8b949e; border-color: #30363d; }
rk-card-edit-modal .rk-cem-btn-ghost:hover { background: #21262d; color: #e6edf3; }
rk-card-edit-modal .rk-cem-btn:disabled { opacity: .45; cursor: not-allowed; }

rk-card-edit-modal .rk-cem-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #21262d; border: 1px solid #30363d; color: #e6edf3; border-radius: 8px;
  padding: 10px 20px; font-size: 14px; z-index: 200; display: none;
  max-width: min(90vw, 560px); word-wrap: break-word; font-family: inherit;
}
rk-card-edit-modal .rk-cem-toast.ok   { border-color: #2ea043; color: #3fb950; }
rk-card-edit-modal .rk-cem-toast.err  { border-color: #f85149; color: #f85149; }
rk-card-edit-modal .rk-cem-toast.busy { border-color: #58a6ff; color: #e6edf3; }

rk-card-edit-modal .rk-cem-toast-spinner {
  display: inline-block;
  width: 0.9rem; height: 0.9rem;
  margin-right: 0.5rem;
  vertical-align: -0.15em;
  border: 2px solid rgba(230,237,243,0.35);
  border-top-color: #e6edf3;
  border-radius: 50%;
  animation: rk-cem-toast-spin 0.8s linear infinite;
}
@keyframes rk-cem-toast-spin { to { transform: rotate(360deg); } }

@media (max-width: 560px) {
  rk-card-edit-modal .rk-cem-art-section { grid-template-columns: 1fr; }
  rk-card-edit-modal .rk-cem-field-row,
  rk-card-edit-modal .rk-cem-field-row-3 { grid-template-columns: 1fr; }
}
rk-card-edit-modal .rk-cem-btn-danger { background: transparent; color: #f85149; border-color: #6e3630; }
rk-card-edit-modal .rk-cem-btn-danger:hover { background: #3d1d1c; color: #ff7b72; }
