/* ========================================
   EK Management - Modal CSS
   モーダルとフォームの共通スタイル
   
   @version v1.0.0
   @updated 2025-10-25
   ======================================== */

/* ========================================
   1. モーダル基本構造
   ======================================== */

.modal {
  position: fixed;
  top: 0; 
  left: 0; 
  right: 0; 
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.modal-overlay {
  position: fixed;
  top: 0; 
  left: 0; 
  right: 0; 
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* モバイルでの背景スクロール防止 */
body.modal-open {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
  height: 100% !important;
}

.modal-overlay.is-open,
.modal-overlay.show {
  display: flex;
}

.modal-content {
  background: #fff;
  border-radius: 8px;
  box-sizing: border-box;
  position: relative;
  width: 70%;
  max-width: 600px;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  margin: 1% auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: 10001; /* モーダルオーバーレイより上 */
}

/* モーダルサイズバリエーション */
.modal-content.modal-small {
  max-width: 450px !important;
  width: 90% !important;
  padding: 0 !important;
  overflow: hidden;
}

.modal-content.modal-medium {
  max-width: 600px;
  width: 85%;
  padding: 0;
  overflow: hidden;
}

.modal-content.modal-large {
  max-width: 900px;
  width: 90%;
  padding: 0;
  overflow: hidden;
}

/* 大モーダルのヘッダー */
.modal-large .modal-header {
  padding: 20px 30px 15px 30px;
  border-bottom: 2px solid var(--unit-color);
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  position: relative;
}

.modal-large .modal-header h3 {
  font-size: 1.3em;
  margin: 0;
  color: var(--unit-color);
  padding-right: 35px;
}

/* 大モーダルの閉じるボタン */
.modal-large .modal-close {
  position: absolute;
  top: 18px;
  right: 30px;
  z-index: 1;
}

/* 大モーダルのボディ */
.modal-large .modal-body {
  padding: 20px 30px;
}

.modal-large .modal-search {
  margin-bottom: 15px;
}

.modal-large .modal-search input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  font-size: 14px;
  box-sizing: border-box;
}

.modal-large .modal-search input:focus {
  outline: none;
  border-color: var(--unit-color);
}

.modal-large .modal-list {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 10px;
  background: #f8f9fa;
}

/* 大モーダルのフッター */
.modal-large .modal-footer {
  padding: 15px 30px 20px 30px;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
  display: flex;
  justify-content: flex-end;
}

/* 小モーダルのヘッダー */
.modal-small .modal-header {
  padding: 18px 25px 12px 25px;
  border-bottom: 2px solid var(--unit-color);
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  position: relative;
}

.modal-small .modal-header h3 {
  font-size: 1.15em;
  margin: 0;
  color: var(--unit-color);
  padding-right: 30px;
}

/* 小モーダルの閉じるボタン */
.modal-small .modal-close {
  position: absolute;
  top: 18px;
  right: 25px;
  z-index: 1;
}

/* 小モーダルのボディ */
.modal-small .modal-body {
  padding: 20px 25px;
}

.modal-small .modal-body form {
  margin: 0;
  padding: 0;
}

.modal-small .form-group {
  margin-bottom: 12px;
}

.modal-small .form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
  color: #333;
}

.modal-small .form-group input,
.modal-small .form-group select,
.modal-small .form-group textarea {
  width: 100%;
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  box-sizing: border-box;
}

.modal-small .form-group input:focus,
.modal-small .form-group select:focus,
.modal-small .form-group textarea:focus {
  outline: none;
  border-color: var(--unit-color);
  box-shadow: 0 0 0 3px rgba(var(--unit-color-rgb), 0.1);
}

/* 小モーダルのフッター */
.modal-small .modal-footer {
  margin: 0;
  padding: 15px 25px 20px 25px;
  border-top: 1px solid #e9ecef;
  background: #f8f9fa;
}

.modal-small .modal-footer .button-row {
  gap: 8px;
  margin: 0;
}

/* ========================================
   1-2. モーダル用ボタングループ
   ======================================== */

/* ボタングループ */
.btn-group {
  display: flex;
  gap: 5px;
  align-items: center;
}

