/* ==========================================================================
   まなちゃん用レシピ集 - コンポーネントスタイル
   AI常設登録パネル、テキスト主体のかわいいレシピカード、モーダル、ジャンル管理
   ========================================================================== */

/* --------------------------------------------------------------------------
   ★ AI常設レシピ作成パネル (Hero Panel)
   -------------------------------------------------------------------------- */
.ai-hero-panel {
  background: #ffffff;
  border-radius: var(--radius-xl);
  border: 2px solid #f3e8ff;
  box-shadow: 0 10px 30px rgba(139, 92, 246, 0.08);
  padding: 22px 24px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.ai-hero-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #ff6b8b, #a855f7, #3b82f6);
}

.ai-hero-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.ai-hero-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-sparkle {
  font-size: 20px;
  animation: sparkleRotate 2.5s infinite ease-in-out;
}

@keyframes sparkleRotate {

  0%,
  100% {
    transform: scale(1) rotate(0deg);
  }

  50% {
    transform: scale(1.2) rotate(15deg);
  }
}

.ai-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: #f5f3ff;
  color: #7c3aed;
  border: 1px solid #ddd6fe;
}

.ai-hero-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 768px) {
  .ai-hero-body {
    grid-template-columns: 1fr;
  }
}

.hero-drop-box {
  border: 2px dashed #d8b4fe;
  border-radius: var(--radius-lg);
  padding: 18px 14px;
  text-align: center;
  background: #faf5ff;
  cursor: pointer;
  transition: var(--transition);
  min-height: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.hero-drop-box:hover,
.hero-drop-box.dragover {
  border-color: #9333ea;
  background: #f3e8ff;
  transform: translateY(-2px);
}

.hero-textarea {
  height: 100%;
  min-height: 110px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: var(--transition);
}

.hero-textarea:focus {
  background: #ffffff;
  border-color: #a855f7;
  box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.12);
}

.ai-hero-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.hero-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #7c3aed;
}

.spinner-dot {
  width: 16px;
  height: 16px;
  border: 2.5px solid #ddd6fe;
  border-top-color: #7c3aed;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --------------------------------------------------------------------------
   ジャンル（カテゴリ）セクション＆管理
   -------------------------------------------------------------------------- */
.category-section {
  margin-bottom: 24px;
}

.category-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 4px;
}

.category-header-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-secondary);
}

.category-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-cat-action {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  background: #ffffff;
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
}

.btn-cat-action:hover {
  background: #f8fafc;
  color: var(--primary);
  border-color: var(--border-primary);
}

.category-manage-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.cat-manage-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #f8fafc;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.cat-manage-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.cat-manage-count {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.btn-del-cat {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  color: #ef4444;
  background: #fee2e2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: var(--transition);
}

.btn-del-cat:hover {
  background: #fecaca;
  transform: scale(1.1);
}

/* --------------------------------------------------------------------------
   レシピグリッド＆テキスト主体のかわいいレシピカード（写真なし）
   -------------------------------------------------------------------------- */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 20px;
}

.recipe-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1.5px solid #f1ece5;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  padding: 18px 20px;
  position: relative;
  cursor: pointer;
  background-image: radial-gradient(#faf6f0 1px, transparent 1px);
  background-size: 16px 16px;
}

.recipe-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(255, 107, 139, 0.12);
  border-color: #ffd2dc;
  background-color: #ffffff;
}

/* カードトップメタ */
.card-top-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-cat-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 3px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-primary);
}

.card-fav-btn-inline {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: #cbd5e1;
  transition: var(--transition);
  border: 1px solid var(--border-color);
}

.card-fav-btn-inline:hover {
  transform: scale(1.2);
}

.card-fav-btn-inline.active {
  color: #ff4757;
  background: #ffebee;
  border-color: #ffcdd2;
}

/* 料理名 */
.card-title-text {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.4;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 主な材料タグ */
.card-ingredients-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.ing-pill {
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: #f1f5f9;
  color: var(--text-secondary);
}

/* カードフッター */
.card-bottom-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px dashed #f1ece5;
  font-size: 12px;
  color: var(--text-muted);
}

