/* ========================================
   モーダル（ポップアップ）スタイル
======================================== */

/* モーダルオーバーレイ */
.cook-report-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cook-report-modal-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

/* モーダルコンテナ */
.cook-report-modal {
  background: white;
  border-radius: 12px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.cook-report-modal-overlay.is-active .cook-report-modal {
  transform: scale(1);
}

/* モーダルヘッダー */
.modal-header {
  padding: 25px 30px;
  border-bottom: 2px solid var(--gray-200);
  position: sticky;
  top: 0;
  background: white;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.5rem;
  color: var(--wasabi-dark);
  margin: 0;
  font-family: var(--font-family-heading);
}

/* 閉じるボタン */
.modal-close {
  background: transparent;
  border: none;
  font-size: 2rem;
  color: var(--gray-600);
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background-color: var(--gray-200);
  color: var(--gray-900);
}

.modal-close:focus {
  outline: 3px solid var(--wasabi-main);
  outline-offset: 2px;
}

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

/* モーダル内の写真ギャラリー */
.modal-photos {
  margin-bottom: 30px;
}

.modal-photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.modal-photo-item {
  width: 100%;
  height: 250px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 1枚だけの場合は大きく表示 */
.modal-photo-gallery.single-photo .modal-photo-item {
  height: 400px;
  grid-column: 1 / -1;
}

/* メタ情報 */
.modal-meta {
  display: flex;
  gap: 20px;
  align-items: center;
  padding: 15px 0;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 25px;
}

.modal-date {
  font-size: 1rem;
  color: var(--gray-700);
  font-weight: 500;
}

/* 詳細セクション */
.modal-section {
  margin-bottom: 25px;
}

.modal-section:last-child {
  margin-bottom: 0;
}

.modal-section-title {
  font-size: 1.1rem;
  color: var(--wasabi-dark);
  font-weight: bold;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-section-title::before {
  content: '▶';
  color: var(--wasabi-main);
  font-size: 0.8rem;
}

.modal-section-content {
  padding: 15px;
  background: var(--gray-50);
  border-radius: 6px;
  line-height: 1.8;
  color: var(--gray-800);
}

.modal-section-content:empty::after {
  content: '（記録なし）';
  color: var(--gray-400);
  font-style: italic;
}

/* アクセシビリティ */
.cook-report-modal:focus {
  outline: none;
}

/* スクロールバーのスタイリング（オプション） */
.cook-report-modal::-webkit-scrollbar {
  width: 8px;
}

.cook-report-modal::-webkit-scrollbar-track {
  background: var(--gray-100);
}

.cook-report-modal::-webkit-scrollbar-thumb {
  background: var(--gray-400);
  border-radius: 4px;
}

.cook-report-modal::-webkit-scrollbar-thumb:hover {
  background: var(--gray-600);
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .cook-report-modal-overlay {
    padding: 0;
  }
  
  .cook-report-modal {
    max-height: 100vh;
    border-radius: 0;
    width: 100%;
  }
  
  .modal-header {
    padding: 20px;
  }
  
  .modal-body {
    padding: 20px;
  }
  
  .modal-title {
    font-size: 1.3rem;
  }
  
  .modal-photo-gallery {
    grid-template-columns: 1fr;
  }
  
  .modal-photo-item {
    height: 200px;
  }
  
  .modal-photo-gallery.single-photo .modal-photo-item {
    height: 300px;
  }
}

/* アニメーション */
@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* body固定（モーダル表示中のスクロール防止） */
body.modal-open {
  overflow: hidden;
}