.btn-group .btn {
  padding: 6px 12px;
  font-size: 14px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  border-radius: 4px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-success {
  background-color: #28a745;
  color: white;
}

.btn-success:hover {
  background-color: #218838;
}

.btn-warning {
  background-color: #ffc107;
  color: #333;
}

.btn-warning:hover {
  background-color: #e0a800;
}

.btn-primary {
  background-color: var(--unit-color, #007bff);
  color: white;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-secondary {
  background-color: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background-color: #5a6268;
}

/* モバイルカード用ボタンスタイル */
.unit-mobile-cards .unit-member-card-actions .btn-small,
.unit-mobile-cards .unit-member-card-actions .btn.btn-small {
  background-color: #28a745;
  color: white;
}

.unit-mobile-cards .unit-member-card-actions .btn-medium,
.unit-mobile-cards .unit-member-card-actions .btn.btn-medium {
  background-color: #ffc107;
  color: #333;
}

.unit-mobile-cards .unit-member-card-actions .btn-detail,
.unit-mobile-cards .unit-member-card-actions .btn.btn-detail {
  background-color: var(--unit-color, #007bff);
  color: white;
}

/* ========================================
   1-3. 編集フォーム用アクションボタン
   ======================================== */

.button-row {
  display: flex !important;
  gap: 15px !important;
  justify-content: center !important;
  width: 100%;
}

.button-row .btn {
  padding: 12px 24px !important;
  border: none !important;
  border-radius: 4px !important;
  cursor: pointer !important;
  font-size: 14px !important;
  font-weight: bold !important;
  text-decoration: none !important;
  display: inline-block !important;
  margin: 0 !important; /* button.cssの margin: 0 auto を上書き */
  box-sizing: border-box !important;
  line-height: 1.5 !important;
  transition: background-color 0.2s !important;
  white-space: nowrap !important; /* テキストを折り返さない */
}

.button-row .btn.btn-cancel,
.button-row .btn.btn-save {
  flex: 1 1 0 !important;
  min-width: 120px !important;
  max-width: 200px !important;
}

.button-row .btn.btn-delete {
  max-width: 150px;
  min-width: 100px;
}

/* 小型モーダル内のボタン */
.modal-small .button-row {
  max-width: 90%; /* 小型モーダル内は90%幅 */
  margin: 0 auto;
}

.modal-small .button-row .btn {
  min-width: 0 !important;
  max-width: none !important;
  flex: 1 1 0;
  padding: 10px 12px !important; /* 小型モーダルは少し小さめ */
  font-size: 13px !important;
}

.button-row .btn-save {
  background-color: var(--unit-color);
  color: white;
}

.button-row .btn-save:hover {
  opacity: 0.9;
}

.button-row .btn-cancel {
  background-color: #6c757d !important;
  color: white !important;
}

.button-row .btn-cancel:hover {
  background-color: #545b62 !important;
}

.btn-delete {
  background-color: #dc3545;
  color: white;
}

.btn-delete:hover {
  background-color: #c82333;
}

/* ========================================
   2. モーダルヘッダー
   ======================================== */

.modal-header {
  padding: 20px;
  border-bottom: 1px solid #ddd;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #f8f9fa;
  border-radius: 8px 8px 0 0;
}

.modal-header h3 {
  margin: 0;
  color: #333;
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  color: #aaa;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  background: none;
  border: none;
  line-height: 1;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: #000;
}

/* ========================================
   3. モーダルボディ・フッター
   ======================================== */

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 20px;
  border-top: 1px solid #ddd;
  text-align: center;
  background-color: #f8f9fa;
  border-radius: 0 0 8px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

/* モーダルフッター内のbutton-row */
.modal-footer .button-row {
  display: flex !important;
  gap: 15px !important;
  justify-content: center !important;
  width: 100%;
}

/* ========================================
   4. フォーム基本スタイル
   ======================================== */

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  color: #333;
  font-size: 14px;
}

.modal .form-group input,
.modal .form-group text,
.modal .form-group select,
.modal .form-group textarea {
  width: 100% !important;
  padding: 12px 16px 12px 12px !important;
  border: 1px solid #ddd !important;
  border-radius: 6px !important;
  font-size: 14px !important;
  transition: all 0.2s ease !important;
  box-sizing: border-box !important;
  margin-top: 0 !important;
  background-color: #fff !important;
}

.modal .form-group input:focus,
.modal .form-group select:focus,
.modal .form-group textarea:focus {
  outline: none !important;
  border-color: #007bff !important;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25) !important;
}

/* 特殊な入力タイプは基本スタイルを継承 */

.modal .form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.modal .form-group input[type="checkbox"],
.modal .form-group input[type="radio"] {
  width: auto !important;
  margin-right: 8px;
  margin-top: 0;
}

/* ========================================
   5. フォームバリデーション
   ======================================== */

.modal .form-group .error-message {
  color: #dc3545;
  font-size: 12px;
  margin-top: 4px;
  display: none;
}

.modal .form-group.has-error .error-message {
  display: block;
}

.modal .form-group.has-error input,
.modal .form-group.has-error select,
.modal .form-group.has-error textarea {
  border-color: #dc3545 !important;
}

.modal .form-group.required label::after {
  content: " *";
  color: #dc3545;
}

/* ========================================
   6. フォームレイアウト
   ======================================== */

.form-row {
  display: flex;
  gap: 15px;
  margin-bottom: 15px;
}

.form-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

.search-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

.search-group label {
  margin-bottom: 0;
  white-space: nowrap;
}

.search-group input,
.search-group select {
  flex: 1;
  margin-bottom: 0;
}

.form-help {
  font-size: 12px;
  color: #6c757d;
  margin-top: 4px;
}

/* ========================================
   6.5. 検索結果スタイル
   ======================================== */

.search-result-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.search-result-item:hover {
  background-color: #f8f9fa;
}

.search-result-item:last-child {
  border-bottom: none;
}

/* キーボード選択時のスタイル */
.search-result-item.keyboard-selected {
  background-color: #94aac2 !important;
  color: #fff !important;
}

/* 検索結果なしメッセージ */
.search-no-results {
  padding: 8px 12px;
  color: #666;
  text-align: center;
}

/* ========================================
   7. フォームセクション
   ======================================== */

.form-section {
  margin-bottom: 30px;
  padding: 20px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background-color: #f9f9f9;
}

.form-section h5 {
  margin: 0 0 20px 0;
  color: #333;
  font-size: 16px;
  font-weight: 600;
  border-bottom: 2px solid #007bff;
  padding-bottom: 8px;
}

/* セクションのバリエーション */
.form-section.primary {
  border-color: #007bff;
  background-color: #f8f9ff;
}

.form-section.success {
  border-color: #28a745;
  background-color: #f8fff9;
}

.form-section.warning {
  border-color: #ffc107;
  background-color: #fffdf8;
}

.form-section.danger {
  border-color: #dc3545;
  background-color: #fff8f8;
}

/* ========================================
   8. ボタンスタイル
   ======================================== */

/* .btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  margin-left: 5px;
  text-decoration: none;
  display: inline-block;
  transition: all 0.2s ease;
  font-weight: 500;
} */

.btn-primary {
  background-color: #007bff;
  color: white;
}

.btn-primary:hover {
  background-color: #0056b3;
}

.btn-success {
  background-color: #28a745;
  color: white;
}

.btn-success:hover {
  background-color: #1e7e34;
}

.btn-secondary {
  background-color: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background-color: #545b62;
}

.btn-outline-success {
  background-color: transparent;
  color: #28a745;
  border: 1px solid #28a745;
}

.btn-outline-success:hover {
  background-color: #28a745;
  color: white;
}

.btn-danger {
  background-color: #dc3545;
  color: white;
}

.btn-danger:hover {
  background-color: #c82333;
}

.btn-warning {
  background-color: #ffc107;
  color: #212529;
}

.btn-warning:hover {
  background-color: #e0a800;
}

.btn-info {
  background-color: #17a2b8;
  color: white;
}

.btn-info:hover {
  background-color: #138496;
}

/* ========================================
   9. フォームフッター
   ======================================== */

/* ========================================
   10. 特殊モーダル（画像表示など）
   ======================================== */

#image-modal img {
  max-width: 90%;
  max-height: 90%;
  box-shadow: 0 2px 16px rgba(0,0,0,0.5);
  border-radius: 8px;
  background: #fff;
  padding: 4px;
}

.modal-content button.btn.btn-delete {
  background-color: #f5f5f5;
  border: 1px solid #ccc;
  padding: 0.5rem 1rem;
  font-size: 14px;
  border-radius: 4px;
  color: #333;
  cursor: pointer;
  margin-right: 12px;
  align-self: flex-end;
}

button.btn.btn-delete:hover {
  background-color: #eee;
}

.modal-content .button-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 32px;
}

.modal-content .button-footer button {
  min-width: 80px;
}

.modal-content .button-footer .btn-delete {
  background-color: #f5f5f5;
  border: 1px solid #ccc;
  color: #333;
}

.modal-content .button-footer .btn-delete:hover {
  background-color: #eee;
}

/* ========================================
   11. 共通ユーティリティクラス
   ======================================== */

.avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #ddd;
  transition: all 0.3s ease;
  object-fit: cover;
}

