/* R-LLM SEO F04 - AI本文生成 ワークベンチ */

.rllm-f04-workbench {
	margin-top: 16px;
}

/* ── ツールバー ─────────────────────────────── */
.rllm-f04-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 16px;
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 8px 8px 0 0;
	border-bottom: 1px solid #f1f5f9;
}

.rllm-f04-toolbar__title {
	font-size: 13px;
	font-weight: 700;
	color: #475569;
}

.rllm-f04-toolbar__actions {
	display: flex;
	align-items: center;
	gap: 8px;
}

.rllm-f04-toolbar__actions .button {
	font-weight: 600;
	transition: background 0.15s, border-color 0.15s;
}

#f04-save-draft {
	background: #eff6ff;
	color: #2563eb !important;
	border: 1px solid #bfdbfe !important;
}

#f04-save-draft:hover {
	background: #dbeafe;
	border-color: #93c5fd !important;
	color: #1d4ed8 !important;
}

.rllm-f04-action-msg {
	font-size: 12px;
	color: #16a34a;
}

.rllm-f04-action-msg.is-error {
	color: #dc2626;
}

/* ── 2カラム ─────────────────────────────────── */
.rllm-f04-columns {
	display: flex;
	gap: 0;
	border: 1px solid #e2e8f0;
	border-radius: 0 0 8px 8px;
	background: #fff;
	min-height: 600px;
}

/* ── 左: 設定パネル ─────────────────────────── */
.rllm-f04-panel {
	width: 300px;
	flex-shrink: 0;
	padding: 20px 16px;
	border-right: 1px solid #e2e8f0;
	overflow-y: auto;
}

.rllm-f04-field {
	margin-bottom: 16px;
}

.rllm-f04-label {
	display: block;
	font-size: 12px;
	font-weight: 600;
	color: #475569;
	margin-bottom: 4px;
}

.rllm-f04-required {
	color: #d63638;
	margin-left: 2px;
}

.rllm-f04-input,
.rllm-f04-select {
	width: 100%;
	padding: 6px 8px;
	font-size: 13px;
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	background: #fff;
	color: #1d2327;
	box-sizing: border-box;
}

.rllm-f04-input:focus,
.rllm-f04-select:focus,
.rllm-f04-textarea:focus {
	outline: none;
	border-color: #2563eb;
	box-shadow: 0 0 0 1px #2563eb;
}

.rllm-f04-hint {
	display: block;
	font-size: 11px;
	color: #646970;
	margin-top: 3px;
}

.rllm-f04-textarea {
	width: 100%;
	padding: 6px 8px;
	font-size: 13px;
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	background: #fff;
	color: #1d2327;
	box-sizing: border-box;
	resize: vertical;
}

.rllm-f04-textarea--small {
	min-height: 70px;
}

.rllm-f04-btn-generate {
	width: 100%;
	justify-content: center;
	padding: 8px 0 !important;
	font-size: 13px !important;
	background: #eff6ff !important;
	color: #2563eb !important;
	border: 1px solid #bfdbfe !important;
	font-weight: 600 !important;
	transition: background 0.15s, border-color 0.15s;
}
.rllm-f04-btn-generate:hover:not(:disabled) {
	background: #dbeafe !important;
	border-color: #93c5fd !important;
	color: #1d4ed8 !important;
}
.rllm-f04 .rllm-f04-toolbar__actions .button.button-primary {
	background: #eff6ff;
	color: #2563eb !important;
	border: 1px solid #bfdbfe !important;
	font-weight: 600;
	transition: background 0.15s, border-color 0.15s;
}
.rllm-f04 .rllm-f04-toolbar__actions .button.button-primary:hover {
	background: #dbeafe;
	border-color: #93c5fd !important;
	color: #1d4ed8 !important;
}

/* ── 右: 編集エリア ─────────────────────────── */
.rllm-f04-editor {
	flex: 1;
	display: flex;
	flex-direction: column;
	padding: 20px 16px;
	position: relative;
}

.rllm-f04-editor-placeholder {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	text-align: center;
	color: #8c8f94;
	pointer-events: none;
	padding: 0 32px;
}

