/* -------------------------
  全体設定 / グローバル
-------------------------- */
body {
  font-family: "Helvetica Neue", sans-serif;
}

/* -------------------------
  購入情報アコーディオン
-------------------------- */
.accordion-card {
  border: 1px solid #ddd;
  border-radius: 8px;
  background-color: #fff;
  margin-bottom: 16px;
  overflow: hidden;
  transition: box-shadow 0.3s ease;
}
.accordion-header {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  background-color: #fff;
}
.accordion-title {
  font-size: 1rem;
}
.accordion-icon i {
  transition: transform 0.3s ease;
  font-size: 1.2rem;
}
.accordion-card.open .accordion-icon i {
  transform: rotate(180deg);
}
.accordion-card .accordion-body {
  padding: 12px 16px;
  background-color: #fafafa;
  border-top: 1px solid #eee;
  display: none;
}
.accordion-card.open .accordion-body {
  display: block;
}

/* -------------------------
  入力フォーム項目
-------------------------- */
#purchase-container .purchase-entry {
  padding: 10px;
  border: 1px solid #ccc;
  margin-bottom: 8px;
  background-color: #f9f9f9;
  border-radius: 8px;
}
.form-group {
  margin-bottom: 10px;
}
.form-group label {
  display: block;
  font-size: 0.9em;
  margin-bottom: 4px;
}
.form-control {
  width: 100%;
  padding: 6px;
  border-radius: 4px;
  border: 1px solid #ccc;
}
.btn-add {
  margin-top: 10px;
  padding: 6px 12px;
  background-color: #e0e0e0;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

/* -------------------------
  汎用パネル表示
-------------------------- */
.panel-box {
  background-color: #fdfdff;
  border: 1px solid #ccd;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/*×ボタンを削除*/
#purchase-container .purchase-entry:first-child .btn-close {
  display: none;
}

/* -------------------------
   アコーディオンアイコン
-------------------------- */
.accordion-icon i {
  font-size: 1.2rem;
  display: inline-block;
  transition: transform 0.3s ease;
}

.accordion-card.open .accordion-icon i {
  transform: rotate(180deg);
}

/* 購入情報のフェードイン */
.fade-in {
  opacity: 0;
  transition: opacity 0.8s ease;
}

.fade-in.show {
  opacity: 1;
}
/* === 購入情報の入力 ========== */
.purchase-entry {
  background: #fdfdfd;
  border: 1px solid #dee2e6;
  border-radius: 10px;
  padding: 15px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  margin-bottom: 16px;
  transition: box-shadow 0.3s ease;
  position: relative;
}

/* 購入履歴インデックス */
.purchase-index {
  position: absolute;
  top: 15px;
  left: 15px;
  background: #6c757d;
  color: white;
  border-radius: 6px;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  z-index: 1;
  white-space: nowrap;
  min-width: 60px;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.purchase-entry label:first-of-type {
  padding-top: 35px;
}

.purchase-entry:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.purchase-entry label {
  font-weight: 600;
  margin-bottom: 6px;
}

.purchase-entry input.form-control {
  margin-bottom: 10px;
  padding: 6px 10px;
  border-radius: 6px;
  transition: border-color 0.3s ease, background-color 0.3s ease;
}

/* 無効な値の入力フィールドのスタイル */
.purchase-entry input.form-control.invalid {
  border-color: #dc3545;
  background-color: #fff5f5;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* エラーメッセージのスタイル */
.error-message {
  color: #dc3545;
  font-size: 0.8rem;
  margin-top: 2px;
  margin-bottom: 8px;
  display: none;
  font-weight: 500;
}

.error-message.show {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#plot-title {
  border-bottom: 2px solid #d8dee4;
  padding-bottom: 6px;
  margin-bottom: 12px;
  font-weight: 600;
  font-size: 1.25rem;
  color: #212529;
}

/* カード全体の外枠 */
.accordion-card {
  background-color: #fdfdfe;
  border: 1px solid #d8dee4;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  padding: 16px;
  margin-bottom: 20px;
  transition: box-shadow 0.2s ease;
}

.accordion-card:hover {
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.08);
}

/* ヘッダー部分（トグル） */
.accordion-header {
  cursor: pointer;
  padding: 10px 12px;
  border-bottom: 1px solid #d0d7de;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #f3f4f6;
  border-radius: 6px 6px 0 0;
}

/* タイトル文字 */
.accordion-title {
  font-weight: 600;
  font-size: 15px;
  color: #333;
}

/* 開閉する中身 */
.accordion-item .accordion-body {
  background-color: #f7faff;
  /border-radius: 0 0 6px 6px;
  padding: 12px 14px;
}
/*アコーディオンのスイッチのホバー設定*/
.accordion-header {
  cursor: pointer;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.accordion-header:hover {
  background-color: #f8f9fa;
  box-shadow: inset 0 0 0 1px #dee2e6;
}

.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1080;
}

/* スマホ表示位置の変更 */
@media (max-width: 768px) {
  .toast-container {
    top: auto;
    bottom: 1rem;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
}

.btn-fixed-width {
  min-width: 120px;
}

/* ボタン内のアイコンとテキストの間隔・整列・フォントサイズ調整 */
.btn,
.btn-fixed-width {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  font-size: 1rem;
  line-height: 1.2;
  text-align: center;
  padding-top: 0.45em;
  padding-bottom: 0.45em;
  padding-left: 1.1em;
  padding-right: 1.1em;
}
.btn i,
.btn .bi,
.btn svg,
.btn .emoji,
.btn .icon {
  font-size: 1.15em;
  vertical-align: middle;
  margin-right: 0.25em;
  margin-left: 0;
  line-height: 1;
  display: inline-block;
}
.btn .emoji {
  font-size: 1.15em;
  vertical-align: middle;
  margin-right: 0.25em;
  margin-left: 0;
  line-height: 1;
  display: inline-block;
}
@media (max-width: 767.98px) {
  .btn,
  .btn-fixed-width {
    font-size: 0.97rem;
    padding-top: 0.38em;
    padding-bottom: 0.38em;
    padding-left: 0.7em;
    padding-right: 0.7em;
    gap: 0.32em;
  }
  .btn i,
  .btn .bi,
  .btn svg,
  .btn .emoji,
  .btn .icon {
    font-size: 1.08em;
    margin-right: 0.18em;
  }
}

/* -------------------------
  スマホ最適化
-------------------------- */
@media (max-width: 768px) {
  /* コンテナの余白調整 */
  .container {
    padding-left: 10px;
    padding-right: 10px;
  }

  /* タイトルサイズ調整 */
  h1 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
  }

  /* アコーディオンカードの余白調整 */
  .accordion-card {
    margin-bottom: 12px;
    padding: 12px;
  }

  /* アコーディオンヘッダーのタッチ領域拡大 */
  .accordion-header {
    padding: 12px 16px;
    min-height: 48px; /* タッチターゲット最小サイズ */
  }

  .accordion-title {
    font-size: 14px;
  }

  .form-control {
    padding: 10px 12px;
    font-size: 16px;
    min-height: 44px;
  }

  .btn {
    padding: 10px 16px;
    font-size: 14px;
    min-height: 44px;
  }

  .purchase-entry {
    padding: 12px;
    margin-bottom: 12px;
  }

  .purchase-index {
    padding: 3px 6px;
    font-size: 10px;
    top: 8px;
    left: 8px;
    min-width: 50px;
  }

  .purchase-entry {
    padding-top: 0;
  }

  .purchase-entry label:first-of-type {
    padding-top: 25px;
  }

  .slider-group {
    padding: 8px !important;
    margin-bottom: 16px !important;
  }

  .slider-group input {
    font-size: 14px;
    padding: 8px;
  }

  #plot-title {
    font-size: 1.1rem;
    margin-bottom: 8px;
  }

  #graph-container {
    width: 100%;
    max-width: 100%;
    touch-action: manipulation;
    -webkit-overflow-scrolling: touch;
    overflow: visible;
    position: relative;
  }

  #plot {
    width: 100% !important;
    height: auto !important;
    touch-action: manipulation;
    pointer-events: auto;
  }

  #average-info {
    padding: 12px !important;
    font-size: 14px;
  }

  .btn-fixed-width {
    min-width: 100px;
    font-size: 12px;
    padding: 8px 12px;
  }

  #pin-settings .d-flex {
    flex-direction: column;
    gap: 8px;
  }

  #pin-settings .btn-delete-pin {
    align-self: flex-end;
    margin-top: 4px;
  }

  .d-flex.gap-2 {
    flex-wrap: wrap;
    gap: 8px !important;
  }

  .d-flex.gap-2 .btn {
    flex: 1;
    min-width: 80px;
  }
}