.avatar-placeholder {
  width: 50px;
  height: 50px;
  background-color: #f0f0f0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 12px;
  border: 2px solid #ddd;
  cursor: pointer;
  transition: all 0.3s ease;
}

.card {
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  padding: 20px;
  background-color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
}

.result-item {
  padding: 12px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* ========================================
   12. レスポンシブ対応
   ======================================== */

@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    margin: 2% auto;
    max-height: calc(100vh - 20px);
  }
  
  /* モバイル時のサイズバリエーション */
  .modal-content.modal-small {
    width: 90% !important;
    max-width: 400px !important;
  }
  
  .modal-content.modal-medium,
  .modal-content.modal-large {
    width: 95% !important;
    max-width: none !important;
  }
  
  /* ボタン行のモバイル対応 */
  .button-row {
    gap: 10px;
    width: 100%;
    max-width: 100%;
  }
  
  .button-row .btn.btn-cancel,
  .button-row .btn.btn-save {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
  }
  
  .button-row .btn.btn-delete {
    width: auto;
    max-width: 300px;
    min-width: 150px;
  }
  
  /* 小型モーダルのボタンをモバイルで調整 */
  .modal-small .button-row .btn {
    min-width: 0;
    max-width: none;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .form-row .form-group {
    margin-bottom: 15px;
  }

  .search-group {
    flex-direction: column;
    align-items: stretch;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 15px;
  }
}

