/**
 * CSD REST API Documentation Page Styles
 * Works in both admin and frontend (public) contexts.
 */

.csd-api-docs {
	max-width: 1200px;
}

/* =========================================================================
   Tabs
   ========================================================================= */
.csd-docs-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-bottom: 30px;
	padding: 0;
	border-bottom: 3px solid #2271b1;
}

.csd-docs-tab {
	padding: 12px 22px;
	border: 1px solid #d0d5dd;
	border-bottom: none;
	background: #f5f6f7;
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	color: #667085;
	border-radius: 8px 8px 0 0;
	margin-bottom: -3px;
	transition: all 0.2s ease;
	position: relative;
	letter-spacing: 0.01em;
}

.csd-docs-tab:hover {
	background: #e9ecef;
	color: #344054;
	border-color: #c0c5cc;
}

.csd-docs-tab.active {
	background: #fff;
	border-color: #2271b1;
	border-bottom: 3px solid #fff;
	color: #2271b1;
	font-weight: 700;
	z-index: 1;
}

/* =========================================================================
   Panels
   ========================================================================= */
.csd-docs-panel {
	display: none;
}

.csd-docs-panel.active {
	display: block;
}

.csd-docs-panel h2 {
	margin-top: 0;
	font-size: 24px;
	font-weight: 700;
	color: #1d2327;
	padding-bottom: 10px;
	border-bottom: 1px solid #eee;
	margin-bottom: 20px;
}

.csd-docs-panel h3 {
	margin-top: 28px;
	font-size: 17px;
	font-weight: 600;
	color: #1d2327;
}

/* =========================================================================
   Tables
   ========================================================================= */
.csd-docs-table {
	width: 100%;
	border-collapse: collapse;
	margin: 15px 0;
	border-radius: 6px;
	overflow: hidden;
	border: 1px solid #e0e0e0;
}

.csd-docs-table th,
.csd-docs-table td {
	border: 1px solid #e0e0e0;
	padding: 10px 14px;
	text-align: left;
	font-size: 13px;
}

.csd-docs-table th {
	background: #f0f4f8;
	font-weight: 700;
	color: #344054;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.csd-docs-table tr:nth-child(even) {
	background: #f9fafb;
}

.csd-docs-table tr:hover {
	background: #f0f4f8;
}

.csd-docs-table td:first-child {
	font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', Menlo, Consolas, monospace;
	font-size: 12.5px;
	color: #2271b1;
}

/* =========================================================================
   Inline Code
   ========================================================================= */
.csd-docs-panel code {
	background: #eef2f7;
	padding: 3px 7px;
	border-radius: 4px;
	font-size: 12.5px;
	font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', Menlo, Consolas, monospace;
	color: #c7254e;
	border: 1px solid #dde3ea;
}

/* =========================================================================
   Code Blocks - Dark theme with syntax highlighting
   ========================================================================= */