.rllm-f04-editor-placeholder p {
	font-size: 14px;
	line-height: 1.6;
}

.rllm-f04-editor-placeholder.is-hidden {
	display: none;
}

.rllm-f04-textarea--editor {
	flex: 1;
	min-height: 520px;
	font-size: 13px;
	line-height: 1.7;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	resize: none;
	border: 1px solid #e2e8f0;
}

.rllm-f04-editor-footer {
	margin-top: 8px;
	text-align: right;
}

.rllm-f04-char-count {
	font-size: 12px;
	color: #646970;
}

/* ── ローディング ────────────────────────────── */
.rllm-f04-btn-generate.is-loading {
	opacity: 0.7;
	cursor: not-allowed;
}

.rllm-f04-loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	flex: 1;
	gap: 16px;
	color: #64748b;
	font-size: 13px;
}

.rllm-f04-loading.is-hidden {
	display: none;
}

.rllm-f04-loading p {
	margin: 0;
}

@keyframes rllm-spin {
	to { transform: rotate(360deg); }
}

.rllm-f04-spinner {
	width: 36px;
	height: 36px;
	border: 3px solid #e2e8f0;
	border-top-color: #2563eb;
	border-radius: 50%;
	animation: rllm-spin 0.8s linear infinite;
}

/* ── レスポンシブ ────────────────────────────── */
@media screen and (max-width: 900px) {
	.rllm-f04-columns {
		flex-direction: column;
	}

	.rllm-f04-panel {
		width: 100%;
		border-right: none;
		border-bottom: 1px solid #e2e8f0;
	}
}

/* ── 詳細設定（開閉） ────────────────────────── */
.rllm-f04-details {
	border: 1px solid #e2e8f0;
	border-radius: 4px;
	margin-bottom: 12px;
}

.rllm-f04-details__summary {
	cursor: pointer;
	padding: 8px 12px;
	font-size: 13px;
	font-weight: 600;
	color: #374151;
	user-select: none;
	list-style: none;
	display: flex;
	align-items: center;
	gap: 6px;
}

.rllm-f04-details__summary::before {
	content: '▶';
	font-size: 10px;
	transition: transform 0.15s;
}

.rllm-f04-details[open] .rllm-f04-details__summary::before {
	transform: rotate(90deg);
}

.rllm-f04-details__body {
	padding: 0 12px 8px;
	border-top: 1px solid #e2e8f0;
}

/* ── 編集/プレビュー タブ ────────────────────── */
.rllm-f04-editor-tabs {
	display: flex;
	align-items: center;
	border-bottom: 1px solid #e2e8f0;
	background: #f8fafc;
	padding: 0 12px;
	gap: 0;
}

.rllm-f04-tab {
	background: none;
	border: none;
	border-bottom: 2px solid transparent;
	padding: 8px 14px;
	font-size: 13px;
	color: #64748b;
	cursor: pointer;
	margin-bottom: -1px;
}

.rllm-f04-tab.is-active {
	color: #2563eb;
	border-bottom-color: #2563eb;
	font-weight: 600;
}

/* ── 生成履歴 ────────────────────────────────── */
.rllm-f04-history-wrap {
	margin-left: auto;
	position: relative;
}

.rllm-f04-history-btn {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 6px;
	padding: 4px 10px;
	font-size: 12px;
	font-weight: 600;
	color: #475569;
	cursor: pointer;
	line-height: 1.4;
	transition: background 0.15s, border-color 0.15s;
}

.rllm-f04-history-btn:hover {
	background: #f1f5f9;
	border-color: #cbd5e1;
	color: #334155;
}

.rllm-f04-history-btn.is-active {
	background: #f1f5f9;
	border-color: #cbd5e1;
	color: #334155;
}

.rllm-f04-history-dropdown {
	position: absolute;
	top: calc(100% + 6px);
	right: 0;
	width: 300px;
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
	z-index: 100;
}

.rllm-f04-history-dropdown.is-hidden {
	display: none;
}