.card-time-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}

.card-photo-indicators {
  display: flex;
  align-items: center;
  gap: 6px;
}

.photo-indicator-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.photo-indicator-tag.ref {
  background: #e0f2fe;
  color: #0284c7;
}

.photo-indicator-tag.my {
  background: #fce7f3;
  color: #db2777;
}

/* 空状態 */
  .empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #ffffff;
    border-radius: var(--radius-xl);
    border: 2px dashed #f0e6dd;
    max-width: 480px;
    margin: 40px auto;
  }

  .empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: floatEmoji 3s ease-in-out infinite;
  }

  @keyframes floatEmoji {

    0%,
    100% {
      transform: translateY(0);
    }

    50% {
      transform: translateY(-8px);
    }
  }

  .empty-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 8px;
  }

  .empty-desc {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
  }

  /* --------------------------------------------------------------------------
   モーダル共通
   -------------------------------------------------------------------------- */
  .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  .modal-card {
    background: #ffffff;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 760px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    border: 1px solid #f1ece5;
    transform: scale(0.94) translateY(12px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
  }

  .modal-overlay.active .modal-card {
    transform: scale(1) translateY(0);
  }

  .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid #f1ece5;
    background: #ffffff;
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .modal-title-area {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .modal-icon {
    font-size: 22px;
  }

  .modal-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main);
  }

  .modal-close-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: #f8fafc;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
  }

  .modal-close-btn:hover {
    background: #f1f5f9;
    color: var(--text-main);
    transform: rotate(90deg);
  }

  .modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
  }

  .modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #f1ece5;
    background: #fdfbf9;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
  }

  /* --------------------------------------------------------------------------
   レシピ詳細ビュー
   -------------------------------------------------------------------------- */
  .detail-header-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
  }

  .detail-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 18px;
    line-height: 1.35;
  }

  /* 写真タブ（元の写真 vs 追加の写真） */
  .photo-gallery-section {
    background: #fbf9f6;
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 24px;
    border: 1px solid #f1ece5;
  }

  .photo-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    border-bottom: 1.5px solid #ece4dc;
    padding-bottom: 10px;
  }

  .photo-tab-btn {
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    background: #ffffff;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
  }

  .photo-tab-btn.active {
    background: #1e293b;
    color: #ffffff;
    border-color: #1e293b;
  }

  .photo-tab-btn.tab-ref.active {
    background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
    border-color: transparent;
    color: #ffffff;
  }

  .photo-tab-btn.tab-my.active {
    background: linear-gradient(135deg, #db2777 0%, #f472b6 100%);
    border-color: transparent;
    color: #ffffff;
  }

  /* 写真スライダー/グリッド */
  .photo-strip {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .photo-item {
    width: 140px;
    height: 140px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-xs);
    border: 1.5px solid #ffffff;
    cursor: pointer;
    background: #ffffff;
    transition: var(--transition);
  }

  .photo-item:hover {
    transform: scale(1.04);
    box-shadow: var(--shadow-md);
  }

  .photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .photo-caption-tag {
    position: absolute;
    bottom: 0;
    inset-inline: 0;
    background: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    font-size: 10px;
    padding: 2px 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
  }

  .no-photo-box {
    padding: 30px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
  }

  /* 材料リスト */
  .section-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
  }

  .ingredients-list {
    background: #ffffff;
    border-radius: var(--radius-md);
    border: 1px solid #f1ece5;
    overflow: hidden;
    margin-bottom: 24px;
  }

  .ingredient-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px dashed #f1ece5;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
  }

  .ingredient-row:last-child {
    border-bottom: none;
  }

  .ingredient-row:hover {
    background: #fffcf9;
  }

  .ingredient-row.checked {
    background: #f8fafc;
    color: var(--text-light);
    text-decoration: line-through;
  }

  .ingredient-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
  }

  .ingredient-check-circle {
    width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    border: 2px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: transparent;
    transition: var(--transition);
  }

  .ingredient-row.checked .ingredient-check-circle {
    background: var(--accent-mint);
    border-color: var(--accent-mint);
    color: #ffffff;
  }

  .ingredient-amount {
    font-weight: 700;
    color: var(--text-secondary);
  }

  /* 作り方ステップ */
  .steps-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 24px;
  }

  .step-row {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 14px 16px;
    background: #ffffff;
    border-radius: var(--radius-md);
    border: 1px solid #f1ece5;
    box-shadow: var(--shadow-xs);
  }

  .step-num {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #ff6b8b 0%, #ff8e53 100%);
    color: #ffffff;
    font-size: 13px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
  }

  .step-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-main);
    flex: 1;
  }

  /* コツ・ポイント（ふせん風） */
  .tips-box {
    background: #fffbeb;
    border: 1.5px solid #fef08a;
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 24px;
    position: relative;
  }

  .tips-box::before {
    content: '💡 コツ・ポイント';
    display: block;
    font-size: 13px;
    font-weight: 800;
    color: #b45309;
    margin-bottom: 6px;
  }

  .tips-text {
    font-size: 13.5px;
    color: #78350f;
    line-height: 1.6;
  }

  /* --------------------------------------------------------------------------
   レシピ作成・編集フォーム
   -------------------------------------------------------------------------- */
  .form-group {
    margin-bottom: 20px;
  }

  .form-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
  }

  .form-label span.req {
    color: var(--primary);
    margin-left: 4px;
  }

  .form-input,
  .form-textarea,
  .form-select {
    width: 100%;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
  }

  .form-input:focus,
  .form-textarea:focus,
  .form-select:focus {
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
  }

  .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  /* 写真アップロードゾーン（元写真 vs 追加写真） */
  .photo-upload-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
  }

  .photo-drop-box {
    border: 2px dashed #e2e8f0;
    border-radius: var(--radius-lg);
    padding: 16px;
    text-align: center;
    background: #fbf9f6;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
  }

  .photo-drop-box:hover,
  .photo-drop-box.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
  }

  .photo-drop-title {
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
  }

  .photo-drop-desc {
    font-size: 11px;
    color: var(--text-muted);
  }

  .uploaded-previews {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 8px;
    margin-top: 12px;
  }

  .preview-thumb {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
  }

  .preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .preview-remove-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    background: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* 動的材料・ステップ行 */
  .dynamic-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
  }

  .btn-del-row {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
  }

  .btn-del-row:hover {
    background: #fee2e2;
    color: #ef4444;
  }

  .btn-add-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-light);
    border: 1px dashed var(--border-primary);
    margin-top: 4px;
  }

  .btn-add-row:hover {
    background: #ffe0e6;
  }

  /* --------------------------------------------------------------------------
   AIお直しチャットパネル
   -------------------------------------------------------------------------- */
  .chat-container {
    display: flex;
    flex-direction: column;
    height: 480px;
    border: 1px solid #f1ece5;
    border-radius: var(--radius-lg);
    background: #ffffff;
    overflow: hidden;
  }

  .chat-header {
    padding: 12px 18px;
    background: linear-gradient(135deg, #fdf4f5 0%, #fef8f0 100%);
    border-bottom: 1px solid #f1ece5;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .chat-chef-info {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .chat-chef-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #ff758c 0%, #ff7eb3 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: var(--shadow-sm);
  }

  .chat-chef-name {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-main);
  }

  .chat-chef-status {
    font-size: 11px;
    color: var(--accent-mint);
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #fbf9f6;
  }

  .chat-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 13.5px;
    line-height: 1.55;
    position: relative;
    word-break: break-word;
  }

  .chat-bubble.ai {
    align-self: flex-start;
    background: #ffffff;
    color: var(--text-main);
    border: 1px solid #f1ece5;
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-xs);
  }

  .chat-bubble.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #ff6b8b 0%, #ff8e53 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: var(--shadow-primary);
  }

  .chat-action-banner {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #f1ece5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .btn-apply-recipe {
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    background: var(--accent-mint);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }

  .btn-apply-recipe:hover {
    filter: brightness(1.1);
  }

  .chat-input-area {
    padding: 12px 16px;
    background: #ffffff;
    border-top: 1px solid #f1ece5;
    display: flex;
    gap: 10px;
  }

  .chat-input {
    flex: 1;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 13px;
    outline: none;
  }

  .chat-input:focus {
    background: #ffffff;
    border-color: var(--primary);
  }

  /* トースト通知 */
  .toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
  }

  .toast {
    padding: 12px 20px;
    border-radius: var(--radius-full);
    background: #1e293b;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    animation: toastSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }

  .toast.success {
    background: #065f46;
  }

  .toast.error {
    background: #991b1b;
  }

  @keyframes toastSlideUp {
    from {
      transform: translateY(20px);
      opacity: 0;
    }

    to {
      transform: translateY(0);
      opacity: 1;
    }
  }

  /* ローディングスピナー */
  .ai-loading-box {
    padding: 40px 20px;
    text-align: center;
  }

  .ai-loading-icon {
    font-size: 48px;
    animation: spinChef 2s infinite ease-in-out;
    display: inline-block;
    margin-bottom: 16px;
  }

  @keyframes spinChef {
    0% {
      transform: rotate(0deg) scale(1);
    }

    50% {
      transform: rotate(180deg) scale(1.15);
    }

    100% {
      transform: rotate(360deg) scale(1);
    }
  }

  .ai-loading-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
  }

  .ai-loading-sub {
    font-size: 12px;
    color: var(--text-muted);
  }

  /* 印刷スタイル */
  @media print {
    body {
      background: #ffffff !important;
    }

    .app-header,
    .control-bar,
    .category-nav-wrapper,
    .app-footer,
    .header-actions,
    .modal-header,
    .modal-footer,
    .modal-close-btn,
    .chat-container {
      display: none !important;
    }

    .modal-overlay {
      position: static;
      background: none;
      backdrop-filter: none;
      padding: 0;
    }

    .modal-card {
      box-shadow: none;
      border: none;
      max-width: 100%;
      max-height: none;
    }
  }

