/* ============================================================
   ai-kasegu-lab UI修正CSS v2
   ============================================================ */

/* セクションタイトルの文字色を強制 */
.entry-title,
h1, h2, h3, h4, h5, h6,
.wp-block-heading,
[class*="section-title"],
[class*="widget-title"] {
  color: inherit !important;
}

/* 白背景コンテナ内のテキスト色補正 */
.has-white-background-color p,
.has-white-background-color li,
.has-white-background-color span,
.has-white-background-color h1,
.has-white-background-color h2,
.has-white-background-color h3,
.has-white-background-color a {
  color: #1F2937 !important;
}

/* text-gray系の薄すぎる文字を補正 */
.text-gray-300,
.text-gray-400,
.text-gray-500 {
  --tw-text-opacity: 1;
  color: rgb(71 85 105 / var(--tw-text-opacity)) !important;
}

/* コードブロック */
pre, code, .wp-block-code {
  background-color: #1e1e2e !important;
  color: #cdd6f4 !important;
  font-family: 'SFMono-Regular', 'Consolas', monospace !important;
  font-size: 14px !important;
  line-height: 1.75 !important;
  padding: 20px 24px !important;
  border-radius: 10px !important;
  border-left: 4px solid #89b4fa !important;
  overflow-x: auto !important;
}

/* インラインコード */
p code, li code, td code {
  background-color: #313244 !important;
  color: #cba6f7 !important;
  padding: 2px 8px !important;
  border-radius: 4px !important;
  font-size: 0.9em !important;
}

/* テーブル */
.entry-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.7;
}
.entry-content table th {
  background-color: #1e3a8a;
  color: #ffffff;
  padding: 10px 14px;
  text-align: left;
}
.entry-content table td {
  padding: 10px 14px;
  border-bottom: 1px solid #e5e7eb;
  color: #1f2937;
}
.entry-content table tr:nth-child(even) td {
  background-color: #f8faff;
}

/* モバイルタップ領域 */
.wp-block-button__link,
button,
.btn,
[class*="cta-btn"] {
  min-height: 44px;
  min-width: 44px;
}

