/*
 * Activity Booking - フロントエンドスタイル
 * BEM命名・モバイルファースト・テーマ非依存（リセット寄りの実装）
 */

.ab-booking {
	--ab-primary: #2271b1;
	--ab-text: #1d2327;
	--ab-muted: #646970;
	--ab-border: #dcdcde;
	--ab-bg: #ffffff;
	--ab-bg-soft: #f6f7f7;
	--ab-danger: #d63638;
	--ab-success: #00a32a;
	--ab-warning: #dba617;

	box-sizing: border-box;
	max-width: 720px;
	margin: 0 auto;
	font-size: 16px;
	line-height: 1.6;
	color: var(--ab-text);
	background: var(--ab-bg);
}

.ab-booking *,
.ab-booking *::before,
.ab-booking *::after {
	box-sizing: inherit;
}

/* ステップナビゲーション */
.ab-progress-vehicle {
	position: relative;
	height: 58px;
	margin: 0 8px 2px;
	--ab-step-left: 7%;
}

.ab-booking:not(.has-activity) .ab-progress-vehicle {
	display: none;
}

.ab-booking.is-target-selection .ab-progress-vehicle {
	display: none;
}

.ab-progress-vehicle__track {
	position: absolute;
	left: 7%;
	right: 7%;
	top: 50%;
	height: 2px;
	background: var(--ab-border);
	transform: translateY(-50%);
}

/* 自転車用の道路：ゆるい遠近感のある台形 */
.ab-booking.is-bicycle .ab-progress-vehicle__track {
	left: 2%;
	right: 2%;
	top: 50%;
	height: 32px;
	background: #b9d5c9;
	border-radius: 2px;
	transform: translateY(-5%);
	clip-path: polygon(5% 0, 100% 0, 95% 100%, 0 100%);
	filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.16));
	z-index: 0;
}

.ab-booking.is-bicycle .ab-progress-vehicle__track::before {
	content: "";
	position: absolute;
	inset: 3px 2%;
	background: repeating-linear-gradient(135deg, transparent 0 18px, rgba(255, 255, 255, 0.62) 18px 21px, transparent 21px 39px);
	clip-path: polygon(4% 0, 100% 0, 96% 100%, 0 100%);
}

/* カヌー用の水面 */
.ab-booking.is-canoe .ab-progress-vehicle__track {
	left: 2%;
	right: 2%;
	top: 50%;
	height: 32px;
	background-color: #9bd7e5;
	background-image: none;
	border-radius: 2px;
	transform: translateY(-5%);
	clip-path: polygon(5% 0, 100% 0, 95% 100%, 0 100%);
	filter: drop-shadow(0 2px 1px rgba(0, 90, 120, 0.18));
	z-index: 0;
}

.ab-progress-vehicle__wave {
	display: none;
	position: absolute;
	height: 10px;
	background-repeat: no-repeat;
	background-size: 100% 100%;
	transform-origin: center;
}

.ab-booking.is-canoe .ab-progress-vehicle__wave {
	display: block;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='10' viewBox='0 0 100 10'%3E%3Cpath d='M0 6 Q8 0 16 6 T32 6 T48 6 T64 6 T80 6 T96 6' fill='none' stroke='%23ffffff' stroke-opacity='.62' stroke-width='1.5'/%3E%3C/svg%3E");
}

.ab-booking.is-canoe .ab-progress-vehicle__wave--one {
	left: 8%;
	top: 6px;
	width: 23%;
	transform: rotate(-2deg);
}

.ab-booking.is-canoe .ab-progress-vehicle__wave--two {
	left: 36%;
	top: 18px;
	width: 29%;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='10' viewBox='0 0 100 10'%3E%3Cpath d='M0 5 Q9 10 18 5 T36 5 T54 5 T72 5 T90 5' fill='none' stroke='%23ffffff' stroke-opacity='.52' stroke-width='1.5'/%3E%3C/svg%3E");
	transform: rotate(1deg);
}

.ab-booking.is-canoe .ab-progress-vehicle__wave--three {
	left: 70%;
	top: 7px;
	width: 19%;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='10' viewBox='0 0 100 10'%3E%3Cpath d='M0 6 Q10 1 20 6 T40 6 T60 6 T80 6 T100 6' fill='none' stroke='%23ffffff' stroke-opacity='.58' stroke-width='1.5'/%3E%3C/svg%3E");
	transform: rotate(-1deg);
}

.ab-progress-vehicle__image {
	position: absolute;
	left: var(--ab-step-left);
	top: 50%;
	display: block;
	width: clamp(56px, 13vw, 96px);
	height: 52px;
	object-fit: contain;
	object-position: center;
	transform: translate(-50%, -50%);
	transition: left 0.45s cubic-bezier(0.22, 1, 0.36, 1);
	filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.14));
	z-index: 1;
}

.ab-progress-vehicle__image.is-loading {
	visibility: hidden;
}

.ab-progress-vehicle__image--canoe {
	display: none;
}

