/**
 * モルックトーナメント表ジェネレーター - 専用スタイル
 * （共通スタイルは molkky-common.css を参照）
 */

/* ========================================
   大会形式カード
   ======================================== */
.format-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 10px;
}

.format-card {
	display: block;
	cursor: pointer;
	margin: 0;
	position: relative;
}

.format-card input[type="radio"] {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.format-card-content {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 14px 10px;
	background: var(--color-bg);
	border: 2px solid var(--color-border);
	border-radius: var(--radius);
	transition: all 0.2s ease;
	text-align: center;
	height: 100%;
}

.format-card:hover .format-card-content {
	border-color: #43a047;
	background: var(--color-white);
}

.format-card input[type="radio"]:checked+.format-card-content {
	border-color: #2e7d32;
	background: linear-gradient(135deg, #f1f8e9 0%, #fff 100%);
	box-shadow: 0 2px 8px rgba(46, 125, 50, 0.15);
}

.format-card-name {
	font-family: var(--font-display);
	font-size: 15px;
	font-weight: 700;
	color: #2e7d32;
}

.format-card-detail {
	font-size: 11px;
	color: var(--color-text-secondary);
	line-height: 1.4;
}

.format-card-badge {
	display: inline-block;
	padding: 3px 8px;
	margin-top: 4px;
	font-size: 10px;
	color: var(--color-white);
	background: linear-gradient(135deg, #66bb6a 0%, #43a047 100%);
	border-radius: 10px;
	align-self: center;
}

/* ========================================
   チーム入力
   ======================================== */
.teams-input {
	width: 100%;
	padding: 12px 14px;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.7;
	color: var(--color-text);
	background: var(--color-bg);
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	resize: vertical;
	min-height: 140px;
}

.teams-input:focus {
	outline: none;
	border-color: #2e7d32;
}

.teams-count {
	margin-top: 8px;
	font-size: 13px;
	color: var(--color-text-secondary);
	text-align: right;
}

.teams-count span {
	font-family: var(--font-display);
	font-weight: 700;
	color: #2e7d32;
}

/* ========================================
   シード順選択
   ======================================== */
.seed-row {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.seed-option {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	background: var(--color-bg);
	border: 1px solid var(--color-border);
	border-radius: 20px;
	font-size: 13px;
	color: var(--color-text);
	cursor: pointer;
	transition: all 0.2s ease;
}

.seed-option:hover {
	border-color: #43a047;
}

.seed-option input[type="radio"] {
	margin: 0;
	cursor: pointer;
}

.seed-option input[type="radio"]:checked+span {
	color: #2e7d32;
	font-weight: 700;
}

/* ========================================
   生成ボタン
   ======================================== */
.btn-generate {
	width: 100%;
	padding: 18px;
	font-size: 17px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	background: linear-gradient(135deg, #43a047 0%, #2e7d32 100%);
	border: none;
	color: var(--color-white);
	border-radius: var(--radius);
	cursor: pointer;
	transition: all 0.2s ease;
}

.btn-generate:hover {
	background: linear-gradient(135deg, #388e3c 0%, #1b5e20 100%);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(46, 125, 50, 0.3);
}

.generate-icon {
	font-size: 20px;
}

/* ========================================
   概要サマリー
   ======================================== */
.summary-section {
	padding: 16px 20px;
	background: #f1f8e9;
	border-top: 1px solid var(--color-border);
}

.summary-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
}

.summary-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	padding: 10px;
	background: var(--color-white);
	border-radius: var(--radius);
	text-align: center;
}

.summary-label {
	font-size: 11px;
	color: var(--color-text-muted);
}

.summary-value {
	font-family: var(--font-display);
	font-size: 18px;
	font-weight: 700;
	color: #2e7d32;
}

/* ========================================
   トーナメント表示エリア
   ======================================== */
.tournament-display {
	padding: 20px;
}

.tournament-display:empty {
	padding: 0;
}

/* ===== 総当たり戦（ラウンドロビン） ===== */
.roundrobin-section {
	margin-bottom: 24px;
}

.roundrobin-section:last-child {
	margin-bottom: 0;
}

.roundrobin-round {
	margin-bottom: 18px;
}

.roundrobin-round-title {
	font-family: var(--font-display);
	font-size: 14px;
	font-weight: 700;
	color: #2e7d32;
	margin-bottom: 10px;
	padding-left: 4px;
	border-left: 4px solid #43a047;
	padding-left: 10px;
}

.matches-list {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.match-row {
	display: grid;
	grid-template-columns: auto 1fr auto 1fr;
	gap: 10px;
	align-items: center;
	padding: 10px 14px;
	background: var(--color-bg);
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
}

.match-number {
	font-family: var(--font-display);
	font-size: 12px;
	color: var(--color-text-muted);
	font-weight: 600;
	min-width: 40px;
}

.match-team {
	font-size: 14px;
	color: var(--color-text);
	font-weight: 500;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.match-team--left {
	text-align: right;
}

.match-team--right {
	text-align: left;
}

.match-team--bye {
	color: var(--color-text-muted);
	font-style: italic;
}

.match-vs {
	font-family: var(--font-display);
	font-size: 12px;
	font-weight: 700;
	color: #2e7d32;
	padding: 3px 8px;
	background: #e8f5e9;
	border-radius: 10px;
}

/* ===== シングルエリミネーション（トーナメント） ===== */
.bracket-section {
	overflow-x: auto;
	padding-bottom: 10px;
}

.bracket {
	display: flex;
	gap: 20px;
	min-width: max-content;
	padding: 10px 0;
}

.bracket-round {
	display: flex;
	flex-direction: column;
	justify-content: space-around;
	gap: 12px;
	min-width: 180px;
}

.bracket-round-title {
	font-family: var(--font-display);
	font-size: 12px;
	font-weight: 700;
	color: #2e7d32;
	text-align: center;
	padding: 4px 8px;
	background: #e8f5e9;
	border-radius: 10px;
	margin-bottom: 4px;
}

.bracket-match {
	display: flex;
	flex-direction: column;
	padding: 8px 10px;
	background: var(--color-bg);
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	gap: 4px;
	min-height: 60px;
	justify-content: center;
}

.bracket-team {
	padding: 6px 10px;
	background: var(--color-white);
	border-radius: 4px;
	font-size: 13px;
	color: var(--color-text);
	border-left: 3px solid #66bb6a;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.bracket-team--bye {
	color: var(--color-text-muted);
	font-style: italic;
	border-left-color: var(--color-border);
}

.bracket-team--placeholder {
	color: var(--color-text-muted);
	border-left-color: var(--color-border);
	background: transparent;
}

/* ===== 予選グループ+決勝 ===== */
.groups-section {
	margin-bottom: 24px;
}

.groups-title {
	font-family: var(--font-display);
	font-size: 16px;
	font-weight: 700;
	color: #2e7d32;
	margin-bottom: 14px;
	padding-bottom: 6px;
	border-bottom: 2px solid #a5d6a7;
}

.groups-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: 16px;
}

.group-card {
	background: var(--color-white);
	border: 2px solid #a5d6a7;
	border-radius: var(--radius);
	overflow: hidden;
}

.group-card-header {
	padding: 10px 14px;
	background: linear-gradient(135deg, #43a047 0%, #2e7d32 100%);
	color: var(--color-white);
	font-family: var(--font-display);
	font-size: 14px;
	font-weight: 700;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.group-card-count {
	font-size: 11px;
	padding: 2px 8px;
	background: rgba(255, 255, 255, 0.25);
	border-radius: 8px;
}

.group-teams-list {
	padding: 10px 14px;
	display: flex;
	flex-direction: column;
	gap: 5px;
	border-bottom: 1px solid #e0f2f1;
}

.group-team {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 5px 8px;
	background: #f1f8e9;
	border-radius: 4px;
	font-size: 13px;
}

.group-team-seed {
	font-family: var(--font-display);
	font-size: 11px;
	font-weight: 700;
	color: var(--color-text-muted);
	min-width: 24px;
}

.group-team-name {
	flex: 1;
	color: var(--color-text);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.group-matches {
	padding: 8px 14px 12px;
}

.group-matches-title {
	font-size: 11px;
	color: var(--color-text-muted);
	margin-bottom: 6px;
	font-weight: 500;
}

.group-match {
	padding: 5px 8px;
	margin-bottom: 3px;
	font-size: 12px;
	color: var(--color-text-secondary);
	background: var(--color-bg);
	border-radius: 4px;
	text-align: center;
}

.final-section {
	margin-top: 24px;
	padding-top: 20px;
	border-top: 2px dashed #a5d6a7;
}

.final-title {
	font-family: var(--font-display);
	font-size: 16px;
	font-weight: 700;
	color: #c62828;
	margin-bottom: 14px;
	padding-bottom: 6px;
	border-bottom: 2px solid #ef9a9a;
}

.final-note {
	padding: 12px 16px;
	background: #fff3e0;
	border-left: 4px solid #ffa726;
	border-radius: var(--radius);
	font-size: 13px;
	color: #5d4037;
	line-height: 1.7;
}

/* ========================================
   警告・エラー
   ======================================== */
.warning-box {
	padding: 16px;
	background: #fff3e0;
	border: 1px solid #ffa726;
	border-left: 4px solid #f57c00;
	border-radius: var(--radius);
	font-size: 13px;
	color: #5d4037;
	line-height: 1.7;
}

.warning-box strong {
	color: #bf360c;
}

/* ========================================
   印刷レイアウト
   ======================================== */
@media print {
	.header,
	.footer,
	.breadcrumb,
	.page-description,
	.input-section,
	.action-section,
	.card {
		display: none !important;
	}

	.page-title {
		font-size: 18px;
		margin-bottom: 12px;
	}

	.tournament-display {
		padding: 0;
	}

	.summary-section {
		background: #fff;
		padding: 8px 0;
	}

	.summary-value {
		color: #000;
	}

	.match-row {
		break-inside: avoid;
	}

	.bracket-match {
		break-inside: avoid;
	}

	.group-card {
		break-inside: avoid;
		page-break-inside: avoid;
	}
}

/* ========================================
   レスポンシブ
   ======================================== */
@media (max-width: 600px) {
	.format-grid {
		grid-template-columns: 1fr;
		gap: 8px;
	}

	.summary-grid {
		grid-template-columns: 1fr;
		gap: 8px;
	}

	.match-row {
		grid-template-columns: auto 1fr auto 1fr;
		gap: 6px;
		padding: 8px 10px;
		font-size: 13px;
	}

	.bracket {
		gap: 12px;
	}

	.bracket-round {
		min-width: 150px;
	}

	.groups-grid {
		grid-template-columns: 1fr;
	}
}