/* --------------------------------------------------------------------------
   ★ メインタブナビゲーション
   -------------------------------------------------------------------------- */
.main-tab-nav {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  border-bottom: 2px solid #f1ece5;
  padding-bottom: 8px;
}

.main-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-xs);
}

.main-tab-btn:hover {
  border-color: var(--primary-light);
  color: var(--primary);
  transform: translateY(-1px);
}

.main-tab-btn.active {
  background: linear-gradient(135deg, #ff758c 0%, #ff7eb3 100%);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(255, 117, 140, 0.35);
}

/* --------------------------------------------------------------------------
   ★ 今週の献立ビュー
   -------------------------------------------------------------------------- */
.weekly-header-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: 14px;
}

.weekly-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}

.weekly-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.weekly-days-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.weekly-day-card {
  background: #ffffff;
  border-radius: var(--radius-xl);
  border: 1px solid #f1ece5;
  box-shadow: var(--shadow-sm);
  padding: 20px;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  transition: var(--transition);
}

.weekly-day-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #ffd6df;
}

@media (max-width: 900px) {
  .weekly-day-card {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

.weekly-day-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.weekly-day-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  padding-bottom: 8px;
  border-bottom: 2px solid #f8fafc;
}

.weekly-recipes-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.weekly-recipe-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #fdfaf7;
  border: 1px solid #f1ece5;
  border-radius: var(--radius-lg);
  gap: 8px;
}

