/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

@import "actiontext";

button:not(:disabled),
input[type="submit"],
input[type="button"],
input[type="reset"],
[role="button"] {
  cursor: pointer;
}

button:disabled,
input[type="submit"]:disabled,
input[type="button"]:disabled,
input[type="reset"]:disabled {
  cursor: not-allowed;
}

.prose h1 {
  font-size: 2em;
  margin-bottom: 0.5em;
}
.prose h2 {
  font-size: 1.5em;
  margin-bottom: 0.5em;
}
.prose p {
  margin-bottom: 1em;
  line-height: 1.6;
}
.prose ul {
  margin-left: 1.5em;
  list-style-type: disc;
  margin-bottom: 1em;
}
.prose ol {
  margin-left: 1.5em;
  list-style-type: decimal;
  margin-bottom: 1em;
}
.prose li {
  margin-bottom: 0.5em;
}
.select-options {
  transition: all 0.3s ease;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
}

.select-options.open {
  opacity: 1;
  max-height: 500px;
}

.select-option:hover {
  background-color: #f3f4f6;
}

.select-chevron {
  transition: transform 0.3s ease;
}

.select-chevron.open {
  transform: rotate(180deg);
}

input[type="radio"] {
  accent-color: black;
}
/*
 * バナーカルーセルの高さは「コンテナ側」で予約する（CLS 対策）。
 *
 * スライド1枚の幅は slidesPerView に応じて Swiper が初期化時にインライン指定で書き換える。
 * そのためスライドに aspect-ratio を持たせると、初期化前（幅 = コンテナ全幅）と
 * 初期化後（幅 = コンテナ / slidesPerView）で高さが数百 px 変わり、そのままレイアウトシフトになる。
 * コンテナの高さを先に確定させ、スライドは親の高さに従うだけにすることで、
 * スライド幅が何度変わってもカルーセル全体の高さは動かない。
 *
 * aspect-ratio の値は「バナー画像の推奨サイズ 16:9（app/views/admin/banners/_form.html.erb）が
 * 余白なく収まる高さ」から逆算している。slidesPerView は app/javascript/application.js と対応。
 */
.swiper-container {
  width: 100%;
  overflow-x: hidden;
  /* モバイル: slidesPerView 1 → スライド幅 = コンテナ幅 */
  aspect-ratio: 16 / 9;
}

@media (min-width: 768px) {
  /* 1枚・3枚以上: slidesPerView 2.5 → スライド幅 = コンテナ幅 / 2.5 */
  .swiper-container {
    aspect-ratio: 40 / 9;
  }

  /* 2枚: slidesPerView 2 かつ左右 5% パディング → スライド幅 = コンテナ幅 * 0.9 / 2 */
  .swiper-container.swiper-double {
    aspect-ratio: 3.95 / 1;
  }

  /*
   * デスクトップだけは、初期化前（1枚がコンテナ全幅・左寄せ）と
   * 初期化後（1枚が 40% 幅・中央寄せ）でスライドの横位置と幅が大きく変わる。
   * 高さを固定しても、この横方向の変化はレイアウトシフトとして計上されるため、
   * 幅が確定するまでスライドを描画しない（Swiper が初期化時に swiper-initialized を付与する）。
   * コンテナ側で高さは予約済みなので、空白が生まれたり詰まったりはしない。
   *
   * モバイルは slidesPerView 1 で初期化の前後の見た目がほぼ一致するため対象外にしている。
   * LCP 候補であるバナー画像の描画を JS の初期化まで遅らせたくないため。
   */
  .swiper-container:not(.swiper-initialized) .swiper-wrapper {
    visibility: hidden;
  }
}

/* Swiper 本体の CSS があとから読まれるため、高さの継承だけ詳細度を上げて確実に効かせる */
.swiper-container .swiper-wrapper,
.swiper-container .swiper-slide {
  height: 100%;
}

.swiper-slide {
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.3s ease;
}

.swiper-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.swiper-slide-active {
  transform: scale(1.1);
  z-index: 2;
}