@media (max-width: 375px) {
  .container {
    padding-left: 8px;
    padding-right: 8px;
  }

  h1 {
    font-size: 1.3rem;
  }

  .accordion-card {
    padding: 8px;
  }

  .accordion-header {
    padding: 10px 12px;
  }

  .accordion-title {
    font-size: 13px;
  }

  .btn {
    padding: 8px 12px;
    font-size: 13px;
  }

  .btn-fixed-width {
    min-width: 90px;
    font-size: 11px;
  }

  .d-md-none .btn {
    font-size: 12px;
    padding: 8px 4px;
    min-height: 40px;
  }

  .d-md-none .btn .bi {
    font-size: 14px;
  }

  .modal-title {
    font-size: 1rem !important;
  }

  .modal-body {
    font-size: 0.85rem !important;
  }

  .modal-body .form-label {
    font-size: 0.8rem !important;
  }

  .modal-body .form-control {
    font-size: 0.8rem !important;
    padding: 0.25rem 0.4rem !important;
    height: auto !important;
    min-height: 28px !important;
  }

  .modal-body .form-check-label {
    font-size: 0.75rem !important;
  }

  .modal-body .btn {
    font-size: 0.8rem !important;
    padding: 0.25rem 0.5rem !important;
    height: auto !important;
    min-height: 28px !important;
  }
}

