﻿/* =========================================================================
 * Popup 共通スタイル
 * ========================================================================= */

/* オーバーレイ（blocking 用） */
.m-popup-overlay {
  display: flex;
  justify-content: center;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 99999;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

/* blocking コンポーネント本体 */
.m-popup-blocking {
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: 90vw;
  max-height: 90vh;
  overflow: visible; /* visible にして外側の閉じるボタンを切らないようにする */
  background-color: #fff;
  border-radius: 8px;
}

.m-popup-blocking--full-screen {
  max-width: 100vw;
  max-height: 100vh;
  width: 100%;
  height: 100%;
  border-radius: 0;
}

.m-popup-blocking__content {
  position: relative; /* ::before 疑似要素の基準にするため */
  flex: 1;
  width: 100%;
  min-height: 0; /* flex 子要素で overflow: hidden が効くための必須指定 */
  overflow: hidden; /* 角丸からのコンテンツはみ出しを防ぐ（overflow を親から移管） */
  border-radius: inherit; /* 親の border-radius を引き継いでクリッピング */
}

.m-popup-blocking__close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 24px;
  line-height: 32px;
  color: #666;
  text-align: center;
  cursor: pointer;
  background: none;
  border: none;
}

/* non-blocking コンポーネント本体 */
.m-popup-non-blocking {
  position: fixed;
  z-index: 99998;
}

.m-popup-non-blocking--floating-bar {
  bottom: 0;
  left: 0;
  width: 100%;
}

.m-popup-non-blocking--slide-in {
  right: 0;
  bottom: 20px;
  max-width: 400px;
}

.m-popup-non-blocking__content {
  width: 100%;
  height: 100%;
}

.m-popup-non-blocking__close {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 16px;
  line-height: 24px;
  color: #666;
  text-align: center;
  cursor: pointer;
  background: none;
  border: none;
}

/* ポジション切替（slide-in） */
.m-popup-non-blocking--slide-in[data-position="left"] {
  right: auto;
  left: 0;
}

/* ポジション切替（floating-bar） */
.m-popup-non-blocking--floating-bar[data-position="top"] {
  bottom: auto;
  top: 0;
}

/* コンテンツブロック共通 */
.m-popup-contents {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 10px;
  overflow: auto;
}

/* フローティングバー: 高さ固定のため縦スクロール禁止（溢れたコンテンツは見切れる） */
.m-popup-non-blocking--floating-bar .m-popup-contents {
  overflow-y: hidden;
}

/* Half-image: 背景画像を半分に配置（::before 疑似要素） */
/* blocking: __content に ::before を配置（overflow: hidden + border-radius: inherit でクリップされる） */
/* non-blocking: 親に ::before を配置（non-blocking は overflow: visible にしていないため従来通り） */
.m-popup-blocking[data-bg-type^="image-"] > .m-popup-blocking__content::before,
.m-popup-non-blocking[data-bg-type^="image-"]::before {
  content: '';
  position: absolute;
  z-index: 0;
  background-image: var(--popup-bg-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.m-popup-blocking[data-bg-type="image-left"] > .m-popup-blocking__content::before,
.m-popup-non-blocking[data-bg-type="image-left"]::before {
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
}
.m-popup-blocking[data-bg-type="image-right"] > .m-popup-blocking__content::before,
.m-popup-non-blocking[data-bg-type="image-right"]::before {
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
}
.m-popup-blocking[data-bg-type="image-above"] > .m-popup-blocking__content::before,
.m-popup-non-blocking[data-bg-type="image-above"]::before {
  top: 0;
  left: 0;
  width: 100%;
  height: 50%;
}
.m-popup-blocking[data-bg-type="image-below"] > .m-popup-blocking__content::before,
.m-popup-non-blocking[data-bg-type="image-below"]::before {
  bottom: 0;
  left: 0;
  width: 100%;
  height: 50%;
}

/* Half-image: コンテンツを画像の反対側に配置 */
.m-popup-contents[data-bg-type="image-left"] {
  width: 50%;
  margin-left: 50%;
}
.m-popup-contents[data-bg-type="image-right"] {
  width: 50%;
  margin-right: 50%;
}
.m-popup-contents[data-bg-type="image-above"] {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 50%;
}
.m-popup-contents[data-bg-type="image-below"] {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
}
.m-popup-content-block {
  width: 100%;
  box-sizing: border-box;
}

/* テキストブロック */
.m-popup-content-block--text {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* 画像ブロック */
.m-popup-content-block--image img {
  max-width: 100%;
  height: auto;
  display: inline-block;
}

/* ボタンブロック */
.m-popup-content-block--button a,
.m-popup-content-block--button span {
  display: inline-block;
  padding: 10px 20px;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
}

/* スペースブロック */
.m-popup-content-block--space {
  width: 100%;
}

/* 区切り線ブロック */
.m-popup-content-block--line hr {
  margin: 0;
  border: none;
}

/* HTMLブロック */
.m-popup-content-block--html {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* 再度表示しないブロック */
.m-popup-content-block--dont-show {
  text-align: center;
}

.m-popup-dont-show {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.m-popup-dont-show__checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.m-popup-dont-show__label {
  font-size: 0.875em;
  color: inherit;
}
