/* ============================================================
   SASチェックシート スタイル
   ============================================================
   【組み込み方法】
   A) functions.php に以下を追記して単体ファイルとして登録（推奨）:

       function load_sas_check_style() {
           wp_enqueue_style(
               'sas_check_css',
               get_stylesheet_directory_uri() . '/assets/css/sas-check.css',
               array('my_style'),
               date('YmdHis', filemtime(get_stylesheet_directory() . '/assets/css/sas-check.css'))
           );
       }
       add_action('wp_enqueue_scripts', 'load_sas_check_style');

   B) style.css の末尾にこのファイルの内容を追記する場合:
      先頭の @import 行を style.css のファイル先頭（既存の @import の直後）に
      移動してください。

   【Noto Sans JP について】
   functions.php の load_fonts_child() を確認: Noto Sans JP は未登録のため
   以下の @import で読み込みます。
   functions.php で登録済みにする場合は @import 行を削除し、
   load_fonts_child() に以下を追加してください:
       wp_enqueue_style('noto_sans_jp', 'https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;700&display=swap', array(), null);
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;700&display=swap');


/* ============================================================
   ウィジェット全体
   ============================================================ */
#sas-check-widget {
  font-family: 'Noto Sans JP', "Hiragino Kaku Gothic ProN", -apple-system,
               BlinkMacSystemFont, "游ゴシック Medium", "メイリオ", sans-serif;
  font-size: 16px;
  color: #333333;
  max-width: 600px;
  margin: 0 auto 2.5rem;
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.18);
  border-radius: 0 0 8px 8px;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#sas-check-widget *,
#sas-check-widget *::before,
#sas-check-widget *::after {
  box-sizing: border-box;
}


/* ============================================================
   クリップボード クリップ部分
   ============================================================ */
#sas-check-widget .sas-clip-area {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  background: #d07214;
  border-radius: 8px 8px 0 0;
  padding: 8px 0 0;
}

#sas-check-widget .sas-clip {
  display: block;
  width: 72px;
  height: 24px;
  background: linear-gradient(180deg, #d8d8d8 0%, #909090 50%, #b8b8b8 100%);
  border-radius: 5px 5px 0 0;
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.5),
    0 -1px 3px rgba(0, 0, 0, 0.25);
  position: relative;
}

#sas-check-widget .sas-clip::before {
  content: '';
  display: block;
  width: 38px;
  height: 9px;
  background: linear-gradient(180deg, #e8e8e8 0%, #b0b0b0 100%);
  border-radius: 3px;
  position: absolute;
  top: 7px;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
}


/* ============================================================
   ヘッダー
   ============================================================ */
#sas-check-widget .sas-header {
  background: #E8871A;
  padding: 1rem 1.5rem;
  margin: 0;
}

#sas-check-widget .sas-title {
  font-family: 'Noto Sans JP', sans-serif !important;
  color: #ffffff !important;
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  text-align: center;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  line-height: 1.55 !important;
  letter-spacing: 0.02em;
}

#sas-check-widget .sas-title::before,
#sas-check-widget .sas-title::after {
  display: none !important;
}


/* ============================================================
   本体
   ============================================================ */
#sas-check-widget .sas-body {
  background: #F5E6D0;
  padding: 1.375rem 1.25rem 1.625rem;
  border-radius: 0 0 8px 8px;
}


/* ============================================================
   説明文
   ============================================================ */
#sas-check-widget .sas-description {
  font-size: 0.875rem;
  line-height: 1.75;
  margin: 0 0 1.25rem;
  padding: 0;
  color: #333333;
}


/* ============================================================
   設問コンテナ
   ============================================================ */
#sas-check-widget .sas-questions {
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #d4b896;
}


/* ============================================================
   設問行（シマシマ）
   ============================================================ */
#sas-check-widget .sas-question {
  padding: 0.8rem 0.9rem;
  background: #fffbf6;
  border-bottom: 1px solid #e4ccaa;
}

#sas-check-widget .sas-question:last-child {
  border-bottom: none;
}

#sas-check-widget .sas-question:nth-child(even) {
  background: #fef0dc;
}


/* ============================================================
   設問ラベル（番号 + テキスト）
   ============================================================ */
#sas-check-widget .sas-question-label {
  display: flex;
  align-items: flex-start;
  margin: 0 0 0.55rem;
  padding: 0;
  font-weight: 700;
  font-size: 0.875rem;
  line-height: 1.55;
  color: #333333;
}

#sas-check-widget .sas-q-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  background: #E8871A;
  color: #ffffff;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 700;
  margin-right: 0.5rem;
  margin-top: 1px;
  line-height: 1;
}

#sas-check-widget .sas-q-text {
  flex: 1;
  color: #333333;
}


/* ============================================================
   選択肢グループ（4列 / モバイル2列）
   ============================================================ */
#sas-check-widget .sas-choices {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.375rem;
  padding-left: 30px;
}


/* ============================================================
   個別選択肢
   ============================================================ */
#sas-check-widget .sas-choice {
  margin: 0;
  padding: 0;
  cursor: pointer;
  display: block;
}

/* ラジオ input は視覚的に非表示（アクセシビリティ上は有効なまま） */
#sas-check-widget .sas-choice input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 選択肢カード */
#sas-check-widget .sas-choice-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.25rem 0.4rem;
  background: #ffffff;
  border: 1.5px solid #d4b896;
  border-radius: 6px;
  text-align: center;
  min-height: 64px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