.weekly-recipe-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  flex: 1;
}

.weekly-recipe-name:hover {
  color: var(--primary);
  text-decoration: underline;
}

.btn-remove-weekly-recipe {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: var(--transition);
}

.btn-remove-weekly-recipe:hover {
  background: #fee2e2;
  color: #ef4444;
}

.btn-add-weekly-recipe {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1.5px dashed var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.btn-add-weekly-recipe:hover {
  background: #ffdbe2;
}

/* 曜日の横に並ぶ必要材料リスト */
.weekly-day-right {
  background: #fbf9f6;
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  border: 1px solid #f1ece5;
}

.weekly-ing-header {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.weekly-ing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.weekly-ing-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: #ffffff;
  border-radius: var(--radius-sm);
  border: 1px solid #e2e8f0;
  font-size: 12.5px;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}

.weekly-ing-item:hover {
  border-color: var(--primary);
}

.weekly-ing-item.checked {
  background: #f1f5f9;
  text-decoration: line-through;
  color: #94a3b8;
  border-color: #cbd5e1;
}

.weekly-all-ingredients-box {
  background: #ffffff;
  border-radius: var(--radius-xl);
  border: 2px solid #fed7aa;
  box-shadow: var(--shadow-sm);
  padding: 20px 24px;
  margin-bottom: 24px;
}

.all-ing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1.5px dashed #fed7aa;
}

