@charset "utf-8";

/* ======================================================================
 * CSSカスタムプロパティ（変数）
 * ====================================================================== */
:root{
	--magenta: #d80084;
	--white: #fff;
	--dark-gray: #374151;
	--gray: #6b7280;
	--medium-gray: #9aa3b2;
	--soft-gray: #d1d5db;
	--light-gray: #e5e7eb;
	--pale-gray: #f3f4f6;
	--primary-dark: #1e40af;
	--primary: #1d4ed8;
	--primary-soft: #2563eb;
	--primary-light: #93c5fd;
	--primary-extra-light : #e0ecff;
	--primary-pale: #eff6ff;
	--danger: #d6002a;
	--danger-soft: #fca5a5;
	--danger-pale: #fef2f2;

	--bg-warning: #fef5f5;
	--text-warning: #991b1b;
	--border-preview: #fde68a;
	--bg-preview: #fffbeb;
	--text-preview: #92400e;
	--border-committed: #bbf7d0;
	--bg-committed: #f0fdf4;
	--text-committed: #166534;

	--card: var(--white);
	--text: var(--dark-gray);
	--text-light: var(--gray);
	--text-disabled: #9ca3af;

	--font-size-price: 2.4rem;
	--font-size-base: 1.4rem;
	--font-size-big: 1.8rem;
	--font-size-small: 1.3rem;
	--font-size-x-small: 1.2rem;
	--font-weight-normal: 400;
	--font-weight-bold: 600;

	--info-btn-size: 19px; /* iボタンの幅と高さ */
	--popover-offset-right: -70px; /* iボタンの中心からポップオーバーの中心を右にずらす量（要調整） */
	--popover-offset-right-tab: -20px;
	--popover-slide-distance: 8px; /* ポップオーバーが下から上にスライドする距離（要調整） */
}

/* ==========================================================================
   基本スタイルとユーティリティ
   ========================================================================== */

.fs-base {
	font-size: var(--font-size-base);
}

.section {
	color: var(--text);
}

.test {
	-webkit-appearance: checkbox !important;
	-moz-appearance: checkbox !important;
	appearance: checkbox !important;
}

.card {
	background: var(--card);
	border: 1px solid var(--soft-gray);
	border-radius: 10px;
	padding: 20px;
	box-shadow: 0 2px 8px rgba(0,0,0,.06);
	margin-bottom: 16px;
	position: relative;
}

.estimate-set {
	background: var(--card);
	border: 1px solid var(--soft-gray);
	border-radius: 10px;
	padding: 20px;
	margin-bottom: 24px;
}

.row {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
}

label {
	font-weight: var(--font-weight-bold);
}

.radioBox label {
	display: inline-block;
	margin-right: 24px;
}

/* iボタン */
.info-btn {
	margin-left: 0;
	width: var(--info-btn-size);
	height: var(--info-btn-size);
	border-radius: 50%;
	border: none;
	color: var(--white);
	background: var(--primary-soft);
	font-size: var(--font-size-small);
	font-weight: var(--font-weight-bold);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	position: relative;
	vertical-align: middle;
	line-height: 1;
}

/* ポップオーバー */
.info-popover {
	position: absolute;
	top: calc(var(--info-btn-size) + var(--popover-slide-distance));
	left: 50%;
	transform: translateX(calc(-50% + var(--popover-offset-right))) translateY(var(--popover-slide-distance));
	background: var(--dark-gray);
	color: var(--white);
	padding: 10px 12px;
	border-radius: 8px;
	font-size: var(--font-size-x-small);
	font-weight: var(--font-weight-normal);
	line-height: 1.5;

	max-width: 360px;
	min-width: 180px;
	width: max-content;

	box-shadow: 0 6px 16px rgba(0,0,0,0.15);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease-out, transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);

	z-index: 100;
	white-space: normal;
	text-align: left;
}

/* 表示状態 */
.info-popover.is-open {
	opacity: 1;
	pointer-events: auto;
	transform: translateX(calc(-50% + var(--popover-offset-right))) translateY(0);
}