/* リンク色 */
.entry-content a:not(.wp-block-button__link) {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.menu-item-free-guide a,
a.menu-item-free-guide {
  background: #0D9488;
  color: #fff !important;
  padding: 6px 14px;
  border-radius: 6px;
}

/* ============================================================
   追加修正：ボタン文字色を白に統一
   ============================================================ */
.wp-block-button__link,
.btn,
a.btn,
button,
[class*="button"],
[class*="btn"],
[style*="background-color: #"] a,
.kb-btns-wrap a,
.kt-button {
  color: #ffffff !important;
  text-decoration: none !important;
}

/* 青系ボタン */
[style*="background-color: #0000"],
[style*="background-color: #1D4E"],
[style*="background-color: #2563"],
[style*="background-color: #3B82"],
[style*="background:#1D4E"],
[style*="background: #1D4E"],
[style*="background:#2563"],
[style*="background: #2563"],
[style*="background:#3B82"],
[style*="background: #3B82"],
.has-vivid-cyan-blue-background-color,
.has-vivid-blue-background-color {
  color: #ffffff !important;
}

/* 黄・オレンジ系ボタン */
[style*="background-color: #FF"],
[style*="background-color: #F59"],
[style*="background-color: #EAB"],
[style*="background-color: #D97"],
[style*="background:#FF"],
[style*="background: #FF"],
[style*="background:#F59"],
[style*="background: #F59"],
[style*="background:#EAB"],
[style*="background: #EAB"],
[style*="background:#D97"],
[style*="background: #D97"],
.has-vivid-yellow-background-color,
.has-luminous-vivid-amber-background-color {
  color: #ffffff !important;
}

/* ティール・グリーン系ボタン */
[style*="background-color: #0D9488"],
[style*="background-color: #14B8A6"],
[style*="background:#0D9488"],
[style*="background: #0D9488"],
[style*="background:#14B8A6"],
[style*="background: #14B8A6"] {
  color: #ffffff !important;
}

/* 記事内のインラインstyleで作られたCTAリンクは全て白文字 */
.entry-content a[style*="background"],
.entry-content a[style*="background"] *,
article a[style*="background"],
article a[style*="background"] * {
  color: #ffffff !important;
  text-decoration: none !important;
}

/* ============================================================
   追加修正：白背景セクションの可視性確保
   ============================================================ */
section[style*="background-color: #fff"] *,
section[style*="background-color: white"] *,
.has-white-background-color *,
.bg-white * {
  color: #1F2937 !important;
}

/* セクションタイトルが消える問題への保険 */
.wp-block-heading,
h1, h2, h3, h4 {
  color: inherit !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* ============================================================
   追加修正①：コードブロック・プロンプト（強化版）
   ============================================================ */
pre, .wp-block-code, code {
  background-color: #1e1e2e !important;
  color: #cdd6f4 !important;
  font-family: 'SFMono-Regular', 'Consolas', monospace !important;
  font-size: 14px !important;
  line-height: 1.75 !important;
  padding: 20px 24px !important;
  border-radius: 10px !important;
  border-left: 4px solid #0D9488 !important;
  overflow-x: auto !important;
  position: relative !important;
}

/* テーブル内のプロンプトは小さめに */
td pre, td code {
  font-size: 12px !important;
  padding: 8px 12px !important;
}

/* コピーボタン（mu-pluginで挿入される .copy-btn の見た目補強） */
.copy-btn {
  position: absolute !important;
  top: 8px !important;
  right: 8px !important;
  background: #0D9488 !important;
  color: #ffffff !important;
  border: none !important;
  padding: 4px 10px !important;
  border-radius: 4px !important;
  cursor: pointer !important;
  font-size: 12px !important;
  line-height: 1.4 !important;
  z-index: 2 !important;
}
.copy-btn:hover {
  background: #0f766e !important;
}

/* ============================================================
   追加修正②：白背景に白・薄い文字を完全禁止
   ============================================================ */
.has-white-background-color,
.has-very-light-gray-background-color,
[style*="background-color:#fff"],
[style*="background-color: #fff"],
[style*="background-color:#ffffff"],
[style*="background-color: #ffffff"],
[style*="background-color: white"],
.bg-white,
.kb-row-layout-wrap[style*="background-color:#f"],
section[style*="background:#f"] {
  color: #1F2937 !important;
}

.has-white-background-color *,
.has-very-light-gray-background-color *,
[style*="background-color:#fff"] *,
[style*="background-color: #fff"] *,
[style*="background-color:#ffffff"] *,
[style*="background-color: #ffffff"] * {
  color: #1F2937 !important;
}

/* 薄いグレー文字の調整
   - デフォルト（ダーク背景想定）では #94A3B8 で可読性確保
   - 白背景では後段のルールで #1F2937 等に強制される
*/
.text-gray-100, .text-gray-200, .text-gray-300 {
  color: #94A3B8 !important;
}
.text-gray-400, .text-gray-500 {
  color: #94A3B8 !important;
}
.text-gray-600, .text-gray-700 {
  color: #CBD5E1 !important;
}

/* 白背景内の text-gray-* は従来どおり濃い色で可読性確保 */
.has-white-background-color .text-gray-100,
.has-white-background-color .text-gray-200,
.has-white-background-color .text-gray-300,
.has-white-background-color .text-gray-400,
.has-white-background-color .text-gray-500,
[style*="background-color: #fff"] .text-gray-500,
[style*="background-color:#fff"] .text-gray-500 {
  color: #4B5563 !important;
}

/* 白背景セクション内のコードブロックは除外（暗い配色を維持） */
.has-white-background-color pre,
.has-white-background-color code,
.has-white-background-color .wp-block-code,
.has-white-background-color pre *,
.has-white-background-color .wp-block-code *,
[style*="background-color: #fff"] pre,
[style*="background-color: #fff"] code,
[style*="background-color: #fff"] .wp-block-code,
[style*="background-color: #fff"] pre *,
[style*="background-color: #fff"] .wp-block-code * {
  color: #cdd6f4 !important;
}

/* ============================================================
   追加修正：Tailwind arbitrary クラス対応（CTAボタン）
   bg-[#1D4ED8], bg-[#F59E0B], bg-[#0D9488] 等のリンクを白文字固定
   ============================================================ */
.text-white,
[class*="text-white"],
a[class*="text-white"],
a[class*="bg-["],
a[class*="bg-["] span,
a[class*="bg-["] strong,
a[class*="bg-["] em,
a[class*="bg-gradient"],
a[class*="bg-gradient"] * {
  color: #ffffff !important;
}

/* 青／琥珀／ティール背景のCTAボタン */
a[class*="bg-[#1D4ED8]"],
a[class*="bg-[#1D4ED8]"] *,
a[class*="bg-[#2563EB]"],
a[class*="bg-[#2563EB]"] *,
a[class*="bg-[#F59E0B]"],
a[class*="bg-[#F59E0B]"] *,
a[class*="bg-[#EAB308]"],
a[class*="bg-[#EAB308]"] *,
a[class*="bg-[#0D9488]"],
a[class*="bg-[#0D9488]"] *,
a[class*="bg-[#14B8A6]"],
a[class*="bg-[#14B8A6]"] * {
  color: #ffffff !important;
}

/* ============================================================
   追加修正：ヘッダーナビ（カスタム実装への対応）
   style属性のcolor:#9CA3AFを上書きし読みやすさを確保
   ============================================================ */
nav a.menu-item-free-guide,
a.menu-item-free-guide {
  color: #ffffff !important;
  background: #0D9488 !important;
  padding: 6px 14px !important;
  border-radius: 6px !important;
}
nav a.menu-item-free-guide:hover {
  background: #0f766e !important;
}

/* ============================================================
   追加修正：フッター内リンク/テキストの可視性確保
   ダーク背景でも必ず白系で見える配色を強制
   ============================================================ */
footer,
footer p,
footer li,
footer span,
footer h1, footer h2, footer h3, footer h4, footer h5, footer h6,
.site-footer,
.site-footer p,
.site-footer li,
.site-footer span {
  color: #E5E7EB !important;
}

footer a,
footer ul li a,
.site-footer a {
  color: #CBD5E1 !important;
  text-decoration: none !important;
}
footer a:hover,
.site-footer a:hover {
  color: #ffffff !important;
  text-decoration: underline !important;
}

/* フッター見出しは白でしっかり */
footer h4,
.site-footer h4 {
  color: #ffffff !important;
}

/* ============================================================
   追加修正：関連記事カテゴリタグの可読性
   ============================================================ */
.aikasegu-related-cat {
  color: #ffffff !important;
  background: rgba(15, 118, 110, 0.9) !important;
}