.all-ing-badge {
  font-size: 12px;
  font-weight: 800;
  color: #c2410c;
  background: #ffedd5;
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

.all-ing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

/* --------------------------------------------------------------------------
   ★ 作った履歴（クッキングログ）
   -------------------------------------------------------------------------- */
.history-header-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.history-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}

.history-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.history-stats-pill {
  padding: 8px 18px;
  background: #fdf2f8;
  color: #db2777;
  border-radius: var(--radius-full);
  font-weight: 800;
  font-size: 14px;
  border: 1.5px solid #fbcfe8;
}

.history-timeline-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-card-item {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid #f1ece5;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
  gap: 16px;
}

.history-card-item:hover {
  box-shadow: var(--shadow-sm);
  border-color: #ffd6df;
  transform: translateX(4px);
}

.history-item-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.history-date-badge {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  background: #f8fafc;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid #e2e8f0;
  white-space: nowrap;
}

.history-item-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  cursor: pointer;
}

.history-item-title:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   ★ 詳細モーダルの機能ボタン・AI一時変更
   -------------------------------------------------------------------------- */
.btn-cook-record {
  background: linear-gradient(135deg, #f97316 0%, #fb923c 100%);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(249, 115, 22, 0.25);
  font-size: 13px;
  padding: 6px 14px;
}

.btn-cook-record:hover {
  filter: brightness(1.08);
}

.cook-history-badge-banner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #c2410c;
  background: #fff7ed;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: 1px solid #fed7aa;
  margin-left: 8px;
}

.ai-temp-banner {
  background: linear-gradient(135deg, #fdf4ff 0%, #fae8ff 100%);
  border: 1.5px solid #d8b4fe;
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ai-temp-banner-text {
  font-size: 13px;
  font-weight: 800;
  color: #7e22ce;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-restore {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: #ffffff;
  color: #7e22ce;
  border: 1px solid #c084fc;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
}

.btn-restore:hover {
  background: #7e22ce;
  color: #ffffff;
}

/* クイックタグ */
.quick-tags-container {
  margin-top: 10px;
}

.quick-instruction-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-tag-btn {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: #f8fafc;
  border: 1px solid var(--border-color);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.quick-tag-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

/* レシピ選択モーダル一覧 */
.select-recipe-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
}

.select-recipe-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid #f1ece5;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.select-recipe-item:hover {
  background: #fdfaf7;
  border-color: var(--primary);
  transform: translateX(4px);
}

/* ジャンル別カラー設定項目 */
.genre-color-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  gap: 10px;
}

.genre-color-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.genre-color-input {
  width: 38px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: none;
}

/* 不要ボタンの表示制御 */
.btn-hide-ing { display: none; }
.organized-check-item.checked .btn-hide-ing, .weekly-ing-item.checked .btn-hide-ing { display: inline-block; }