#sas-check-widget .sas-choice:hover .sas-choice-inner {
  border-color: #E8871A;
  background: #fff6ed;
}

/* 選択済み */
#sas-check-widget .sas-choice input[type="radio"]:checked + .sas-choice-inner {
  background: #E8871A;
  border-color: #E8871A;
  color: #ffffff;
}

/* キーボードフォーカス */
#sas-check-widget .sas-choice input[type="radio"]:focus + .sas-choice-inner {
  outline: 2px solid #E8871A;
  outline-offset: 2px;
}

/* ラジオ丸マーク */
#sas-check-widget .sas-choice-mark {
  display: block;
  width: 16px;
  height: 16px;
  border: 1.5px solid #c4a070;
  border-radius: 50%;
  margin-bottom: 0.2rem;
  flex-shrink: 0;
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease;
}

#sas-check-widget .sas-choice input[type="radio"]:checked + .sas-choice-inner .sas-choice-mark {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.85);
}

#sas-check-widget .sas-choice input[type="radio"]:checked + .sas-choice-inner .sas-choice-mark::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.65rem;
  font-weight: 900;
  color: #ffffff;
  line-height: 1;
}

/* 選択肢テキスト */
#sas-check-widget .sas-choice-text {
  font-size: 0.7rem;
  line-height: 1.3;
  color: inherit;
  word-break: keep-all;
}

/* 点数表示 */
#sas-check-widget .sas-choice-score {
  font-size: 0.65rem;
  color: #a07850;
  margin-top: 0.1rem;
  transition: color 0.15s ease;
}

#sas-check-widget .sas-choice input[type="radio"]:checked + .sas-choice-inner .sas-choice-score {
  color: rgba(255, 255, 255, 0.8);
}


/* ============================================================
   スコア表示エリア
   ============================================================ */
#sas-check-widget .sas-score-area {
  margin-top: 1.375rem;
  text-align: center;
}

#sas-check-widget .sas-score-display {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 1rem;
  font-weight: 700;
  color: #333333;
}

/* テキストボックス風のスコア枠 */
#sas-check-widget .sas-score-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 50px;
  background: #ffffff;
  border: 2px solid #E8871A;
  border-radius: 6px;
  font-size: 1.875rem;
  font-weight: 700;
  color: #E8871A;
  line-height: 1;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.07);
  transition: color 0.2s ease;
}

#sas-check-widget .sas-score-unit {
  font-size: 1rem;
  font-weight: 700;
  color: #333333;
}


/* ============================================================
   結果メッセージ
   ============================================================ */
#sas-check-widget .sas-result {
  display: none;
  margin: 1rem auto 0;
  padding: 0.8rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.65;
  max-width: 500px;
  text-align: left;
}

/* 1〜4点: 緑 */
#sas-check-widget .sas-result.is-safe {
  display: block;
  background: rgba(76, 175, 80, 0.1);
  border-left: 4px solid #4CAF50;
  color: #2e7d32;
}

/* 5〜10点: アンバー */
#sas-check-widget .sas-result.is-caution {
  display: block;
  background: rgba(255, 152, 0, 0.12);
  border-left: 4px solid #FF9800;
  color: #bf6000;
}

/* 11〜24点: レッド */
#sas-check-widget .sas-result.is-danger {
  display: block;
  background: rgba(244, 67, 54, 0.1);
  border-left: 4px solid #F44336;
  color: #b71c1c;
}


/* ============================================================
   リセットボタン
   ============================================================ */
#sas-check-widget .sas-actions {
  text-align: center;
  margin-top: 1.375rem;
}

#sas-check-widget .sas-reset-btn {
  display: inline-block;
  background: #E8871A;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 0.65rem 3rem;
  font-size: 1rem;
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 0 #b85e0d;
  -webkit-appearance: none;
  appearance: none;
  transition: background 0.15s ease, transform 0.1s ease;
  line-height: 1.5;
  text-decoration: none;
}

#sas-check-widget .sas-reset-btn:hover {
  background: #d67616;
  color: #ffffff;
  text-decoration: none;
}

#sas-check-widget .sas-reset-btn:active {
  transform: translateY(4px);
  box-shadow: none;
}

#sas-check-widget .sas-reset-btn:focus {
  outline: 2px solid #E8871A;
  outline-offset: 3px;
}


/* ============================================================
   注意書き
   ============================================================ */
#sas-check-widget .sas-note {
  margin: 1.375rem 0 0;
  padding: 0.875rem 0 0;
  border-top: 1px solid #d4b896;
  font-size: 0.78rem;
  color: #77685d;
  line-height: 1.75;
}


/* ============================================================
   レスポンシブ（スマートフォン）
   ============================================================ */
@media (max-width: 480px) {
  #sas-check-widget .sas-header {
    padding: 0.875rem 1rem;
  }

  #sas-check-widget .sas-title {
    font-size: 0.95rem !important;
  }

  #sas-check-widget .sas-body {
    padding: 1rem 0.875rem 1.25rem;
  }

  /* モバイルでは選択肢を2列に */
  #sas-check-widget .sas-choices {
    grid-template-columns: repeat(2, 1fr);
    padding-left: 28px;
  }

  #sas-check-widget .sas-choice-inner {
    min-height: 58px;
    padding: 0.4rem 0.2rem 0.35rem;
  }

  #sas-check-widget .sas-reset-btn {
    padding: 0.6rem 2.5rem;
  }
}
