/* ==========================================================================
 * 残業代計算ツール - 専用CSS（モバイルファースト）
 * プレフィックス: otc-
 * ========================================================================== */

/* --- リセット・ベース --- */
.otc-wrapper *,
.otc-wrapper *::before,
.otc-wrapper *::after {
  box-sizing: border-box;
}

/* --- ラッパー（白背景） --- */
.otc-wrapper {
  font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'メイリオ', sans-serif;
  background: #fff;
  padding: 70px 16px 20px;
  line-height: 1.6;
}

/* --- ヘッダー --- */
.otc-header {
  text-align: center;
  margin-bottom: 30px;
}

/* 吹き出し画像 */
.otc-badge-img {
  display: block;
  margin: 0px 0 -12px;
  max-width: 90px;
  height: auto;
}

.otc-header h2 {
  color: #333;
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 20px 0;
  line-height: 1.3;
}

.otc-header p {
  color: #666;
  font-size: 13px;
  font-weight: 700;
  margin: 0;
}

/* スマホのみ改行 */
.otc-sp-br {
  display: inline;
}

/* --- カード共通 --- */
.otc-card {
  background: #648abc;
  border-radius: 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  padding: 0;
  margin-bottom: 20px;
  margin-left: -16px;
  margin-right: -16px;
}

/* --- フォーム --- */
.otc-form-area {
  display: block;
}

.otc-form-area.otc-hidden {
  display: none;
}

/* --- フォーム行: スマホ版ストライプ構造 --- */
.otc-form-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}

/* ラベル行（白背景ストライプ） */
.otc-form-row label {
  background: #fff;
  color: #648abc;
  text-align: center;
  padding: 10px 16px 6px;
  font-size: 16px;
  font-weight: 600;
  border-top: 4px solid #648abc;
}

/* --- 入力ラッパー（スピナー + 単位）: スマホ版Grid 3カラム --- */
.otc-input-wrap {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 25px 16px 21px;
  gap: 8px;
}

.otc-input-wrap .otc-spinner {
  grid-column: 2;
}

.otc-unit {
  grid-column: 3;
  font-size: 15px;
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  justify-self: start;
}

/* --- エラーメッセージ --- */
.otc-error-message {
  color: #ffcdd2;
  font-size: 12px;
  margin-top: -12px;
  margin-bottom: 12px;
  padding-left: 128px;
  display: none;
}

.otc-error-message.otc-show {
  display: block;
}

/* --- selectボックス --- */
.otc-select {
  padding: 8px 6px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  text-align: center;
  width: 130px;
  background: #fff;
  color: #333;
  transition: outline-color 0.3s ease;
  cursor: pointer;
}

.otc-select:focus {
  outline: 2px solid #4a9bd9;
}

.otc-select.otc-error {
  outline: 2px solid #dc3545;
}

/* --- 日付selects領域（入力行・青背景） --- */
.otc-date-selects {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 25px 16px 21px;
  gap: 20px;
}

/* 日付行（年行 / 月行） */
.otc-date-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: nowrap;
}

/* 日付ラベル（西暦・年月日）: 固定幅で横位置を揃える */
.otc-date-label {
  font-size: 15px;
  font-weight: 500;
  color: #fff;
  display: inline-block;
  width: 2em;
  text-align: right;
  flex-shrink: 0;
}

.otc-unit-inline {
  font-size: 15px;
  font-weight: 500;
  color: #fff;
  flex-shrink: 0;
  display: inline-block;
  width: 2em;
  text-align: left;
}

/* --- date inputスタイル（親テーマ input[type="date"] より詳細度を上げる） --- */
input[type="date"].otc-date-input {
  padding: 8px 10px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  background: #fff;
  color: #333;
  transition: outline-color 0.3s ease;
  cursor: pointer;
  width: 130px;
  -webkit-appearance: none;
  appearance: none;
  overflow: hidden;
}

