/**
 * andW Season Calendar — フロントエンド CSS
 * 動的な区分色は wp_add_inline_style() で別途出力される
 */

/* ==============================================================
 * コンテナ
 * ============================================================*/
.andw-season-container {
	max-width: 1200px;
	margin: 0 auto 2em;
	font-family: inherit;
}

/* ==============================================================
 * 凡例
 * ============================================================*/
.andw-season-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 16px;
	margin-bottom: 16px;
	font-size: 13px;
}

.andw-season-legend-item {
	display: flex;
	align-items: center;
	gap: 4px;
}

.andw-season-legend-color {
	width: 16px;
	height: 16px;
	border: 1px solid #ccc;
	border-radius: 2px;
	flex-shrink: 0;
}

.andw-season-legend-label {
	white-space: nowrap;
}

/* ==============================================================
 * カレンダーグリッド（デスクトップ）
 * ============================================================*/
.andw-season-calendars {
	display: grid;
	gap: 12px;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

@media (max-width: 1199px) {
	.andw-season-calendars {
		grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	}
}

@media (max-width: 899px) {
	.andw-season-calendars {
		grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	}
}

@media (max-width: 599px) {
	.andw-season-calendars {
		display: block;
	}
}

/* 列数キャップ */
.andw-season-calendars[data-max-cols="1"] {
	grid-template-columns: repeat(1, 1fr) !important;
}

.andw-season-calendars[data-max-cols="2"] {
	grid-template-columns: repeat(2, 1fr) !important;
}

.andw-season-calendars[data-max-cols="3"] {
	grid-template-columns: repeat(3, 1fr) !important;
}

.andw-season-calendars[data-max-cols="4"] {
	grid-template-columns: repeat(4, 1fr) !important;
}

/* ==============================================================
 * デスクトップ: Swiper ラッパーを Grid に透過
 * （form モードでは Swiper を維持するため除外）
 * ============================================================*/
@media (min-width: 600px) {
	.andw-season-container:not([data-mode="form"]) .andw-season-swiper {
		display: contents;
	}

	.andw-season-container:not([data-mode="form"]) .andw-season-swiper .swiper-wrapper {
		display: contents;
	}

	.andw-season-container:not([data-mode="form"]) .andw-season-swiper .swiper-slide {
		display: contents;
	}

	/* Swiper ナビゲーション非表示（通常モードのみ） */
	.andw-season-container:not([data-mode="form"]) .andw-season-swiper .swiper-button-prev,
	.andw-season-container:not([data-mode="form"]) .andw-season-swiper .swiper-button-next {
		display: none;
	}
}

/* ==============================================================
 * form モード: コンパクトカレンダー（常に Swiper）
 * PC: slidesPerView:3, モバイル: slidesPerView:1
 * ============================================================*/

/* フォームラベル幅の統一 */
@media (min-width: 768px) {
	.wpcf7-form p label {
		flex: 0 0 200px !important;
	}
}

/* 出発日フィールド: grid で ラベル+入力=1行目, カレンダー=全幅2行目 */
@media (min-width: 768px) {
	.form-row p:has(.andw-season-container) {
		display: grid !important;
		grid-template-columns: auto 1fr !important;
		grid-template-rows: auto auto;
		align-items: center;
	}

	.form-row p:has(.andw-season-container) > label {
		grid-column: 1;
		grid-row: 1;
		text-align: right;
		padding-right: 0.5em;
		align-self: center;
		white-space: nowrap;
		min-width: 200px;
	}

	.form-row p:has(.andw-season-container) > br {
		display: none;
	}

	.form-row p:has(.andw-season-container) > .wpcf7-form-control-wrap {
		grid-column: 2;
		grid-row: 1;
	}

	.form-row p:has(.andw-season-container) > .andw-season-container {
		grid-column: 1 / -1; /* 全幅ぶち抜き */
		grid-row: 2;
		margin-top: 0.5em;
		width: 100%;
		box-sizing: border-box;
		overflow: visible;
	}

	.form-row p:has(.andw-season-container) > .andw-season-change-date {
		grid-column: 1 / -1;
		justify-self: center;
		margin-top: 0.5em;
	}
}

.andw-season-container[data-mode="form"] {
	width: 100%;
	margin-top: 0.5em;
}

.andw-season-container[data-mode="form"] .andw-season-calendars {
	display: block;
	position: relative;
	max-width: 100%;
	padding: 0 36px; /* 矢印分の余白 */
	box-sizing: border-box;
}

.andw-season-container[data-mode="form"] .andw-season-toggle-btn {
	display: none !important;
}

.andw-season-container[data-mode="form"] .andw-season-legend {
	display: none !important;
}

.andw-season-container[data-mode="form"] .andw-season-avail-note,
.form-row p.andw-season-avail-note {
	display: none !important;
}

.andw-season-container[data-mode="form"] > .andw-season-calendars > .swiper-button-prev,
.andw-season-container[data-mode="form"] > .andw-season-calendars > .swiper-button-next {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 28px;
	height: 28px;
	color: #666;
	z-index: 10;
	cursor: pointer;
}

.andw-season-container[data-mode="form"] > .andw-season-calendars > .swiper-button-prev::after,
.andw-season-container[data-mode="form"] > .andw-season-calendars > .swiper-button-next::after {
	font-size: 16px;
}

.andw-season-container[data-mode="form"] > .andw-season-calendars > .swiper-button-prev {
	left: 2px;
}

.andw-season-container[data-mode="form"] > .andw-season-calendars > .swiper-button-next {
	right: 2px;
}

/* --- form モード: セル・フォントを縮小 --- */
.andw-season-container[data-mode="form"] .andw-season-calendar-header {
	font-size: 12px;
	padding: 3px 0;
}

.andw-season-container[data-mode="form"] .andw-season-calendar table thead th {
	font-size: 10px;
	padding: 2px 0;
}

.andw-season-container[data-mode="form"] td.andw-season-cell {
	padding: 2px 1px;
	min-height: 20px;
}

.andw-season-container[data-mode="form"] .andw-season-cell .andw-season-day {
	font-size: 11px;
}

.andw-season-container[data-mode="form"] .andw-season-cell .andw-season-price {
	font-size: 9px;
}

/* --- form モード: ツールチップは上方向に表示（JS で制御） --- */

/* ==============================================================
 * 個別月カレンダー
 * ============================================================*/
.andw-season-calendar {
	border: 1px solid #ddd;
	border-radius: 4px;
	overflow: hidden;
	background: #fff;
	width: 100%;
	max-width: none;
}

.andw-season-calendar-header {
	text-align: center;
	font-weight: bold;
	padding: 5px 0;
	background: #f5f5f5;
	border-bottom: 1px solid #ddd;
	font-size: 14px;
}

.andw-season-calendar table {
	width: 100%;
	border-collapse: collapse;
	table-layout: fixed;
}

.andw-season-calendar table thead th {
	text-align: center;
	font-size: 11px;
	padding: 4px 0;
	color: #666;
	background: #fafafa !important;
	border-bottom: 1px solid #eee;
	font-weight: normal;
}

/* 土曜 */
.andw-season-calendar table thead th:nth-child(6) {
	color: #3366cc;
}

/* 日曜 */
.andw-season-calendar table thead th:nth-child(7) {
	color: #cc3333;
}

/* ==============================================================
 * SWELLテーマのtd/th全体スタイルをカレンダー内でリセット
 * ============================================================*/
.andw-season-calendar td,
.andw-season-calendar th {
	padding: 0;
	word-break: normal;
}

/* ==============================================================
 * セルベース
 * ============================================================*/
.andw-season-cell {
	position: relative;
	text-align: center;
	box-sizing: border-box;
	padding: 4px 2px;
	border: 1px solid rgba(255, 255, 255, 0.3);
	min-height: 28px;
	vertical-align: top;
}

/* PC・スマホ共通：上下余白を確保（特異度対策） */
.andw-season-calendar td.andw-season-cell {
	padding-top: 6px;
	padding-bottom: 6px;
}

.andw-season-cell--empty {
	background: transparent;
	border-color: transparent;
}

.andw-season-cell-number {
	font-size: 12px;
	line-height: 1.2;
	display: inline-block;
}

/* ==============================================================
 * 過去日付 — 斜め線
 * ============================================================*/
.andw-season-cell--past::after {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: linear-gradient(to bottom right,
			transparent calc(50% - 0.5px),
			rgba(0, 0, 0, 0.35) calc(50% - 0.5px),
			rgba(0, 0, 0, 0.35) calc(50% + 0.5px),
			transparent calc(50% + 0.5px));
	pointer-events: none;
}

/* ==============================================================
 * 今日ハイライト
 * ============================================================*/
.andw-season-cell--today {
	box-shadow: inset 0 0 0 2px #333;
}

.andw-season-cell--today .andw-season-cell-number {
	font-weight: bold;
}

/* ==============================================================
 * 残席マーク
 * ============================================================*/
.andw-season-cell-mark {
	position: absolute;
	bottom: 1px;
	right: 2px;
	font-size: 8px;
	line-height: 1;
	color: #fff;
	pointer-events: none;
}

/* ==============================================================
 * 残席マーク説明テキスト
 * ============================================================*/
.andw-season-avail-note {
	font-size: 12px;
	color: #666;
	margin: 4px 0 12px;
	line-height: 1.6;
}

/* ==============================================================
 * トグルボタン（モバイルのみ表示）
 * ============================================================*/
.andw-season-toggle-btn {
	display: none;
	width: 100%;
	margin-top: 12px;
	padding: 12px;
	border: 2px solid #3498db;
	border-radius: 6px;
	background: #ebf5fb;
	color: #2471a3;
	cursor: pointer;
	font-size: 14px;
	font-weight: bold;
	text-align: center;
}

.andw-season-toggle-btn:hover {
	background: #d4e6f1;
}

@media (max-width: 599px) {
	.andw-season-toggle-btn {
		display: block;
	}
}

/* ==============================================================
 * 「すべてを表示」時のスタイル
 * ============================================================*/
.andw-season-all-visible .swiper-wrapper {
	display: block !important;
	transform: none !important;
}

.andw-season-all-visible .swiper-slide {
	display: block !important;
	width: 100% !important;
}

.andw-season-all-visible .andw-season-calendar {
	margin-bottom: 12px;
}

.andw-season-all-visible .swiper-button-prev,
.andw-season-all-visible .swiper-button-next {
	display: none !important;
}

/* ==============================================================
 * モバイル: スライド内の月レイアウト（1列全幅表示）
 * ============================================================*/
@media (max-width: 599px) {

	/* 凡例をコンパクトに */
	.andw-season-legend {
		gap: 4px 8px;
		font-size: 12px;
	}

	.andw-season-legend-color {
		width: 12px;
		height: 12px;
	}

	.andw-season-swiper .swiper-slide {
		display: block;
	}

	.andw-season-calendar {
		width: 100%;
		max-width: 100%;
		margin-bottom: 8px;
	}

	/* タップターゲットサイズ拡大（iOS推奨44pxに近づける） */
	.andw-season-calendar td.andw-season-cell {
		padding-top: 8px;
		padding-bottom: 8px;
	}
}

/* ==============================================================
 * クリック可能セル
 * ============================================================*/
.andw-season-container[data-order-url] .andw-season-cell[data-date]:not(.andw-season-cell--past),
.andw-season-container[data-mode="form"] .andw-season-cell[data-date]:not(.andw-season-cell--past) {
	cursor: pointer;
}

.andw-season-container[data-order-url] .andw-season-cell[data-date]:not(.andw-season-cell--past):hover,
.andw-season-container[data-mode="form"] .andw-season-cell[data-date]:not(.andw-season-cell--past):hover {
	opacity: 0.8;
}

/* ==============================================================
 * form モード: 選択済みセル
 * ============================================================*/
.andw-season-cell--selected {
	box-shadow: inset 0 0 0 3px #2471a3 !important;
}

.andw-season-cell--selected .andw-season-cell-number {
	font-weight: bold;
}

/* ==============================================================
 * ツールチップ
 * ============================================================*/
.andw-season-container {
	position: relative;
}

.andw-season-tooltip {
	display: none;
	position: absolute;
	z-index: 100;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 6px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	padding: 12px;
	min-width: 180px;
	transform: translateX(-50%);
	text-align: center;
}

.andw-season-tooltip--visible {
	display: block;
}

.andw-season-tooltip-date {
	font-size: 13px;
	font-weight: bold;
	margin-bottom: 8px;
	color: #333;
}

.andw-season-tooltip-mark-message {
	font-size: 12px;
	font-weight: bold;
	color: #e67e22;
	margin-bottom: 8px;
}

.andw-season-tooltip-actions {
	display: flex;
	gap: 8px;
	justify-content: center;
}

.andw-season-tooltip-btn {
	display: inline-block;
	padding: 6px 14px;
	border-radius: 4px;
	font-size: 13px;
	text-decoration: none;
	font-weight: bold;
	white-space: nowrap;
}

.andw-season-tooltip-btn--order {
	background: #FC7905;
	color: #fff;
}

.andw-season-tooltip-btn--order:hover {
	background: #e06a00;
	color: #fff;
}

.andw-season-tooltip-btn--inquiry {
	background: #98C111;
	color: #fff;
}

.andw-season-tooltip-btn--inquiry:hover {
	background: #82a50e;
	color: #fff;
}

/* form モード: 「この日に決定」ボタン */
.andw-season-tooltip-btn--select {
	background: #2471a3;
	color: #fff;
	border: none;
	cursor: pointer;
}

.andw-season-tooltip-btn--select:hover {
	background: #1a5276;
	color: #fff;
}

/* ==============================================================
 * モバイル: ツールチップ拡大（タップしやすく）
 * ============================================================*/
@media (max-width: 599px) {
	.andw-season-tooltip {
		padding: 16px;
		min-width: 220px;
	}

	.andw-season-tooltip-date {
		font-size: 18px;
		margin-bottom: 10px;
	}

	.andw-season-tooltip-mark-message {
		font-size: 16px;
		margin-bottom: 10px;
	}

	.andw-season-tooltip-btn {
		padding: 10px 20px;
		font-size: 16px;
		border-radius: 6px;
	}
}

/* ==============================================================
 * タブ統合 [andw_season_tabs]
 * ============================================================*/
.andw-season-tabs {
	max-width: 1200px;
	margin: 0 auto 2em;
}

.andw-season-tabs__nav {
	display: flex;
	justify-content: center;
	gap: 0;
	margin-bottom: 0;
	overflow-x: auto;
	overflow-y: hidden;
	padding-bottom: 12px;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	/* Firefox */
}

.andw-season-tabs__nav::-webkit-scrollbar {
	display: none;
	/* Chrome / Safari */
}

.andw-season-tabs__tab {
	position: relative;
	flex: 0 0 auto;
	padding: 4px 12px 2px 12px;
	margin-right: 10px;
	border: none;
	border-bottom: 3px solid transparent;
	background: transparent;
	color: #666;
	font-size: 14px;
	font-weight: bold;
	cursor: pointer;
	white-space: nowrap;
	margin-bottom: -2px;
	transition: color 0.2s, border-color 0.2s, background 0.2s;
}

/* アクティブタブ下の三角マーク */
.andw-season-tabs__tab--active::after {
	content: '';
	position: absolute;
	bottom: -12px;
	left: 50%;
	transform: translateX(-50%);
	border-left: 12px solid transparent;
	border-right: 12px solid transparent;
	border-top: 12px solid currentColor;
}

/* hoverの時にも下三角を表示 */
.andw-season-tabs__tab:hover::after {
	content: '';
	position: absolute;
	bottom: -12px;
	left: 50%;
	transform: translateX(-50%);
	border-left: 12px solid transparent;
	border-right: 12px solid transparent;
	border-top: 12px solid currentColor;
}

.andw-season-tabs__tab[data-days="4"]:hover::after {
	border-top-color: #F58195;
}

.andw-season-tabs__tab[data-days="5"]:hover::after {
	border-top-color: #2CB1B1;
}

.andw-season-tabs__tab[data-days="6"]:hover::after {
	border-top-color: #B09221;
}

.andw-season-tabs__tab[data-days="7"]:hover::after {
	border-top-color: #29AA29;
}

.andw-season-tabs__tab[data-days="8"]:hover::after {
	border-top-color: #D62A20;
}

.andw-season-tabs__tab:hover {
	color: #333;
}

.andw-season-tabs__tab--active {
	color: #2471a3;
	border-bottom-color: #2471a3;
}

/* --------------------------------------------------------------
 * 日数別カラー（data-days 属性で切替）
 *
 * 色を変更したい場合はここの値を書き換えてください。
 * タブのアクティブ背景色 と パネル内テーブルヘッダーが連動します。
 *
 *   4日間 = #F58195（ピンク）
 *   5日間 = #2CB1B1（ティール）
 *   6日間 = #B09221（金色）
 *   7日間 = #29AA29（緑）
 *   8日間 = #D62A20（赤）
 * ------------------------------------------------------------*/

/* --- タブボタン: アクティブ時 --- */
.andw-season-tabs__tab--active[data-days="4"] {
	color: #fff;
	background: #F58195;
	border-bottom-color: #F58195;
}

.andw-season-tabs__tab--active[data-days="5"] {
	color: #fff;
	background: #2CB1B1;
	border-bottom-color: #2CB1B1;
}

.andw-season-tabs__tab--active[data-days="6"] {
	color: #fff;
	background: #B09221;
	border-bottom-color: #B09221;
}

.andw-season-tabs__tab--active[data-days="7"] {
	color: #fff;
	background: #29AA29;
	border-bottom-color: #29AA29;
}

.andw-season-tabs__tab--active[data-days="8"] {
	color: #fff;
	background: #D62A20;
	border-bottom-color: #D62A20;
}

/* --- タブボタン: アクティブ時の三角色 --- */
.andw-season-tabs__tab--active[data-days="4"]::after {
	border-top-color: #F58195;
}

.andw-season-tabs__tab--active[data-days="5"]::after {
	border-top-color: #2CB1B1;
}

.andw-season-tabs__tab--active[data-days="6"]::after {
	border-top-color: #B09221;
}

.andw-season-tabs__tab--active[data-days="7"]::after {
	border-top-color: #29AA29;
}

.andw-season-tabs__tab--active[data-days="8"]::after {
	border-top-color: #D62A20;
}

/* --- タブボタン: ホバー時 --- */
.andw-season-tabs__tab[data-days="4"]:hover {
	color: #fff;
	background: #F58195;
}

.andw-season-tabs__tab[data-days="5"]:hover {
	color: #fff;
	background: #2CB1B1;
}

.andw-season-tabs__tab[data-days="6"]:hover {
	color: #fff;
	background: #B09221;
}

.andw-season-tabs__tab[data-days="7"]:hover {
	color: #fff;
	background: #29AA29;
}

.andw-season-tabs__tab[data-days="8"]:hover {
	color: #fff;
	background: #D62A20;
}

/* --- パネル内 TablePress ヘッダー --- */
.andw-season-tabs__panel[data-days="4"] .tablepress thead th {
	background: #F58195 !important;
	color: #fff;
}

.andw-season-tabs__panel[data-days="5"] .tablepress thead th {
	background: #2CB1B1 !important;
	color: #fff;
}

.andw-season-tabs__panel[data-days="6"] .tablepress thead th {
	background: #B09221 !important;
	color: #fff;
}

.andw-season-tabs__panel[data-days="7"] .tablepress thead th {
	background: #29AA29 !important;
	color: #fff;
}

.andw-season-tabs__panel[data-days="8"] .tablepress thead th {
	background: #D62A20 !important;
	color: #fff;
}

.andw-season-tabs__panel {
	padding: 0;
}

.andw-season-tabs__panel[hidden] {
	display: none;
}

.andw-season-tabs__section {
	margin-bottom: 20px;
}

.andw-season-tabs__section:last-child {
	margin-bottom: 0;
}

@media (max-width: 599px) {
	.andw-season-tabs__tab {
		flex: 1 1 0;
		padding: 4px 8px 2px 8px;
		font-size: 13px;
		text-align: center;
	}

	.andw-season-tabs__panel {
		padding: 0;
	}

	/* テーブルヘッダーを中央揃え＋コンパクトに */
	.andw-season-tabs__panel .tablepress thead th {
		text-align: center;
		font-size: 13px;
	}

	/* 日数列を非表示 */
	.andw-season-tabs__panel .tablepress th:nth-child(1),
	.andw-season-tabs__panel .tablepress td:nth-child(1) {
		display: none;
	}

	/* fixed layoutに変えて列幅を明示制御 */
	.andw-season-tabs__panel .tablepress {
		table-layout: fixed;
	}

	/* 区分列: ぎゅっと絞める */
	.andw-season-tabs__panel .tablepress th:nth-child(2) {
		width: 36px;
		padding-left: 2px;
		padding-right: 2px;
		text-align: center;
		font-size: 10px;
		white-space: nowrap;
	}

	.andw-season-tabs__panel .tablepress td:nth-child(2) {
		width: 36px;
		padding-left: 2px;
		padding-right: 2px;
		text-align: center;
	}

	/* 旅行代金列: 折り返さない */
	.andw-season-tabs__panel .tablepress th:nth-child(4),
	.andw-season-tabs__panel .tablepress td:nth-child(4) {
		width: 90px;
		white-space: nowrap;
		text-align: right;
	}

	/* 期間列: 残り幅を使い、フォントを少し小さく */
	.andw-season-tabs__panel .tablepress th:nth-child(3),
	.andw-season-tabs__panel .tablepress td:nth-child(3) {
		font-size: 11px;
		line-height: 1.5;
	}
}

/* ==============================================================
 * 終了メッセージ
 * ============================================================*/
.andw-season-end-message {
	text-align: center;
	font-size: 1rem;
	color: #e65100;
	font-weight: bold;
	margin-top: 16px;
	padding: 12px;
	background: #fff3e0;
	border: 2px solid #ff9800;
	border-radius: 4px;
}

/* ==============================================================
 * form モード: 日付変更リンク
 * ============================================================*/
.andw-season-change-date {
	margin-top: 0.5em;
	margin-bottom: 8px;
	font-size: 13px;
	text-align: center;
}

.andw-season-change-date__link {
	display: inline-block;
	padding: 4px 12px;
	background: #e3f2fd;
	border: 1px solid #90caf9;
	border-radius: 4px;
	color: #1976d2;
	text-decoration: none;
}

.andw-season-change-date__link:hover {
	color: #0d47a1;
}