.ab-booking.is-canoe .ab-progress-vehicle__image--bicycle {
	display: none;
}

.ab-booking.is-canoe .ab-progress-vehicle__image--canoe {
	display: block;
}

.ab-booking.is-none .ab-progress-vehicle__image {
	display: none;
}

.ab-booking.is-none .ab-progress-vehicle {
	display: none;
}

.ab-steps {
	display: flex;
	flex-wrap: wrap;
	list-style: none;
	margin: 0 0 24px;
	padding: 0;
	gap: 4px;
}

.ab-steps__item {
	flex: 1 1 auto;
	min-width: 64px;
	text-align: center;
	font-size: 12px;
	color: var(--ab-muted);
	padding: 8px 4px;
	border-bottom: 3px solid var(--ab-border);
}

.ab-steps__item.is-active {
	color: var(--ab-primary);
	border-bottom-color: var(--ab-primary);
	font-weight: bold;
}

.ab-steps__item.is-done {
	color: var(--ab-success);
	border-bottom-color: var(--ab-success);
}

/* メッセージ */
.ab-booking__message {
	background: #fcf0f1;
	border-left: 4px solid var(--ab-danger);
	padding: 12px 16px;
	margin-bottom: 16px;
}

/* ステップ */
.ab-step {
	display: none;
}

.ab-step.is-active {
	display: block;
	animation: ab-fade-in 0.2s ease;
}

@keyframes ab-fade-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

.ab-step__title {
	font-size: 18px;
	margin: 0 0 16px;
}

.ab-step__actions {
	display: flex;
	gap: 12px;
	margin-top: 24px;
	flex-wrap: wrap;
}

@media (prefers-reduced-motion: reduce) {
	.ab-progress-vehicle__image,
	.ab-step.is-active {
		transition: none;
		animation: none;
	}
}

/* ボタン（タップしやすい44px以上を確保） */
.ab-btn {
	appearance: none;
	border: 1px solid var(--ab-primary);
	background: var(--ab-primary);
	color: #fff;
	padding: 12px 24px;
	min-height: 44px;
	border-radius: 6px;
	font-size: 15px;
	cursor: pointer;
	touch-action: manipulation;
}

.ab-btn--ghost {
	background: transparent;
	color: var(--ab-primary);
}

.ab-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* 予約対象カード（グリッド） */
.ab-item-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: 12px;
}

.ab-item-card {
	appearance: none;
	border: 2px solid var(--ab-border);
	background: var(--ab-bg);
	border-radius: 8px;
	padding: 0;
	overflow: hidden;
	cursor: pointer;
	text-align: left;
	min-height: 44px;
}

.ab-item-card.is-selected {
	border-color: var(--ab-primary);
}

.ab-item-card__image img {
	display: block;
	width: 100%;
	height: auto;
}

.ab-item-card__body {
	display: block;
	padding: 10px 12px;
}

.ab-item-card__category {
	display: block;
	font-size: 11px;
	color: var(--ab-muted);
}

.ab-item-card__name {
	display: block;
	font-weight: bold;
	margin: 2px 0;
}

.ab-item-card__price {
	display: block;
	color: var(--ab-primary);
	font-size: 14px;
}

/* カレンダー */
.ab-calendar__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 8px;
}

.ab-calendar__nav,
.ab-calendar__today {
	min-height: 40px;
	min-width: 40px;
	border: 1px solid var(--ab-border);
	background: var(--ab-bg);
	border-radius: 6px;
	cursor: pointer;
	font-size: 16px;
}

.ab-calendar__month {
	font-weight: bold;
}

.ab-calendar__weekdays,
.ab-calendar__grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 4px;
	text-align: center;
}

.ab-calendar__weekday {
	font-size: 12px;
	color: var(--ab-muted);
	padding: 4px 0;
}

.ab-calendar__weekday--sun { color: var(--ab-danger); }
.ab-calendar__weekday--sat { color: var(--ab-primary); }

.ab-cal-day {
	appearance: none;
	border: 1px solid var(--ab-border);
	background: var(--ab-bg);
	border-radius: 6px;
	min-height: 48px;
	padding: 4px 2px;
	cursor: pointer;
	font-size: 13px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
}

.ab-cal-day__status {
	font-size: 10px;
}

.ab-cal-day--available .ab-cal-day__status { color: var(--ab-success); }
.ab-cal-day--few .ab-cal-day__status { color: var(--ab-warning); }
.ab-cal-day--full { opacity: 0.6; }
.ab-cal-day--full .ab-cal-day__status { color: var(--ab-danger); }

.ab-cal-day--closed,
.ab-cal-day--empty {
	background: var(--ab-bg-soft);
	color: var(--ab-muted);
	cursor: not-allowed;
}

.ab-cal-day.is-selected {
	border-color: var(--ab-primary);
	border-width: 2px;
}

.ab-legend {
	display: inline-flex;
	align-items: center;
	font-size: 12px;
	margin-right: 12px;
	color: var(--ab-muted);
}