.csd-docs-panel pre {
	background: #1a1d23;
	color: #e6e6e6;
	padding: 20px 22px;
	border-radius: 8px;
	overflow-x: auto;
	font-size: 13px;
	line-height: 1.65;
	font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', Menlo, Consolas, monospace;
	border: 1px solid #2d3139;
	position: relative;
	margin: 15px 0;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.csd-docs-panel pre code {
	background: none !important;
	color: inherit;
	font-size: inherit;
	padding: 0 !important;
	border: none !important;
	font-family: inherit;
}

/* JSON syntax highlighting */
.csd-json-key {
	color: #9cdcfe;
}

.csd-json-string {
	color: #ce9178;
}

.csd-json-number {
	color: #b5cea8;
}

.csd-json-bool,
.csd-json-null {
	color: #569cd6;
	font-weight: 600;
}

.csd-json-bracket {
	color: #ffd700;
}

/* Curl / shell syntax highlighting */
.csd-sh-command {
	color: #dcdcaa;
}

.csd-sh-flag {
	color: #9cdcfe;
}

.csd-sh-string {
	color: #ce9178;
}

.csd-sh-url {
	color: #4fc1ff;
	text-decoration: underline;
	text-decoration-color: rgba(79, 193, 255, 0.3);
}

.csd-sh-comment {
	color: #6a9955;
	font-style: italic;
}

/* PHP syntax highlighting */
.csd-php-var {
	color: #9cdcfe;
}

.csd-php-func {
	color: #dcdcaa;
}

.csd-php-string {
	color: #ce9178;
}

.csd-php-keyword {
	color: #c586c0;
}

.csd-php-comment {
	color: #6a9955;
	font-style: italic;
}

/* Code block label */
.csd-code-label {
	position: absolute;
	top: 0;
	right: 0;
	padding: 3px 10px;
	font-size: 10px;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	font-weight: 600;
	color: #8b949e;
	background: #2d3139;
	border-radius: 0 8px 0 6px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* =========================================================================
   Method Badges
   ========================================================================= */
.csd-method {
	display: inline-block;
	padding: 4px 12px;
	border-radius: 4px;
	font-size: 11px;
	font-weight: 700;
	color: #fff;
	background: #2271b1;
	font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', Menlo, Consolas, monospace;
	vertical-align: middle;
	margin-right: 8px;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

.csd-method-post {
	background: #00a32a;
}

.csd-method-put {
	background: #dba617;
	color: #1d2327;
}

.csd-method-delete {
	background: #d63638;
}

/* =========================================================================
   Endpoint Blocks
   ========================================================================= */
.csd-endpoint {
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	padding: 24px;
	margin: 20px 0;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
	transition: box-shadow 0.2s ease;
}

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

.csd-endpoint h3 {
	margin-top: 0;
	font-size: 18px;
	display: flex;
	align-items: center;
	padding-bottom: 12px;
	border-bottom: 1px solid #f0f0f0;
	margin-bottom: 15px;
	font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', Menlo, Consolas, monospace;
}

.csd-endpoint h4 {
	margin-top: 18px;
	font-size: 13px;
	color: #667085;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	font-weight: 700;
}

/* =========================================================================
   Try It Section
   ========================================================================= */
.csd-try-it-form {
	background: #f8f9fa;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	padding: 24px;
	margin-bottom: 20px;
}

.csd-try-it-row {
	margin-bottom: 15px;
}

.csd-try-it-row label {
	display: block;
	font-weight: 600;
	margin-bottom: 6px;
	font-size: 13px;
	color: #344054;
}

.csd-try-it-row input[type="text"],
.csd-try-it-row input[type="number"],
.csd-try-it-row select {
	width: 100%;
	max-width: 500px;
	padding: 10px 12px;
	border: 1px solid #d0d5dd;
	border-radius: 6px;
	font-size: 14px;
	font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', Menlo, Consolas, monospace;
	background: #fff;
	transition: border-color 0.2s;
}

.csd-try-it-row input[type="text"]:focus,
.csd-try-it-row input[type="number"]:focus,
.csd-try-it-row select:focus {
	border-color: #2271b1;
	outline: none;
	box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.12);
}

.csd-try-it-params {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px 20px;
}

.csd-try-it-params .csd-try-it-row {
	margin-bottom: 5px;
}

.csd-try-it-params input {
	max-width: 100% !important;
}

#csd-try-send {
	padding: 10px 28px;
	font-size: 14px;
	font-weight: 600;
	border-radius: 6px;
	background: #2271b1;
	color: #fff;
	border: none;
	cursor: pointer;
	transition: background 0.2s;
}

#csd-try-send:hover {
	background: #135e96;
}

/* Result display */
.csd-try-it-result {
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.csd-try-result-header {
	background: #f5f6f7;
	padding: 14px 18px;
	display: flex;
	align-items: center;
	gap: 15px;
	flex-wrap: wrap;
	border-bottom: 1px solid #e0e0e0;
}

.csd-try-result-url {
	font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', Menlo, Consolas, monospace;
	font-size: 12px;
	color: #555;
	flex: 1;
	word-break: break-all;
}

.csd-try-result-status {
	font-weight: 700;
	padding: 4px 12px;
	border-radius: 4px;
	font-size: 13px;
	font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', Menlo, Consolas, monospace;
}

.csd-try-result-status.status-2xx {
	background: #d4edda;
	color: #155724;
}

.csd-try-result-status.status-4xx {
	background: #fff3cd;
	color: #856404;
}

.csd-try-result-status.status-5xx {
	background: #f8d7da;
	color: #721c24;
}

.csd-try-result-time {
	font-size: 12px;
	color: #777;
	font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', Menlo, Consolas, monospace;
}

.csd-try-result-body {
	max-height: 500px;
	overflow-y: auto;
	margin: 0 !important;
	border-radius: 0 !important;
	border: none !important;
	box-shadow: none !important;
}

/* =========================================================================
   Public Context Adjustments
   ========================================================================= */
.csd-api-docs-public {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	line-height: 1.6;
	color: #333;
}

.csd-api-docs-public .csd-docs-tab {
	font-size: 13px;
	padding: 10px 18px;
}

.csd-api-docs-public p {
	font-size: 15px;
	color: #4a5568;
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 768px) {
	.csd-try-it-params {
		grid-template-columns: 1fr;
	}

	.csd-docs-tabs {
		flex-wrap: wrap;
		gap: 3px;
	}

	.csd-docs-tab {
		font-size: 12px;
		padding: 8px 14px;
	}

	.csd-try-result-header {
		flex-direction: column;
		align-items: flex-start;
	}

	.csd-endpoint {
		padding: 16px;
	}

	.csd-docs-panel pre {
		padding: 14px 16px;
		font-size: 12px;
	}
}
