/**
 * API Documentation Page Styles
 *
 * @package Cherry_Tree
 * @since   2.0.3
 */

/* ── Container ──────────────────────────────────────────── */
.ct-api-docs {
	max-width: 820px;
	margin: 0 auto;
	padding: 0 1rem 3rem;
	font-family: -apple-system, "system-ui", 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
	color: #1a1a2e;
	line-height: 1.6;
}

.ct-api-docs *,
.ct-api-docs *::before,
.ct-api-docs *::after {
	box-sizing: border-box;
}

/* ── Hero ───────────────────────────────────────────────── */
.ct-api-hero {
	text-align: center;
	padding: 2.5rem 0 2rem;
	border-bottom: 1px solid #e8ecf1;
	margin-bottom: 2.5rem;
}

.ct-api-badge-plugin {
	display: inline-block;
	font-size: 0.8125rem;
	font-weight: 600;
	color: #6b5ce7;
	letter-spacing: 0.02em;
	margin-bottom: 0.75rem;
}

.ct-api-title {
	font-size: 2.75rem !important;
	font-weight: 700 !important;
	color: #1a1a2e !important;
	margin: 0 0 0.75rem !important;
	line-height: 1.15 !important;
	letter-spacing: -0.02em;
}

.ct-api-subtitle {
	font-size: 1.125rem;
	color: #5a6077;
	margin: 0 0 1.5rem;
	max-width: 560px;
	margin-left: auto;
	margin-right: auto;
}

/* Badges row */
.ct-api-badges {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.5rem;
}

.ct-badge {
	display: inline-flex;
	align-items: center;
	padding: 0.375rem 0.875rem;
	border-radius: 9999px;
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.01em;
}

.ct-badge-green {
	background: #ecfdf5;
	color: #047857;
	border: 1px solid #a7f3d0;
}

.ct-badge-blue {
	background: #eff6ff;
	color: #1d4ed8;
	border: 1px solid #bfdbfe;
}

.ct-badge-purple {
	background: #f5f3ff;
	color: #6d28d9;
	border: 1px solid #c4b5fd;
}

.ct-badge-orange {
	background: #fff7ed;
	color: #c2410c;
	border: 1px solid #fed7aa;
}

/* ── Base URL ───────────────────────────────────────────── */
.ct-api-base-url {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	padding: 1.25rem 1.5rem;
	margin-bottom: 2.5rem;
}

.ct-api-label {
	display: block;
	font-size: 0.6875rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: #94a3b8;
	margin-bottom: 0.375rem;
}

.ct-api-url {
	display: block;
	font-size: 0.9375rem;
	font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', 'Menlo', 'Consolas', monospace;
	color: #1e40af;
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 6px;
	padding: 0.625rem 0.875rem;
	word-break: break-all;
}

.ct-api-note {
	font-size: 0.875rem;
	color: #64748b;
	margin: 0.75rem 0 0;
}

/* ── Sections ───────────────────────────────────────────── */
.ct-api-section {
	margin-bottom: 2.5rem;
}

.ct-api-section h2 {
	font-size: 1.5rem !important;
	font-weight: 700 !important;
	color: #1a1a2e !important;
	margin: 0 0 0.75rem !important;
	padding-bottom: 0.5rem;
	border-bottom: 2px solid #e8ecf1;
}

.ct-api-section h3 {
	font-size: 1.125rem !important;
	font-weight: 600 !important;
	color: #334155 !important;
	margin: 1.5rem 0 0.5rem !important;
}

.ct-api-section > p {
	color: #475569;
	margin: 0 0 1rem;
}

/* ── Code Blocks ────────────────────────────────────────── */
.ct-api-code-block {
	border-radius: 8px;
	overflow: hidden;
	margin-bottom: 1rem;
	border: 1px solid #e2e8f0;
}

.ct-code-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: #1e293b;
	padding: 0.5rem 1rem;
}

.ct-code-lang {
	font-size: 0.6875rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: #94a3b8;
}

.ct-code-label {
	font-size: 0.75rem;
	color: #64748b;
}

.ct-api-code-block pre {
	margin: 0 !important;
	padding: 1rem 1.25rem !important;
	background: #0f172a !important;
	overflow-x: auto;
	border-radius: 0 !important;
}

.ct-api-code-block code {
	font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', 'Menlo', 'Consolas', monospace !important;
	font-size: 0.8125rem !important;
	line-height: 1.6 !important;
	color: #e2e8f0 !important;
	background: transparent !important;
	padding: 0 !important;
}

.ct-code-comment {
	color: #64748b;
}

.ct-code-response .ct-code-header {
	background: #1a2332;
}

/* ── Endpoints ──────────────────────────────────────────── */
.ct-endpoint {
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	padding: 1.25rem 1.5rem;
	margin-bottom: 0.75rem;
	transition: box-shadow 0.15s ease;
}