.ab-legend::before {
	content: '';
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	margin-right: 4px;
}

.ab-legend--available::before { background: var(--ab-success); }
.ab-legend--few::before { background: var(--ab-warning); }
.ab-legend--full::before { background: var(--ab-danger); }
.ab-legend--closed::before { background: var(--ab-muted); }

.ab-calendar__legend {
	margin-top: 12px;
}

/* 時間帯選択 */
.ab-slot-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
	gap: 10px;
	margin-bottom: 24px;
}

.ab-slot {
	appearance: none;
	border: 2px solid var(--ab-border);
	background: var(--ab-bg);
	border-radius: 8px;
	padding: 12px 8px;
	min-height: 56px;
	cursor: pointer;
	text-align: center;
}

.ab-slot.is-selected {
	border-color: var(--ab-primary);
}

.ab-slot:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.ab-slot__time {
	display: block;
	font-weight: bold;
	font-size: 16px;
}

.ab-slot__remaining {
	display: block;
	font-size: 12px;
	color: var(--ab-muted);
}

/* フォーム */
.ab-field {
	margin-bottom: 16px;
}

.ab-field label {
	display: block;
	font-weight: bold;
	margin-bottom: 4px;
	font-size: 14px;
}

.ab-field__pair {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr);
	gap: 8px;
	align-items: center;
}

.ab-field__pair > span {
	font-size: 14px;
	white-space: nowrap;
}

.ab-step__description,
.ab-field__note {
	font-size: 13px;
	line-height: 1.6;
	color: var(--ab-muted);
}

.ab-field__note {
	margin: 6px 0 0;
}

[data-ab-item-notes] {
	padding: 10px 12px;
	border-left: 3px solid var(--ab-primary);
	background: var(--ab-bg-soft);
	white-space: pre-line;
}

.ab-field input[type="text"],
.ab-field input[type="email"],
.ab-field input[type="tel"],
.ab-field input[type="number"],
.ab-field select,
.ab-field textarea {
	width: 100%;
	min-height: 44px;
	padding: 10px 12px;
	border: 1px solid var(--ab-border);
	border-radius: 6px;
	font-size: 15px;
	background: var(--ab-bg);
	color: var(--ab-text);
}

.ab-field.is-invalid > label,
.ab-field.is-invalid > .ab-field__pair > span {
	color: var(--ab-danger);
}

.ab-field input.is-invalid,
.ab-field select.is-invalid,
.ab-field textarea.is-invalid {
	border-color: var(--ab-danger);
	box-shadow: 0 0 0 1px var(--ab-danger);
}

.ab-field input.is-invalid:focus,
.ab-field select.is-invalid:focus,
.ab-field textarea.is-invalid:focus {
	border-color: var(--ab-danger);
	box-shadow: 0 0 0 1px var(--ab-danger);
	outline: 2px solid var(--ab-danger);
	outline-offset: 0;
}

.ab-field--checkbox.is-invalid label {
	color: var(--ab-danger);
}

.ab-field--checkbox.is-invalid input {
	outline: 2px solid var(--ab-danger);
	outline-offset: 2px;
}

.ab-slot-list.is-invalid {
	border: 0;
}

.ab-slot-list.is-invalid .ab-slot {
	border-color: var(--ab-danger);
	box-shadow: 0 0 0 1px var(--ab-danger);
}

.ab-field--checkbox label {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: normal;
}

.ab-required {
	color: var(--ab-danger);
}

.ab-terms {
	border: 1px solid var(--ab-border);
	border-radius: 6px;
	padding: 12px;
	max-height: 160px;
	overflow-y: auto;
	margin-bottom: 16px;
	font-size: 13px;
}

/* オプション */
.ab-option {
	display: flex;
	align-items: center;
	justify-content: space-between;
	border: 1px solid var(--ab-border);
	border-radius: 6px;
	padding: 10px 12px;
	margin-bottom: 8px;
}

.ab-option__price {
	color: var(--ab-muted);
	font-size: 13px;
}

/* 確認画面 */
.ab-confirm {
	margin: 0;
}

.ab-confirm__row {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 0;
	border-bottom: 1px solid var(--ab-border);
}

.ab-confirm__row dt {
	color: var(--ab-muted);
	font-weight: normal;
}

.ab-confirm__row dd {
	margin: 0;
	text-align: right;
	font-weight: bold;
}

.ab-confirm__row--total dd {
	color: var(--ab-primary);
	font-size: 20px;
}

/* 完了画面 */
.ab-complete {
	text-align: center;
	padding: 32px 0;
}

.ab-complete__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	border-radius: 50%;
	background: var(--ab-success);
	color: #fff;
	font-size: 32px;
	margin-bottom: 16px;
}

.ab-complete__code {
	font-size: 18px;
}

@media (min-width: 600px) {
	.ab-booking {
		font-size: 15px;
	}
}

@media (max-width: 599px) {
	.ab-steps {
		flex-wrap: wrap;
	}

	.ab-steps__item.is-mobile-hidden {
		display: none;
	}
}