.rllm-f04-history-header {
	padding: 6px 12px;
	font-size: 11px;
	color: #8c8f94;
	background: #f8fafc;
	border-bottom: 1px solid #f0f0f0;
	margin: 0;
}

.rllm-f04-history-empty {
	padding: 16px;
	font-size: 13px;
	color: #8c8f94;
	text-align: center;
	margin: 0;
}

.rllm-f04-history-list {
	list-style: none;
	margin: 0;
	padding: 4px 0;
}

.rllm-f04-history-item {
	display: flex;
	align-items: center;
	border-bottom: 1px solid #f0f0f0;
}

.rllm-f04-history-item:last-child {
	border-bottom: none;
}

.rllm-f04-history-restore {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 2px;
	background: none;
	border: none;
	padding: 8px 12px;
	cursor: pointer;
	text-align: left;
	min-width: 0;
}

.rllm-f04-history-restore:hover {
	background: #f0f6fc;
}

.rllm-f04-history-title {
	font-size: 13px;
	color: #1d2327;
	font-weight: 500;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	max-width: 220px;
}

.rllm-f04-history-time {
	font-size: 11px;
	color: #8c8f94;
}

.rllm-f04-history-delete {
	background: none;
	border: none;
	padding: 8px 10px;
	color: #8c8f94;
	cursor: pointer;
	font-size: 14px;
	line-height: 1;
	flex-shrink: 0;
}

.rllm-f04-history-delete:hover {
	color: #d63638;
}

/* ── プレビューエリア ─────────────────────────── */
.rllm-f04-preview-area {
	flex: 1;
	padding: 32px 40px;
	overflow-y: auto;
	font-size: 14px;
	line-height: 1.9;
	color: #1e293b;
	background: #f8fafc;
}

.rllm-f04-preview-area.is-hidden {
	display: none;
}

.rllm-f04-preview-title {
	font-size: 20px;
	font-weight: 700;
	color: #0f172a;
	margin: 0 0 1.2em;
	padding-bottom: 12px;
	border-bottom: 3px solid #2563eb;
	line-height: 1.4;
}

.rllm-f04-preview-area h2 {
	font-size: 16px;
	font-weight: 700;
	margin: 1.6em 0 0.6em;
	padding: 6px 12px;
	background: #eff6ff;
	border-left: 4px solid #2563eb;
	border-radius: 0 3px 3px 0;
	color: #1e3a5f;
}

.rllm-f04-preview-area h3 {
	font-size: 14px;
	font-weight: 700;
	margin: 1.2em 0 0.5em;
	color: #1d2327;
	padding-left: 8px;
	border-left: 3px solid #93c5fd;
}

.rllm-f04-preview-area h4 {
	font-size: 14px;
	font-weight: 700;
	margin: 1em 0 0.4em;
	color: #374151;
}

.rllm-f04-preview-area p {
	margin: 0 0 1em;
}

.rllm-f04-preview-area ul {
	list-style-type: disc;
	padding-left: 1.6em;
	margin-bottom: 1em;
}

.rllm-f04-preview-area ol {
	list-style-type: decimal;
	padding-left: 1.6em;
	margin-bottom: 1em;
}

.rllm-f04-preview-area li {
	margin-bottom: 0.4em;
	list-style: inherit;
}

.rllm-f04-preview-area strong {
	font-weight: 700;
	color: #1e3a5f;
}

.rllm-f04-preview-area em {
	font-style: italic;
	color: #374151;
}

/* ── プレビュー テーブル ─────────────────────────── */
.rllm-f04-table {
	border-collapse: collapse;
	width: 100%;
	margin-bottom: 1.2em;
	font-size: 14px;
}

.rllm-f04-table th,
.rllm-f04-table td {
	border: 1px solid #e2e8f0;
	padding: 8px 12px;
	text-align: left;
	vertical-align: top;
	line-height: 1.6;
}

.rllm-f04-table th {
	background: #eff6ff;
	font-weight: 700;
	color: #1e3a5f;
	white-space: nowrap;
}

.rllm-f04-table tbody tr:nth-child(even) td {
	background: #f8fafc;
}