/* 吹き出し三角 */
.info-popover::after {
	content: "";
	position: absolute;
	bottom: 100%;

	left: calc(50% - var(--popover-offset-right));
	transform: translateX(-50%);

	border-width: 6px;
	border-style: solid;
	border-color: transparent transparent var(--dark-gray) transparent;
	z-index: 101; /* ポップオーバー本体より少し高いz-indexを設定して確実に表示させる */
}

/* ガイダンス */
.guidance-text {
	font-size: var(--font-size-x-small);
	color: var(--text-light);
	line-height: 1.6;
	margin-top: 6px;
	margin-bottom: 12px;
	padding: 4px 0 4px 10px;
	border-left: 3px solid var(--medium-gray);
}
.guidance-text strong {
	font-weight: var(--font-weight-bold);
	color: var(--text);
}

/* ==========================================================================
   ボタン
   ========================================================================== */
.btn_base,
.btn_small {
	background: var(--primary);
	color: var(--white);
	border: none;
	border-radius: 8px;
	box-shadow: none;
	font-weight: var(--font-weight-bold);
	cursor: pointer;
}

.btn_base {
	padding: 10px 16px;
	font-size: var(--font-size-base);
}

.btn_small {
	padding: 8px 12px;
	font-size: var(--font-size-small);
}

.add-btn {
	background: var(--pale-gray);
	border: 1px solid var(--soft-gray);
	color: var(--text);
	border-radius: 10px;
}

.add-btn:hover{
	background: var(--light-gray);
	cursor: pointer;
	transform: translateY(-1px);
}

/* 見積セット削除ボタン */
.del-btn.is-danger {
	border: 1px solid var(--danger-soft);
	background: var(--white);
	color: var(--danger);
	font-size: var(--font-size-small);
	font-weight: var(--font-weight-bold);
	padding: 6px 10px;
	border-radius: 999px;
	cursor: pointer;
	line-height: 1;
}

.del-btn.is-danger:hover {
	background: var(--danger-pale);
	border-color: var(--danger-soft);
}

.del-btn.is-danger:active {
	transform: translateY(1px);
}

/* メインアクションボタン（見積更新） */
#calcBtn,
.btn.is-primary{
	background: var(--primary);
	color: var(--white);
	border: 1px solid transparent;
	box-shadow: 0 6px 14px rgba(29,78,216,.18);
}

#calcBtn:hover,
.btn.is-primary:hover{
	background: var(--primary-dark);
}

#calcBtn:active,
.btn.is-primary:active{
	transform: translateY(1px);
}

#resetBtn {
	background: var(--white);
	color: var(--danger);
	border: 1px solid var(--danger);
	border-radius: 10px;
}

/* リセットボタン */
#resetBtn:hover {
	background: var(--danger-pale);
	border-color: var(--danger-soft);
	color: var(--danger);
}

#resetBtn:active {
	transform: translateY(1px);
}

/* ==========================================================================
   アクションとレイアウト
   ========================================================================== */
.actions {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 24px;
	gap: 12px;
}

.actions-right {
	display: flex;
	gap: 12px;
	margin-left: auto;
}

/* ==========================================================================
   見積結果
   ========================================================================== */
.price {
	font-size: var(--font-size-price);
	font-weight: var(--font-weight-bold);
	color: var(--primary);
	margin: 10px 0 4px;
}

.notice {
	font-size: var(--font-size-base);
	line-height: 1.6;
	color: var(--text-light);
}

.notice-general {
	font-size: var(--font-size-small);
	margin-top: 4px;
	margin-bottom: 6px;
}

/* 未使用
.notice-general strong {
	color: var(--text);
	font-weight: var(--font-weight-bold);
}  */

.notice .notice-heading {
	font-size: 1.05em;
}

.notice.loading-message {
	color: var(--primary-soft);
	font-weight: var(--font-weight-bold);
	animation: pulse 1s infinite alternate;
}

/* 通知ボックス */
.notice-box {
	margin: 8px 0 24px;
	padding: 10px 14px;
	border-radius: 10px;
	font-size: var(--font-size-small);
	line-height: 1.4;
}

