/* assets/css/pm-form-components.css */
/* 汎用フォームコンポーネント（複数ページで使用可能） */

/* ============================================
   画像アップロードUI（pm-upload-*）
   ============================================ */
.pm-upload-area {
  width: 100%;
  min-width: 0; /* flex内ではみ出し防止 */
  margin-top: 0.5rem;
  margin-bottom: 0;
  overflow-x: hidden;
}

.pm-upload-zone {
  border: 2px dashed #ced4da;
  border-radius: 8px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #fff;
  min-width: 0;
  box-sizing: border-box;
}

.pm-upload-zone:hover {
  border-color: #ec4899;
  background: #f8f9fa;
}

.pm-upload-zone i {
  font-size: 48px;
  color: #6c757d;
  margin-bottom: 2px;
  display: block;
}

.pm-upload-zone p {
  font-size: 16px;
  color: #333;
  margin-bottom: 5px;
  margin-top: 0;
}

.pm-upload-zone small {
  color: #6c757d;
  font-size: 12px;
  display: block;
}

.pm-upload-file-input {
  display: none;
}

/* ============================================
   サムネイルプレビュー（pm-thumbnail-*）
   ============================================ */
.pm-thumbnail-preview {
  margin-top: 15px;
  text-align: center;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

/* 縦横比そのまま・全体が見えるように縮小（横長でも欠けない） */
.pm-thumbnail-image {
  display: block;
  width: auto !important;
  height: auto !important;
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  object-fit: contain;
  object-position: center;
}

/* pm-upload-area 内の画像・動画：縦横比を保ち、全体が収まるように縮小表示（欠けない） */
.pm-upload-area img,
.pm-upload-area video {
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  object-position: center;
}

/* style.css の .entry-content img 等（max-width: 450px !important 等）を上書き。詳細度＋!important でアップロードプレビューを正しく表示 */
.entry-content .pm-upload-area img,
.entry-content .pm-upload-area video,
.content .pm-upload-area img,
.content .pm-upload-area video {
  max-width: 100% !important;
  width: auto !important;
  height: auto !important;
  display: block !important;
  object-fit: contain !important;
  object-position: center !important;
}

.entry-content .pm-thumbnail-image,
.content .pm-thumbnail-image {
  max-width: 100% !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  object-position: center !important;
}

/* SP時も style.css の calc(100vw - 40px) !important を上書き */
@media (max-width: 768px) {
  .entry-content .pm-upload-area img,
  .entry-content .pm-upload-area video,
  .content .pm-upload-area img,
  .content .pm-upload-area video {
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
  }
  .entry-content .pm-thumbnail-image,
  .content .pm-thumbnail-image {
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
  }
}

.pm-thumbnail-actions {
  margin-top: 10px;
}

.pm-thumbnail-remove-btn {
  background: #ef4444;
  color: #ffffff;
  border: 1px solid #dc2626;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.pm-thumbnail-remove-btn i {
  color: #ffffff;
  font-size: 1rem;
}

.pm-thumbnail-remove-btn span {
  font-size: 0.8rem;
  color: #ffffff;
}

.pm-thumbnail-remove-btn:hover {
  background: #dc2626;
  border-color: #b91c1c;
}

/* ============================================
   汎用フォームページレイアウト（pm-form-page）
   ============================================ */
.pm-form-page {
  max-width: 700px !important;
  margin: 0 auto;
  padding: 2rem 1.75rem;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.06);
}

.pm-form-page .pm-form-section {
  background: #f9fafb;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

/* フォームフィールドラベル */
.pm-form-page .pm-form-field > label:first-child {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  color: #111827;
  margin-bottom: 0.5rem;
}

/* 入力行の薄いボーダー区切り */
.pm-form-page .pm-form-section .pm-form-field {
  padding: 1rem 0;
  border-bottom: 1px solid #e5e7eb;
}

.pm-form-page .pm-form-section .pm-form-field:last-child {
  border-bottom: none;
}

/* ラジオボタン・チェックボックスグループ */
.pm-form-radio-group,
.pm-form-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.pm-form-radio,
.pm-form-checkbox {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
}

/* フォームページタイトル */
.pm-form-title {
  font-size: 1.4rem;
  font-weight: bold;
  margin: 0 0 1.5rem 0;
  color: #1f2937;
}

/* アクションボタンエリア */
.pm-form-actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.pm-form-submit-btn,
.pm-form-preview-btn {
  padding: 0.75rem 1.75rem;
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  font-weight: bold;
  font-size: 0.95rem;
}

.pm-form-submit-btn {
  background: linear-gradient(135deg, #ec4899, #f472b6);
  color: #ffffff;
}

.pm-form-preview-btn {
  background-color: #6b7280;
  color: #ffffff;
}

.pm-form-submit-btn:hover {
  background: linear-gradient(135deg, #db2777, #ec4899);
}

.pm-form-preview-btn:hover {
  background-color: #4b5563;
}

.pm-form-secondary-btn {
  background-color: #6b7280;
  color: #ffffff;
  padding: 0.75rem 1.75rem;
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  font-weight: bold;
  font-size: 0.95rem;
}

.pm-form-secondary-btn:hover {
  background-color: #4b5563;
}

.pm-form-delete-btn {
  background-color: #ef4444;
  color: #ffffff;
  padding: 0.75rem 1.75rem;
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  font-weight: bold;
  font-size: 0.95rem;
}

.pm-form-delete-btn:hover {
  background-color: #dc2626;
}

/* SP表示時のフォームページ */
@media (max-width: 768px) {
  .pm-form-page {
    max-width: 94% !important;
    padding: 1.5rem 1.25rem;
    margin-left: auto;
    margin-right: auto;
  }
}

/* ============================================
   成功メッセージ（purimall-edit-message）
   ============================================ */
.purimall-edit-message {
  background: #d1fae5;
  border: 1px solid #6ee7b7;
  padding: 12px 15px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.purimall-edit-message p {
  margin: 0;
  margin-bottom: 4px;
  color: #065f46;
  font-size: 0.9rem;
}

.purimall-edit-message p:last-child {
  margin-bottom: 0;
}

.purimall-edit-message i {
  margin-right: 8px;
  color: #10b981;
}

/* ============================================
   戻るリンク（pm-form-back-link）
   ============================================ */
.pm-form-back-link {
  margin-bottom: 20px;
  text-align: center;
}

.pm-form-back-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: #6b7280;
  color: #ffffff;
  border-radius: 8px;
  text-decoration: none !important;
  font-weight: 500;
  font-size: 0.9rem;
  transition: background-color 0.2s ease;
}

.pm-form-back-button:hover {
  background: #4b5563;
  color: #ffffff;
  text-decoration: none !important;
}

.pm-form-back-button span {
  text-decoration: none !important;
}

.pm-form-back-button i {
  font-size: 0.9rem;
  color: #ffffff;
}

/* ============================================
   エラーメッセージ（purimall-edit-error）
   ============================================ */
.purimall-edit-error {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  padding: 12px 15px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.purimall-edit-error p {
  margin: 0;
  margin-bottom: 4px;
  color: #991b1b;
  font-size: 0.9rem;
}

.purimall-edit-error p:last-child {
  margin-bottom: 0;
}

.purimall-edit-error i {
  margin-right: 8px;
  color: #dc2626;
}

/* ============================================
   フォーム注釈（pm-form-note）
   ============================================ */
.pm-form-note {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #6b7280;
  font-style: italic;
}

.pm-form-field small {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #6b7280;
}