@media (max-width: 480px) {
  .modal-content {
    width: 98%;
    margin: 1% auto;
  }

  .modal-header h3 {
    font-size: 16px;
  }

  .form-section {
    padding: 15px;
  }
}

/* ========================================
   13. マーク追加モーダル専用スタイル
   ======================================== */

/* マークセクションのヘッダー */
.mark-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.mark-section-header .section-title {
  margin-bottom: 0;
}

/* 新規マーク追加ボタン */

  button.btn.btn-add-mark {
    margin: 0;
  transition: filter 0.3s ease;
}


.btn-add-mark:hover {
  filter: brightness(0.85);
}

/* マークモーダル */
#mark-modal.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}

#mark-modal .modal-content {
  background: white;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  position: relative;
}

#mark-modal .modal-close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 28px;
  font-weight: bold;
  color: #aaa;
  cursor: pointer;
  transition: color 0.3s;
}

#mark-modal .modal-close:hover {
  color: #000;
}

#mark-modal h3 {
  margin-top: 0;
}

#mark-modal form {
  display: flex;
  flex-direction: column;
  
}

#mark-modal form > div label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}

#mark-modal form > div label span {
  color: red;
}

#mark-modal form input[type="text"],
#mark-modal form input[type="number"],
#mark-modal form select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 14px;
}

/* カラーピッカーのコンテナ */
.color-picker-container {
  display: flex;
  
}

.color-picker-container label {
  width: 17%;
}

.color-picker-container input[type="color"] {
  width: 58%;
  height: 40px;
  cursor: pointer;
  border: 1px solid #ddd;
  border-radius: 5px;
}

/* 旧スタイル（後方互換性のため保持） */

#mark-modal .button-group {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

#mark-modal .button-group button {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s;
}

#mark-modal .button-group .btn-cancel {
  background-color: #6c757d;
  color: white;
}

#mark-modal .button-group .btn-cancel:hover {
  background-color: #5a6268;
}

#mark-modal .button-group .btn-save {
  background-color: #28a745;
  color: white;
}

#mark-modal .button-group .btn-save:hover {
  background-color: #218838;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .mark-section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .btn-add-mark {
    width: 100%;
  }

  #mark-modal .modal-content {
    width: 95%;
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .mark-section-header .section-title {
    font-size: 16px;
  }

  .btn-add-mark {
    font-size: 13px;
    padding: 0.4rem 0.8rem;
  }

  #mark-modal .modal-content {
    width: 98%;
    padding: 15px;
  }

  #mark-modal h3 {
    font-size: 18px;
  }

  #mark-modal form input[type="text"],
  #mark-modal form input[type="number"],
  #mark-modal form select {
    font-size: 16px;
  }
}