/* -------------------------
  スライダー系スタイル
-------------------------- */

.noUi-handle {
  background: white !important;
  border: 2px solid #0d6efd !important;
  border-radius: 50% !important;
  width: 24px !important;
  height: 24px !important;
  top: -6px !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
  transform: translateX(-25%) !important;
  transition: background 0.3s, transform 0.2s;
}

.noUi-handle:hover {
  background: #e6f0ff !important;
  transform: scale(1.1) translateX(-25%);
}

@media (max-width: 768px) {
  .noUi-handle {
    width: 32px !important;
    height: 32px !important;
    top: -8px !important;
    transform: translateX(-25%) !important;
  }

  .noUi-handle:hover {
    transform: scale(1.2) translateX(-25%) !important;
  }

  /* スライダー全体のタッチ領域拡大 */
  .noUi-target {
    height: 20px !important;
  }

  .noUi-base {
    height: 20px !important;
  }

  .noUi-connect {
    height: 20px !important;
  }
}

.noUi-handle::before,
.noUi-handle::after {
  display: none !important;
}

.noUi-handle:focus {
  outline: 3px solid #0d6efd;
  box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.25); /* 青いぼかし */
}

h1 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

h1.site-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: linear-gradient(90deg, #2c3e50 0%, #6c757d 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-fill-color: transparent;
  text-shadow: 0 1px 3px rgba(44, 62, 80, 0.08);
  border-bottom: 1.5px solid #6c757d;
  padding-bottom: 0.2em;
  margin-bottom: 1.2em;
  margin-top: 0.5em;
  text-align: center;
}
@media (max-width: 767.98px) {
  h1.site-title {
    font-size: 0.92rem;
    padding-bottom: 0.13em;
    margin-bottom: 0.6em;
  }
}

@media (max-width: 575.98px) {
  h1 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
  }
}

#mobile-hover-info {
  animation: slideInRight 0.3s ease-out;
  transition: all 0.2s ease-in-out;
}

#mobile-hover-info:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2) !important;
}