/* 未選択（警告）時の通知ボックススタイル */
.notice-box--dirty {
	border: 1px solid var(--danger-soft);
	background: var(--bg-warning);
	color: var(--text-warning);
}

/* プレビュー（自動更新）時の通知ボックススタイル */
.notice-box--preview {
	border: 1px solid var(--border-preview);
	background: var(--bg-preview);
	color: var(--text-preview);
}

/* 見積更新時の通知ボックススタイル */
.notice-box--committed {
	border: 1px solid var(--border-committed);
	background: var(--bg-committed);
	color: var(--text-committed);
}

@keyframes pulse {
	0% { opacity: 0.3; }
	100% { opacity: 1; }
}

hr.divider {
	border-width: 0 !important;
	height: 1px;
	background: var(--pale-gray);
	margin: 12px 0 10px;
}

/* ==========================================================================
   バッジ
   ========================================================================== */
.badge1,
.badge2,
.badge3 {
	display: inline-block;
	padding: 2px 10px;
	font-size: var(--font-size-x-small);
	border-radius: 999px;
	margin-left: 6px;
}
.badge1 {
	background: var(--light-gray);
}
.badge2 {
	color: var(--white);
	background: var(--magenta);
	font-weight: var(--font-weight-bold);
}
.badge3 {
	background: var(--primary-extra-light);
	color: var(--primary);
}

/* ハイライトラベル */
.hl,
.label.hl {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 8px;
}

.hl {
	font-weight: var(--font-weight-bold);
}

.hl small {
	font-size: var(--font-size-base);
/*	font-weight: var(--font-weight-normal); */
}

.hl .hl-label {
	font-size: var(--font-size-x-small);
	color: var(--primary-soft);
	border: 1px solid var(--primary-light);
	background: var(--primary-pale);
	padding: 2px 10px;
	border-radius: 999px;
	font-weight: var(--font-weight-bold);
}

/* ==========================================================================
   ライセンス選択
   ========================================================================== */
.licenseBox {
	margin-top: 16px;
}

.licenseRow {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
	margin-top: 0 !important;
}

.licenseOption {
	flex: 1;
	min-width: 280px;
	display: flex;
	align-items: flex-start;
	gap: 2px;
	border: 1px solid var(--light-gray);
	border-radius: 12px;
	padding: 12px;
	cursor: pointer;
	background: var(--white);
	font-weight: var(--font-weight-normal);
}

.licenseOption input {
	margin-top: 3px;
	accent-color: var(--primary-soft);
}

.license {
	display: flex;
	flex-direction: column;
}

.licenseText {
	margin-bottom: 2px;
	font-size: var(--font-size-base);
}

.licenseDesc {
	font-size: var(--font-size-base);
	color: var(--text-light);
	line-height: 1.4;
}

/* 選択されているライセンスオプションのスタイル */
.licenseOption:has(input:checked) {
	border-color: var(--primary-light);
	background: var(--primary-pale);
}

.licenseOption input:checked + .license {
	color: var(--primary);
}

.licenseOption input:checked {
	accent-color: var(--primary-soft);
}

/* 無効化されたライセンスオプションのスタイル */
.licenseOption.is-disabled {
	pointer-events: none;
	opacity: 0.7;
	cursor: not-allowed;
	background-color: var(--pale-gray) !important;
	border-color: var(--soft-gray) !important;
}

.licenseOption.is-disabled .licenseText,
.licenseOption.is-disabled .licenseDesc {
	color: var(--text-disabled) !important;
}

.licenseOption.is-disabled input[type="radio"] {
	cursor: not-allowed;
	accent-color: var(--soft-gray) !important;
}

/* 無効化された状態でチェックされていても選択強調色は適用しない */
.licenseOption.is-disabled input:checked + .license {
	color: var(--text-disabled) !important;
}

/* ==========================================================================
   フォーム要素
   ========================================================================== */
select {
	height: 40px;
	width: 100%;
	font-size: var(--font-size-base);
	border-radius: 8px;
	border: 1px solid var(--soft-gray);
	box-sizing: border-box;
	padding: 8px 10px;
	background: var(--white);
}