/* ========================================
   14. 画像モーダル専用
   ======================================== */

/* 画像モーダルオーバーレイ */
#image-modal.modal-overlay {
  background: rgba(0, 0, 0, 0.9) !important;
  z-index: 10000 !important;
}

#image-modal.modal-overlay.is-open {
  display: flex !important;
}

/* 画像モーダルコンテンツ */
#image-modal .modal-content {
  max-width: 600px !important;
  max-height: 80vh !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
  width: 90% !important;
}

/* 画像モーダルヘッダー */
#image-modal .modal-header {
  background: rgba(0, 0, 0, 0.8) !important;
  border-radius: 8px 8px 0 0 !important;
  padding: 15px 20px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

#image-modal .modal-header h3 {
  color: white !important;
  margin: 0 !important;
  font-size: 18px !important;
  font-weight: 500 !important;
}

#image-modal .modal-close {
  color: white !important;
  font-size: 32px !important;
  line-height: 1 !important;
  opacity: 0.8;
  transition: opacity 0.2s;
}

#image-modal .modal-close:hover {
  opacity: 1 !important;
  color: white !important;
}

/* 画像モーダルボディ */
#image-modal .modal-body {
  background: rgba(0, 0, 0, 0.9) !important;
  text-align: center !important;
  padding: 20px !important;
  border-radius: 0 0 8px 8px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 300px !important;
}

/* 画像表示 */
#image-modal .modal-body img {
  max-width: 100% !important;
  max-height: 60vh !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  border-radius: 4px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
}

/* モバイル対応 */
@media screen and (max-width: 768px) {
  #image-modal .modal-content {
    max-width: 95vw;
    max-height: 85vh;
    width: 95%;
  }
  
  #image-modal .modal-header {
    padding: 12px 15px;
  }
  
  #image-modal .modal-header h3 {
    font-size: 16px;
  }
  
  #image-modal .modal-close {
    font-size: 28px;
  }
  
  #image-modal .modal-body {
    padding: 15px;
  }
  
  #image-modal .modal-body img {
    max-height: 55vh;
  }
}

/* ========================================
   15. マークモーダル専用スタイル
   ======================================== */

#mark-modal .modal-content,
#edit-modal .modal-content {
  padding: 0 !important;
}

/* ========================================
   16. カラーピッカー（標準）
   ======================================== */

.color-picker-wrapper {
  position: relative;
  display: inline-block;
}

.color-preview {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  border: 2px solid #ddd;
  display: inline-block;
  margin-left: 10px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.color-preview:hover {
  border-color: #007bff;
}

.color-picker {
  position: absolute;
  top: 45px;
  left: 0;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.15);
  z-index: 1001;
  min-width: 200px;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.color-option {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
  position: relative;
}

.color-option:hover {
  border-color: #333;
  transform: scale(1.1);
}

.color-option.selected {
  border-color: #007bff;
  border-width: 3px;
  transform: scale(1.1);
}

.color-option.selected::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* ========================================
   17. アイコン選択（標準）
   ======================================== */

.icon-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.icon-option {
  width: 40px;
  height: 40px;
  border: 2px solid #ddd;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.2s;
}

.icon-option:hover {
  border-color: #007bff;
  background: #f8f9fa;
}

.icon-option.selected {
  border-color: #007bff;
  background: #e3f2fd;
}

/* ========================================
   18. モーダルオープン時のbody制御
   ======================================== */

.modal-open {
  overflow: hidden;
}

/* ========================================
   19. 全色対応カラーピッカー
   ======================================== */

.color-picker-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 5px;
}

.color-input {
  /* HTML5カラーピッカーを非表示（機能は保持） */
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.color-preview {
  width: 40px;
  height: 40px;
  border: 2px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: white;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.color-preview:hover {
  border-color: #007bff;
  transform: scale(1.05);
}

.color-preview:active {
  transform: scale(0.95);
}

/* カラーピッカーラベル */
.color-picker-wrapper label {
  font-weight: 500;
  color: #333;
  margin-bottom: 5px;
  display: block;
}

/* モバイル対応 */
@media (max-width: 768px) {
  .color-picker-wrapper {
    width: 100%;
  }
  

}

     