/**
 * andW Lively Badge — フロントエンドスタイル
 *
 * JS無効時は .andw-badge と .andw-toast を display:none で非表示にする。
 * JSが読み込まれると js-enabled クラスを html 要素に付与し、表示に切り替える。
 */

/* JS無効時: バッジ・トーストを非表示 */
.andw-badge,
.andw-toast {
	display: none;
}

/* JS有効時: バッジ表示 */
.js-enabled .andw-badge {
	display: inline-block;
	padding: var(--andw-badge-padding, 4px 10px);
	border-radius: var(--andw-badge-radius, 4px);
	background-color: var(--andw-badge-bg, #fff3cd);
	border: 1px solid var(--andw-badge-border, #ffc107);
	color: var(--andw-badge-color, #664d03);
	font-size: var(--andw-badge-font-size, 0.85em);
	font-weight: 600;
	line-height: 1.4;
	vertical-align: middle;
}

/* バッジ内セクション */
.andw-badge__section {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
}

.andw-badge__section + .andw-badge__section {
	margin-top: 2px;
}

/* バッジ内アイコン */
.andw-badge .andw-badge__icon {
	margin-right: 4px;
}

/* バッジ内カウント数を強調 */
.andw-badge .andw-badge__count {
	font-size: 1.1em;
	font-weight: 700;
	color: var(--andw-badge-count-color, inherit);
}

/* ===== トースト ===== */

/* JS有効時: トーストのベーススタイル（左下スライドイン） */
.js-enabled .andw-toast {
	display: block;
	position: fixed;
	bottom: calc(var(--andw-toast-bottom, 16px) + env(safe-area-inset-bottom, 0px));
	left: var(--andw-toast-left, 16px);
	z-index: var(--andw-toast-z-index, 9999);
	max-width: var(--andw-toast-max-width, 320px);
	width: calc(100vw - 32px);
	background-color: var(--andw-toast-bg, #fff);
	border: 1px solid var(--andw-toast-border, #dee2e6);
	border-radius: var(--andw-toast-radius, 8px);
	box-shadow: var(--andw-toast-shadow, 0 4px 12px rgba(0, 0, 0, 0.15));
	padding: 12px 40px 12px 16px; /* 右側に閉じるボタン分の余白 */
	font-size: var(--andw-toast-font-size, 1rem);
	line-height: 1.5;
	color: var(--andw-toast-color, #212529);

	/* スライドイン初期状態: 左外へ */
	transform: translateX(calc(-100% - 32px));
	opacity: 0;
	transition: transform 0.35s ease, opacity 0.35s ease;
	pointer-events: none;
}

/* トースト表示状態 */
.js-enabled .andw-toast.andw-toast--visible {
	transform: translateX(0);
	opacity: 1;
	pointer-events: auto;
}

/* トーストのフェードアウト */
.js-enabled .andw-toast.andw-toast--hiding {
	transform: translateX(calc(-100% - 32px));
	opacity: 0;
}

/* トースト内セクション */
.andw-toast__section + .andw-toast__section {
	margin-top: 4px;
	padding-top: 4px;
	border-top: 1px solid var(--andw-toast-section-border, transparent);
}

/* トースト内カウント強調 */
.andw-toast .andw-badge__count {
	font-weight: 700;
	color: var(--andw-toast-count-color, #d45200);
}

/* 閉じるボタン */
.andw-toast__close {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 44px;
	height: 44px;
	padding: 0;
	border: none;
	background: transparent;
	cursor: pointer;
	font-size: 18px;
	line-height: 1;
	color: #6c757d;
	display: flex;
	align-items: center;
	justify-content: center;
}

.andw-toast__close:hover {
	color: #212529;
}

/* ===== プロモーションバッジ ===== */

/* プロモーション行: 1カテゴリ = 1行 */
.andw-promo-line {
	display: flex;
	align-items: center;
	gap: 4px;
	line-height: 1.5;
}

/* プロモーションアイコン */
.andw-promo-line__icon {
	flex-shrink: 0;
}

/* プロモーションテキスト: フェードローテーション用 */
.andw-promo-line__text {
	transition: opacity 0.2s ease;
}

/* ===== マッチングセクション ===== */

.andw-matching__cta {
	display: inline-block;
	margin-top: 2px;
	color: var(--andw-matching-cta-color, #0073aa);
	text-decoration: underline;
	font-size: 0.9em;
}

.andw-matching__cta:hover {
	color: var(--andw-matching-cta-hover-color, #005177);
}

/* ===== アクセシビリティ ===== */
@media (prefers-reduced-motion: reduce) {
	.js-enabled .andw-toast {
		transition: opacity 0.2s ease;
		transform: none;
	}
	.js-enabled .andw-toast.andw-toast--hiding {
		transform: none;
	}
}