input[type="date"].otc-date-input:focus {
  outline: 2px solid #4a9bd9;
}

input[type="date"].otc-date-input.otc-error {
  outline: 2px solid #dc3545;
}

/* --- カスタムスピナー --- */
.otc-spinner {
  display: flex;
  align-items: stretch;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  width: 130px;
  height: 33px;
}

.otc-spinner-input {
  flex: 1;
  border: none;
  font-size: 16px;
  text-align: center;
  padding: 8px 4px;
  min-width: 0;
  background: transparent;
  outline: none;
  -moz-appearance: textfield;
}
.otc-spinner-input::-webkit-outer-spin-button,
.otc-spinner-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.otc-spinner-buttons {
  display: flex;
  flex-direction: column;
  width: 32px;
  flex-shrink: 0;
  border-left: 0;
  background: #9AB1D2;
}

/* モバイル: 給与・残業代・残業時間のスピナーボタンを非表示 */
.otc-input-wrap .otc-spinner-buttons {
  display: none;
}

.otc-spinner-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: #9AB1D2;
  font-size: 0;
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.otc-spinner-btn::after {
  content: '';
  display: block;
  width: 0;
  height: 0;
}
.otc-spinner-up::after {
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 5px solid #fff;
}
.otc-spinner-down::after {
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #fff;
}
.otc-spinner-btn:active {
  background: #9AB1D2;
}
.otc-spinner-up:active::after {
  border-bottom-color: #c0d0e8;
}
.otc-spinner-down:active::after {
  border-top-color: #c0d0e8;
}
.otc-spinner-btn.otc-spinner-up {
  border-bottom: none;
  align-items: flex-end;
  padding-bottom: 3px;
}
.otc-spinner-btn.otc-spinner-down {
  align-items: flex-start;
  padding-top: 3px;
}

/* スピナーエラー表示 */
.otc-spinner.otc-error {
  outline: 2px solid #dc3545;
}

/* --- 計算ボタンエリア --- */
.otc-calc-area {
  text-align: center;
  border-top: 4px solid #648abc;
  scroll-margin-top: 60px;
}

.otc-calc-area-btn.otc-hidden {
  display: none;
}

/* タイトル行（白背景） */
.otc-calc-area-title {
  background: #fff;
  color: #30b8ed;
  font-size: 16px;
  font-weight: 700;
  padding: 10px 16px 6px;
}

/* ボタン行（水色背景） */
.otc-calc-area-btn {
  background: #30b8ed;
  padding: 25px;
}