.ct-endpoint:hover {
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.ct-endpoint-header {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin-bottom: 0.5rem;
}

.ct-method {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 3.25rem;
	padding: 0.25rem 0.625rem;
	border-radius: 4px;
	font-size: 0.6875rem;
	font-weight: 800;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	flex-shrink: 0;
}

.ct-method-get {
	background: #dbeafe;
	color: #1d4ed8;
}

.ct-method-post {
	background: #dcfce7;
	color: #15803d;
}

.ct-method-put {
	background: #fef9c3;
	color: #a16207;
}

.ct-method-delete {
	background: #fee2e2;
	color: #dc2626;
}

.ct-endpoint-path {
	font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', 'Menlo', 'Consolas', monospace;
	font-size: 0.875rem;
	color: #334155;
	background: transparent;
	padding: 0;
}

.ct-endpoint-desc {
	font-size: 0.875rem;
	color: #64748b;
	margin: 0 0 0.75rem;
}

/* ── Tables ─────────────────────────────────────────────── */
.ct-api-table-wrap {
	overflow-x: auto;
	border-radius: 8px;
	border: 1px solid #e2e8f0;
}

.ct-api-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.875rem;
}

.ct-api-table thead th {
	background: #f8fafc;
	font-weight: 600;
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #64748b;
	padding: 0.625rem 1rem;
	text-align: left;
	border-bottom: 1px solid #e2e8f0;
}

.ct-api-table tbody td {
	padding: 0.625rem 1rem;
	border-bottom: 1px solid #f1f5f9;
	color: #334155;
	vertical-align: top;
}

.ct-api-table tbody tr:last-child td {
	border-bottom: none;
}

.ct-api-table tbody tr:hover {
	background: #f8fafc;
}

.ct-api-table code {
	font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', 'Menlo', 'Consolas', monospace;
	font-size: 0.8125rem;
	background: #f1f5f9;
	color: #1e40af;
	padding: 0.125rem 0.375rem;
	border-radius: 4px;
}

.ct-api-table-params .ct-api-table-wrap {
	border: none;
}

.ct-endpoint .ct-api-table-wrap {
	margin-top: 0.25rem;
	border-radius: 6px;
}

.ct-required {
	display: inline-block;
	font-size: 0.625rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #dc2626;
	margin-left: 0.375rem;
	vertical-align: middle;
}

.ct-param-type {
	font-size: 0.75rem;
	font-weight: 500;
	color: #6d28d9;
	background: #f5f3ff;
	padding: 0.125rem 0.5rem;
	border-radius: 4px;
}

/* ── Topic Tags ─────────────────────────────────────────── */
.ct-topic-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.ct-topic-tag {
	display: inline-flex;
	align-items: center;
	padding: 0.4375rem 0.875rem;
	background: #f0fdf4;
	color: #166534;
	border: 1px solid #bbf7d0;
	border-radius: 9999px;
	font-size: 0.8125rem;
	font-weight: 500;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.ct-topic-tag:hover {
	background: #dcfce7;
	border-color: #86efac;
}

/* ── AI Section ─────────────────────────────────────────── */
.ct-api-ai-section {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	padding: 1.5rem;
}

.ct-api-ai-section h2 {
	border-bottom-color: #cbd5e1 !important;
}

/* ── Lists ──────────────────────────────────────────────── */
.ct-api-list {
	list-style: none;
	padding: 0;
	margin: 0;
}

.ct-api-list li {
	position: relative;
	padding: 0.375rem 0 0.375rem 1.5rem;
	color: #475569;
	font-size: 0.9375rem;
}

.ct-api-list li::before {
	content: '';
	position: absolute;
	left: 0;
	top: 0.75rem;
	width: 6px;
	height: 6px;
	background: #6b5ce7;
	border-radius: 50%;
}

.ct-api-list li code {
	font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', 'Menlo', 'Consolas', monospace;
	font-size: 0.8125rem;
	background: #e8e4fc;
	color: #4c1d95;
	padding: 0.125rem 0.375rem;
	border-radius: 4px;
}

/* ── Inline code (general) ──────────────────────────────── */
.ct-api-docs > .ct-api-section > p code,
.ct-api-note code {
	font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', 'Menlo', 'Consolas', monospace;
	font-size: 0.8125rem;
	background: #f1f5f9;
	color: #1e40af;
	padding: 0.125rem 0.375rem;
	border-radius: 4px;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 640px) {
	.ct-api-docs {
		padding: 0 0.75rem 2rem;
	}

	.ct-api-hero {
		padding: 1.5rem 0;
	}

	.ct-api-title {
		font-size: 2rem !important;
	}

	.ct-api-subtitle {
		font-size: 1rem;
	}

	.ct-api-badges {
		gap: 0.375rem;
	}

	.ct-badge {
		font-size: 0.75rem;
		padding: 0.25rem 0.625rem;
	}

	.ct-endpoint-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.375rem;
	}

	.ct-endpoint-path {
		font-size: 0.8125rem;
		word-break: break-all;
	}

	.ct-api-section h2 {
		font-size: 1.25rem !important;
	}
}