@media (max-width: 767.98px) {
  #mobile-hover-info {
    max-width: 220px !important;
    font-size: 0.75rem !important;
    padding: 0.5rem !important;
    top: 15px !important;
    right: 15px !important;
  }

  #mobile-hover-info .text-primary {
    font-size: 0.9rem !important;
  }

  #mobile-hover-info .small {
    font-size: 0.7rem !important;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

#close-hover-info:hover {
  background-color: #c82333 !important;
  transform: scale(1.1);
}

.scroll-controls {
  position: fixed;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* スクロールボタン */
.scroll-button {
  width: 40px;
  height: 40px;
  background: rgba(0, 123, 255, 0.7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  opacity: 0.8;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  user-select: none;
  -webkit-user-select: none;
}

.scroll-button:hover {
  background: rgba(0, 123, 255, 0.9);
  transform: scale(1.1);
  opacity: 1;
}

.scroll-button:active {
  transform: scale(0.95);
}

@media (max-width: 768px) {
  .scroll-controls {
    right: 10px;
    gap: 8px;
  }

  .scroll-button {
    width: 35px;
    height: 35px;
    font-size: 1rem;
  }
}

@media (min-width: 769px) {
  .scroll-controls {
    display: none;
  }
}

h1.site-title .emoji {
  background: none !important;
  -webkit-background-clip: initial !important;
  -webkit-text-fill-color: initial !important;
  background-clip: initial !important;
  text-fill-color: initial !important;
  color: inherit !important;
  font-size: 1.1em;
  vertical-align: -0.08em;
  margin-right: 0.08em;
}

/* Primary */
.btn-primary {
  background-color: #2c3e50 !important;
  border-color: #2c3e50 !important;
  color: #ffffff !important;
}
.btn-primary:hover {
  background-color: #34495e !important;
  border-color: #34495e !important;
}
.btn-outline-primary {
  color: #2c3e50 !important;
  border-color: #2c3e50 !important;
}
.btn-outline-primary:hover {
  background-color: #2c3e50 !important;
  border-color: #2c3e50 !important;
}

/* Secondary */
.btn-secondary {
  background-color: #6c757d !important;
  border-color: #6c757d !important;
  color: #ffffff !important;
}
.btn-secondary:hover {
  background-color: #5a6268 !important;
  border-color: #5a6268 !important;
}
.btn-outline-secondary {
  color: #6c757d !important;
  border-color: #6c757d !important;
}
.btn-outline-secondary:hover {
  background-color: #6c757d !important;
  border-color: #6c757d !important;
}

/* Success */
.btn-success {
  background-color: #27ae60 !important;
  border-color: #27ae60 !important;
  color: #ffffff !important;
}
.btn-success:hover {
  background-color: #229954 !important;
  border-color: #229954 !important;
}
.btn-outline-success {
  color: #27ae60 !important;
  border-color: #27ae60 !important;
}
.btn-outline-success:hover {
  background-color: #27ae60 !important;
  border-color: #27ae60 !important;
}

/* Info */
.btn-info {
  background-color: #3498db !important;
  border-color: #3498db !important;
  color: #ffffff !important;
}
.btn-info:hover {
  background-color: #2980b9 !important;
  border-color: #2980b9 !important;
}
.btn-outline-info {
  color: #3498db !important;
  border-color: #3498db !important;
}
.btn-outline-info:hover {
  background-color: #3498db !important;
  border-color: #3498db !important;
}

/* Warning */
.btn-warning {
  background-color: #e67e22 !important;
  border-color: #e67e22 !important;
  color: #ffffff !important;
}
.btn-warning:hover {
  background-color: #d68910 !important;
  border-color: #d68910 !important;
}
.btn-outline-warning {
  color: #e67e22 !important;
  border-color: #e67e22 !important;
}
.btn-outline-warning:hover {
  background-color: #e67e22 !important;
  border-color: #e67e22 !important;
}

/* Danger  */
.btn-danger {
  background-color: #e74c3c !important;
  border-color: #e74c3c !important;
  color: #ffffff !important;
}
.btn-danger:hover {
  background-color: #c0392b !important;
  border-color: #c0392b !important;
}
.btn-outline-danger {
  color: #e74c3c !important;
  border-color: #e74c3c !important;
}
.btn-outline-danger:hover {
  background-color: #e74c3c !important;
  border-color: #e74c3c !important;
}

/* 削除ボタン専用スタイル */
.btn-delete-pin {
  background-color: #e74c3c !important;
  border-color: #e74c3c !important;
  color: #ffffff !important;
}
.btn-delete-pin:hover {
  background-color: #c0392b !important;
  border-color: #c0392b !important;
}

/* アプリ概要・免責事項ボタンの洗練されたoutlineスタイル */
.btn-outline-info,
.btn-outline-warning {
  background-color: #fff !important;
  border-width: 2px;
  font-weight: 500;
  box-shadow: 0 1px 4px rgba(52, 152, 219, 0.04);
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.btn-outline-info {
  color: #3498db !important;
  border-color: #3498db !important;
}
.btn-outline-info:hover,
.btn-outline-info:focus {
  background-color: #3498db !important;
  color: #fff !important;
  border-color: #2980b9 !important;
}
.btn-outline-warning {
  color: #e67e22 !important;
  border-color: #e67e22 !important;
}
.btn-outline-warning:hover,
.btn-outline-warning:focus {
  background-color: #e67e22 !important;
  color: #fff !important;
  border-color: #d68910 !important;
}

/* 上段情報系ボタン群（info-actions） */
.info-actions {
  background: #f7fafc;
  border: 1.5px solid #e3e8ee;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.04);
  margin-bottom: 2rem !important;
  padding: 1.1rem 1rem 1rem 1rem;
  border-radius: 1.1rem;
}
.info-actions .btn {
  min-width: 0;
  font-size: 0.98rem;
  padding-top: 0.5em;
  padding-bottom: 0.5em;
  font-weight: 500;
}
.info-actions .btn i,
.info-actions .btn .bi,
.info-actions .btn .emoji {
  font-size: 1.1em;
}

/* 下段操作系ボタン群（main-actions） */
.main-actions {
  background: #fff;
  margin-top: 1.5rem;
  padding: 0.5rem 0 0.2rem 0;
  border-radius: 0.7rem;
}
.main-actions .btn {
  font-size: 1.05rem;
  font-weight: 600;
  min-width: 120px;
  margin-bottom: 0.5rem;
}

@media (max-width: 767.98px) {
  .info-actions {
    padding: 0.7rem 0.5rem 0.7rem 0.5rem;
    margin-bottom: 1.2rem !important;
    border-radius: 0.7rem;
  }
  .main-actions {
    margin-top: 1rem;
    border-radius: 0.5rem;
  }
  .main-actions .btn {
    font-size: 0.97rem;
    min-width: 90px;
    padding-left: 0.7em;
    padding-right: 0.7em;
  }

  .modal-title {
    font-size: 1.1rem !important;
  }

  .modal-body {
    font-size: 0.9rem !important;
  }

  .modal-body .form-label {
    font-size: 0.85rem !important;
    margin-bottom: 0.3rem !important;
  }

  .modal-body .form-control {
    font-size: 0.85rem !important;
    padding: 0.3rem 0.5rem !important;
    height: auto !important;
    min-height: 32px !important;
  }

  .modal-body .form-check-label {
    font-size: 0.8rem !important;
  }

  .modal-body .btn {
    font-size: 0.85rem !important;
    padding: 0.3rem 0.6rem !important;
    height: auto !important;
    min-height: 32px !important;
  }
}

#btn-post-x,
#btn-save-image,
#btn-post-x:focus,
#btn-save-image:focus,
#btn-post-x:active,
#btn-save-image:active,
#btn-post-x:focus-visible,
#btn-save-image:focus-visible {
  background-color: inherit !important;
  box-shadow: none !important;
  outline: none !important;
  transform: none !important;
}

#btn-post-x,
#btn-save-image {
  -webkit-tap-highlight-color: transparent !important;
  -webkit-user-select: none !important;
  user-select: none !important;
  touch-action: manipulation;
}