/* --- 計算ボタン --- */
.otc-calc-button {
  display: block;
  width: 95px;
  margin-left: auto;
  margin-right: auto;
  padding: 14px 16px;
  background: #fffd45;
  color: #30b8ed;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.otc-calc-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* --- 結果セクション（水色背景ラッパー） --- */
.otc-result-section {
  background: #30b8ed;
  padding: 20px 0 0;
}

/* --- 結果表示エリア（スマホ: 白ボックス） --- */
.otc-result-area {
  background: #fff;
  border-radius: 20px;
  padding: 20px;
  max-width: 100%;
  margin: 0 16px;
  text-align: center;
  animation: otcFadeIn 0.4s ease;
}

@keyframes otcFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.otc-result-row {
  padding: 12px 0;
}

.otc-result-label-new {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
}

.otc-result-value-new {
  font-size: 20px;
  font-weight: 700;
  color: #648abc;
}

/* 1. 基礎賃金（時給） */
.otc-result-row:nth-of-type(1) {
  padding: 9px 0;
}

/* 2. 1か月あたりの未払い残業代 */
.otc-result-row:nth-of-type(2) {
  padding: 19px 0 12px;
}

/* 3. 請求可能月数 */
.otc-result-row:nth-of-type(3) {
  padding: 19px 0 12px;
}

/* 最終行（合計）強調 */
.otc-result-row:last-of-type .otc-result-label-new {
  font-size: 16px;
}

.otc-result-row:last-of-type .otc-result-value-new {
  font-size: 27px;
}

.otc-result-divider {
  border: none;
  border-top: 1px solid rgba(100, 138, 188, 0.3);
  margin: 0 auto;
  width: 82%;
}

/* --- 結果後ボタン --- */
.otc-result-buttons {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 12px;
  margin-top: 0;
  padding: 20px 16px;
}

.otc-result-buttons .otc-calc-button {
  margin-top: 0;
  white-space: nowrap;
}

/* 再計算ボタン */
.otc-result-buttons .otc-recalc-button {
  width: 95px;
  padding: 14px 0;
}

/* この内容で相談ボタン */
.otc-result-buttons a.otc-calc-button {
  width: 160px;
  padding: 14px 0;
}

/* 再計算ボタン背景色（スマホ: 黄色統一） */
.otc-recalc-button {
  background: #fffd45;
}

a.otc-calc-button {
  text-decoration: none;
  text-align: center;
}

a.otc-calc-button:hover {
  text-decoration: none;
  color: #30b8ed;
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* --- 注意事項 --- */
.otc-disclaimer {
  background: #fff;
  padding: 16px 4px;
  margin-bottom: 0;
  font-size: 11px;
  color: #666;
  line-height: 1.8;
}

/* --- 独立ページ用 --- */
.overtime-calculator-page {
  padding: 0;
}

.overtime-calculator-page .otc-wrapper {
  max-width: 100%;
  padding-top: 0;
}

/* --- トップページセクション用 --- */
.eb-overtime-calculator-section {
  padding: 0;
}

.eb-overtime-calculator-section .container.inner {
  max-width: 100%;
  padding: 0;
}

/* --- ドラムロールピッカー（モバイルのみ） --- */

/* オーバーレイ背景 */
.otc-drum-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.otc-drum-overlay.otc-drum-active {
  opacity: 1;
  visibility: visible;
}

/* 中央ダイアログ */
.otc-drum-sheet {
  position: fixed;
  top: 50%;
  left: 50%;
  background: #fff;
  border-radius: 16px;
  z-index: 10000;
  transform: translate(-50%, -50%) scale(0.9);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.otc-drum-overlay.otc-drum-active .otc-drum-sheet {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

/* ドラムロール表示窓 */
.otc-drum-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 24px;
}

.otc-drum-viewport {
  position: relative;
  height: 200px;
  width: 150px;
  overflow: hidden;
}

/* 選択行ハイライト（中央1項目分の帯） */
.otc-drum-highlight {
  position: absolute;
  top: 80px;
  left: 0;
  right: 0;
  height: 40px;
  border-top: 1px solid #d0d0d0;
  border-bottom: 1px solid #d0d0d0;
  background: rgba(91, 176, 227, 0.08);
  pointer-events: none;
  z-index: 1;
}

/* スクロールコンテナ */
.otc-drum-scroll {
  height: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.otc-drum-scroll::-webkit-scrollbar {
  display: none;
}

/* 各項目 */
.otc-drum-item {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #5BB0E3;
  scroll-snap-align: center;
  user-select: none;
  -webkit-user-select: none;
}

/* 上下パディング要素（2項目分=80px） */
.otc-drum-pad {
  height: 80px;
  flex-shrink: 0;
}

/* --- ユーティリティ --- */
.otc-hidden {
  display: none !important;
}

/* ==========================================================================
 * デスクトップ対応（768px以上）- PC版は既存デザインを維持
 * ========================================================================== */
@media (min-width: 768px) {
  /* ラッパー幅を他セクション(.inner)と統一 */
  .otc-wrapper {
    width: 1116px;
    max-width: 100%;
    margin: 0 auto;
    padding: 51px 0 0 0;
  }

  .otc-header {
    margin-bottom: 66px;
  }

  /* 吹き出し画像サイズ拡大・右寄せ調整 */
  .otc-badge-img {
    max-width: 205px;
    margin: 0;
    margin-left: 179px;
  }

  .otc-header h2 {
    font-size: 43px;
    margin-bottom: 38px;
  }

  .otc-header p {
    font-size: 19px;
  }

  .otc-sp-br {
    display: none;
  }

  /* カード: 枠線・角丸なし（各セクションで個別制御） */
  .otc-card {
    border-radius: 0;
    margin-left: 0;
    margin-right: 0;
    padding: 0;
    overflow: visible;
    box-shadow: none;
    border: none;
    background: transparent;
  }

  /* フォームエリア: 青枠（上・左・右・下）+ 上角丸 */
  .otc-form-area {
    background: #648abc;
    border-top: 5px solid #648abc;
    border-left: 5px solid #648abc;
    border-right: 5px solid #648abc;
    border-bottom: 5px solid #648abc;
    border-radius: 10px 10px 0 0;
  }

  /* フォームエリア内の最初のラベルだけ上角丸に合わせる */
  .otc-form-area .otc-form-row:first-child label {
    border-radius: 6px 6px 0 0;
  }

  /* 計算ボタンエリア: 水色枠（左・右・下）+ 下角丸、border-topなし（マイター効果回避） */
  .otc-calc-area {
    border-top: none;
    border-left: 5px solid #30b8ed;
    border-right: 5px solid #30b8ed;
    border-bottom: 5px solid #30b8ed;
    border-radius: 0 0 10px 10px;
    overflow: hidden;
  }

  /* 結果表示時: 計算エリアの下枠・下角丸を外す */
  .otc-card:has(.otc-result-section:not(.otc-hidden)) .otc-calc-area {
    border-bottom: none;
    border-radius: 0;
    overflow: visible;
  }

  /* 結果セクション: 水色枠（左・右・下）+ 下角丸 */
  .otc-result-section {
    border-left: 5px solid #30b8ed;
    border-right: 5px solid #30b8ed;
    border-bottom: 5px solid #30b8ed;
    border-radius: 0 0 10px 10px;
    overflow: hidden;
  }

  /* 入力フォーム：スマホと同じ縦並びストライプ構造 */
  .otc-form-row {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-bottom: 0;
  }

  /* PC版: 白背景ラベル（養育費ツールと同様、border-topなし） */
  .otc-form-row label {
    background: #fff;
    color: #648abc;
    text-align: center;
    border-top: none;
    padding: 15px 16px;
    font-size: 19px;
    font-weight: 700;
  }

  /* PC版: 入力ラッパー（入力欄を中央、単位は横付き） */
  .otc-input-wrap {
    display: flex;
    justify-content: center;
    padding: 36px 30px;
    position: relative;
  }

  .otc-input-wrap .otc-spinner {
    width: 180px;
  }

  .otc-input-wrap .otc-spinner-input {
    padding: 12px 12px;
  }

  .otc-unit {
    font-size: 19px;
    font-weight: 500;
    position: absolute;
    left: calc(50% + 90px + 20px);
    top: 50%;
    transform: translateY(-50%);
  }

  /* PC版: selectボックス */
  .otc-select {
    min-width: 80px;
    font-size: 16px;
  }

  /* PC版: 日付selects中央揃え・padding復元 */
  .otc-date-selects {
    flex-direction: row;
    justify-content: center;
    padding: 36px 30px;
    gap: 0;
  }

  /* PC版: 日付行は横並びのまま */
  .otc-date-line {
    gap: 20px;
  }
  .otc-date-selects .otc-date-line:last-child {
    margin-left: -38px;
  }

  .otc-date-label {
    font-size: 19px;
  }

  .otc-unit-inline {
    font-size: 19px;
  }

  /* PC版: date input */
  input[type="date"].otc-date-input {
    min-width: 180px;
    font-size: 16px;
  }

  /* PC版: スピナー▲▼ボタンは基本非表示 */
  .otc-spinner-buttons {
    display: none;
  }
  /* PC版: 年/月スピナーのみ▲▼ボタン表示 */
  .otc-date-selects .otc-spinner-buttons {
    display: flex;
    width: 32px;
  }
  .otc-spinner {
    width: auto;
    min-width: 80px;
    height: auto;
  }
  /* PC版: 年スピナーは幅広め */
  .otc-date-selects .otc-date-line:first-child .otc-spinner {
    width: 190px;
    height: 44px;
  }
  /* PC版: 月スピナー */
  .otc-date-selects .otc-date-line:last-child .otc-spinner {
    width: 130px;
    height: 44px;
  }
  .otc-spinner-input {
    padding: 8px 6px;
    font-size: 19px;
  }

  .otc-calc-area-title {
    display: none;
  }

  .otc-calc-area-btn {
    background: #30b8ed;
    padding: 36px 36px 31px;
  }

  /* --- 計算ボタン: PC版のスタイル --- */
  .otc-calc-button {
    width: auto;
    padding: 12px 30px;
    margin: 0 auto;
    font-size: 19px;
    color: #30b8ed;
    border-radius: 10px;
  }

  /* --- 結果セクション: 水色背景（養育費ツール同様） --- */
  .otc-result-section {
    background: #30b8ed;
    padding: 41px 30px 0;
  }

  /* --- 結果表示エリア: PC版は白背景 --- */
  .otc-result-area {
    background: #fff;
    border-radius: 12px;
    margin: 0 auto 20px;
    padding: 0px;
    width: 543px;
  }

  /* --- 結果行：PC版の色 --- */
  .otc-result-label-new {
    font-size: 16px;
    margin-bottom: 8px;
    color: #000c15;
  }

  .otc-result-value-new {
    font-size: 29px;
    color: #648abc;
  }

  /* 1. 基礎賃金（時給） */
  .otc-result-row:nth-of-type(1) {
    padding: 30px 0 17px;
  }

  /* 2. 1か月あたりの未払い残業代 */
  .otc-result-row:nth-of-type(2) {
    padding: 33px 0 17px;
  }

  /* 3. 請求可能月数 */
  .otc-result-row:nth-of-type(3) {
    padding: 35px 0 17px;
  }

  /* 4. 全月分の残業代 */
  .otc-result-row:nth-of-type(4) {
    padding: 33px 0 17px;
  }

  /* 5. 請求可能な残業代 */
  .otc-result-row:nth-of-type(5) {
    padding: 33px 0 40px;
  }

  /* 最終行（合計）強調拡大 */
  .otc-result-row:last-of-type .otc-result-label-new {
    font-size: 19px;
  }

  .otc-result-row:last-of-type .otc-result-value-new {
    font-size: 42px;
  }

  /* 区切り線: PC版の色 */
  .otc-result-divider {
    border-top: 2px solid #648abc;
    width: 62%;
  }

  /* 結果後ボタン：水色背景内に収める */
  .otc-result-buttons {
    flex-direction: row;
    justify-content: center;
    margin-top: 0;
    gap: 30px;
    padding: 26px 16px 36px;
  }

  /* 再計算ボタン: PC版の色 */
  .otc-recalc-button {
    background: #F6AB00;
  }

  .otc-result-buttons .otc-recalc-button {
    width: 110px;
    padding: 16px 0;
    font-size: 19px;
    margin: 0;
  }

  .otc-result-buttons a.otc-calc-button {
    width: 190px;
    padding: 16px 0;
    margin: 0;
    font-size: 19px;
  }

  a.otc-calc-button:hover {
    color: #30b8ed;
  }

  /* 注意事項：PC版は中央揃え */
  .otc-disclaimer {
    text-align: center;
  }

  /* 独立ページ：ヘッダーとの間隔確保 */
  .overtime-calculator-page .otc-wrapper {
    padding-top: 0;
    padding-bottom: 80px;
  }
}