/* フォーム要素のフォーカス時スタイル */
select:focus {
	outline: none;
	border-color: var(--primary-light);
	box-shadow: 0 0 0 2px rgba(147, 197, 253, 0.3);
}

input[type="checkbox"],
input[type="radio"]{
	accent-color: var(--primary);
}

/* セット全体とのなじみ */
.estimate-set select {
	background-color: var(--white);
}

/* 製品と数量のレイアウト */
.productRow {
	display: flex;
	gap: 12px;
	align-items: flex-start;
}

.productCol {
	flex: 1.6;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 0;
}

.qtyCol {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 0;
}

/* ラベルとiボタンのグループ */
.qty-label-group {
	display: flex;
	align-items: baseline;
	gap: 0;
	flex-wrap: wrap;
}

/* ==========================================================================
   数量入力フィールドのプラス・マイナスボタン
   ========================================================================== */
.qty-input-group {
	display: flex;
	align-items: stretch;
	width: 100%;
	border: 1px solid var(--soft-gray);
	border-radius: 8px;
	background: var(--white);
	box-sizing: border-box;
	height: 40px;
}

.qty-input-group input[type="number"] {
	flex-grow: 1;
	width: auto;
	border: none;
	text-align: center;
	padding: 0;
	font-size: var(--font-size-base);
	-moz-appearance: textfield;
}

.qty-input-group input[type="number"]::-webkit-outer-spin-button,
.qty-input-group input[type="number"]::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.qty-btn {
	background-color: var(--pale-gray);
	border: none;
	color: var(--text);
	font-size: var(--font-size-big);
	font-weight: var(--font-weight-bold);
	padding: 0 12px;
	cursor: pointer;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
}

.qty-btn:hover {
	background-color: var(--light-gray);
}

.qty-btn:active {
	background-color: var(--soft-gray);
	transform: translateY(1px);
}

.qty-btn.qty-minus {
	border-top-left-radius: 7px;
	border-bottom-left-radius: 7px;
}

.qty-btn.qty-plus {
	border-top-right-radius: 7px;
	border-bottom-right-radius: 7px;
}

.qty-input-group input[type="number"]:focus {
	outline: none;
	box-shadow: none;
}
.qty-input-group:focus-within {
	border-color: var(--primary-light);
	box-shadow: 0 0 0 2px rgba(147, 197, 253, 0.3);
}

/* ==========================================================================
   見積セットヘッダー
   ========================================================================== */
.setHeader {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	margin-bottom: 12px;
	font-size: var(--font-size-big);
	font-weight: var(--font-weight-bold);
}

/* ==========================================================================
   見積結果表示エリア
   ========================================================================== */
#espotArea, #ewideArea {
	background: var(--card);
	border-radius: 12px;
	box-shadow: 1px 1px 0 0 rgba(0,0,0,0.06);
	line-height: 1.6;
}

/* ==========================================================================
   メディアクエリ (レスポンシブ対応)
   ========================================================================== */

@media only screen and (max-width: 768px) {
	.info-popover {
		transform: translateX(calc(-50% + var(--popover-offset-right-tab))) translateY(var(--popover-slide-distance));
	}

	.productRow {
		flex-direction: column;
		gap: 0;
		align-items: stretch;
	}
	.productCol,
	.qtyCol {
		flex: none;
		width: 100%;
		margin-bottom: 20px;
	}
	.qtyCol:last-child {
		margin-bottom: 0;
	}
}

@media (max-width: 640px){
	.actions {
		flex-direction: column;
		align-items: stretch;
	}
	.actions-right {
		width: 100%;
		justify-content: stretch;
	}
	.actions-right .btn {
		flex: 1;
	}
	.licenseOption {
		min-width: 0;
		flex-basis: 100%;
	}
	.hl-label {
		display: none;
	}
}

@media (max-width: 480px){
	.card {
		padding: 20px 14px;
	}
	.estimate-set {
		padding: 20px 14px;
	}
	.del-btn.is-danger {
		font-size: var(--font-size-x-small);
	}
	.info-popover {
		transform: translateX(calc(-50% + var(--popover-offset-right))) translateY(var(--popover-slide-distance));
		max-width: 280px;
	}
}