/* 1枚の場合: スケールエフェクト無効 */
.swiper-single .swiper-slide-active {
  transform: none;
}

/* 2枚の場合: デスクトップで左右パディング + スケール無効 */
.swiper-double .swiper-slide-active {
  transform: none;
}

@media (min-width: 768px) {
  .swiper-double {
    padding-left: 5%;
    padding-right: 5%;
  }
}

.swiper-pagination-bullet {
  background: #252322 !important;
}

.swiper-horizontal > .swiper-pagination-bullets,
.swiper-pagination-bullets.swiper-pagination-horizontal,
.swiper-pagination-custom,
.swiper-pagination-fraction {
  bottom: -34px !important;
}

.swiper-button-next:after,
.swiper-button-prev:after {
  font-family: swiper-icons;
  font-size: 14px;
  color: white;
  width: 40px !important;
  height: 40px !important;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  text-transform: none !important;
  letter-spacing: 0;
  font-variant: initial;
  line-height: 1;
  background: #252322;
}

.swiper-button-next,
.swiper-button-prev {
  width: 40px !important;
  height: 40px !important;
}

.swiper-button-next {
  right: 29% !important;
}

.swiper-button-prev {
  left: 29% !important;
}
.swiper-button-next:after,
.swiper-button-prev:after {
  font-size: 16px !important;
}

/* ヘッダーのモバイルメニューアニメーション */

/* 初期状態：画面外（左側）に配置 */
.menu-enter {
  transform: translateX(100%);
  transition: transform 0.4s ease-in-out;
}

/* アニメーション完了状態：元の位置 */
.menu-enter-active {
  transform: translateX(0);
  transition: transform 0.4s ease-in-out;
}

/* 閉じるアニメーション：画面外（右側）へ */
.menu-exit {
  transform: translateX(100%);
  transition: transform 0.4s ease-in-out;
}

/* レスポンシブ背景サイズ用のカスタムクラス */
.bg-responsive {
  background-size: 140%;
}

@media (min-width: 768px) {
  .bg-responsive {
    background-size: cover;
  }
}

/* 利用規約ページのリストスタイル */
.bullet-dot {
  width: 4px;
  height: 4px;
  background-color: var(--color-primary-black);
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 0.6em;
}

.bullet-dot-white {
  width: 4px;
  height: 4px;
  background-color: var(--color-primary-white);
  border: 1px solid var(--color-primary-black);
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 0.6em;
}

.bullet-square {
  width: 8px;
  height: 8px;
  background-color: var(--color-primary-black);
  flex-shrink: 0;
  margin-top: 0.4em;
}

.section-border {
  border-bottom: 1px solid var(--color-secondary-pailgrey);
  padding-bottom: 2.5rem; /* pb-10 */
}

.section-border-padded {
  border-bottom: 1px solid var(--color-secondary-pailgrey);
  padding-top: 2.5rem; /* py-10 */
  padding-bottom: 2.5rem;
}

/* リストアイテム */
.list-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem; /* gap-2 */
}

/* セクションヘッダー */
.section-header {
  font-size: 1.125rem; /* text-lg */
  font-weight: 600; /* font-semibold */
  margin-bottom: 1rem; /* mb-4 */
}

/* Flatpickrカスタムスタイル */
.flatpickr-calendar {
  z-index: 9999 !important;
}

.flatpickr-time input::-webkit-outer-spin-button,
.flatpickr-time input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.flatpickr-time input[type="number"] {
  -moz-appearance: textfield;
}

/* スクロール時のオフセット設定 */
[id^="sell-request-"],
[id^="admin-"],
[id^="user-"],
[id^="product-"],
[id^="product-category-"],
[id^="product-sub-category-"],
[id^="coupon-"],
[id^="contact-"] {
  scroll-margin-top: 160px;
}

@media (hover: none) and (pointer: coarse) {
  input,
  input.text-xs,
  input.text-sm,
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="tel"],
  input[type="number"],
  textarea,
  textarea.text-xs,
  textarea.text-sm,
  select,
  select.text-xs,
  select.text-sm {
    font-size: 16px !important;
  }
}
