/* Core Layout & Resets */
#api-dashboard-root {
	background-color: transparent;
	padding: 20px 0;
	margin: 0;
}

.api-dashboard {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	color: #374151;
	box-sizing: border-box;
}

.api-dashboard * {
	box-sizing: border-box;
}

/* Typography */
.api-dashboard h1, .api-dashboard h2, .api-dashboard h3, .api-dashboard h4 {
	color: #111827;
	margin-top: 0;
}

.api-dashboard h1 {
	font-size: 1.5rem;
	font-weight: 600;
	margin-bottom: 24px;
	display: flex;
	align-items: center;
	gap: 12px;
}

.api-dashboard h1 svg {
	color: #3b82f6; /* Beautiful standard blue */
	width: 28px;
	height: 28px;
}

/* Grid System */
.api-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 20px;
	margin-bottom: 30px;
}

@media (max-width: 1200px) {
	.api-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
	.api-grid { grid-template-columns: 1fr; }
}

.api-grid-2 {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 20px;
	margin-bottom: 30px;
}

@media (max-width: 1024px) {
	.api-grid-2 { grid-template-columns: 1fr; }
}

/* Cards */
.api-card {
	background-color: #ffffff;
	border-radius: 8px;
	padding: 24px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
	border: 1px solid #e5e7eb;
	display: flex;
	flex-direction: column;
}

.api-card-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 16px;
}

.api-card-title {
	font-size: 0.875rem;
	font-weight: 600;
	color: #4b5563;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	margin: 0;
}

.api-card-icon {
	color: #3b82f6;
	width: 24px;
	height: 24px;
}

.api-card-icon.warning {
	color: #ef4444;
}

.api-card-value {
	font-size: 2rem;
	font-weight: 700;
	color: #111827;
	margin: 0 0 8px 0;
	line-height: 1;
}

.api-card-subtext {
	font-size: 0.875rem;
	color: #6b7280;
}

/* First card accent (Material Blue style) */
.api-grid > .api-card:first-child {
	background-color: #4f46e5;
	color: #ffffff;
	border: none;
}
.api-grid > .api-card:first-child .api-card-title {
	color: rgba(255, 255, 255, 0.9);
}
.api-grid > .api-card:first-child .api-card-icon {
	color: #ffffff;
}
.api-grid > .api-card:first-child .api-card-value {
	color: #ffffff;
}
.api-grid > .api-card:first-child .api-card-subtext {
	color: rgba(255, 255, 255, 0.8);
}

/* Alerts */
.api-alert {
	background-color: #fef2f2;
	border: 1px solid #fecaca;
	color: #dc2626;
	padding: 12px 16px;
	border-radius: 8px;
	margin-bottom: 24px;
	font-size: 0.875rem;
	display: flex;
	align-items: center;
	gap: 8px;
}

/* Charts */
.api-chart-container {
	margin-top: 16px;
	max-height: 300px;
	overflow-y: auto;
}

.api-bar-row {
	display: flex;
	align-items: center;
	margin-bottom: 12px;
}

.api-bar-label {
	width: 180px;
	font-size: 0.875rem;
	color: #4b5563;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	padding-right: 12px;
}

.api-bar-track {
	flex-grow: 1;
	height: 6px;
	background-color: #e5e7eb;
	border-radius: 4px;
	overflow: hidden;
	margin-right: 12px;
}

.api-bar-fill {
	height: 100%;
	background-color: #3b82f6;
	border-radius: 4px;
	transition: width 0.5s ease;
}

.api-bar-fill.api-bar-warning {
	background-color: #ef4444;
}

.api-bar-value {
	width: 80px;
	text-align: left;
	font-size: 0.75rem;
	color: #6b7280;
	font-variant-numeric: tabular-nums;
}

/* Header & Tabs */
.api-header-section {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 24px;
	flex-wrap: wrap;
	gap: 16px;
}

.api-tabs {
	display: flex;
	background: #ffffff;
	padding: 4px;
	border-radius: 8px;
	box-shadow: 0 1px 2px rgba(0,0,0,0.05);
	border: 1px solid #e5e7eb;
}

.api-tab-btn {
	display: flex;
	align-items: center;
	gap: 8px;
	background: transparent;
	border: none;
	padding: 8px 16px;
	font-size: 0.875rem;
	font-weight: 500;
	color: #6b7280;
	cursor: pointer;
	border-radius: 6px;
	transition: all 0.2s;
}

.api-tab-btn svg {
	width: 16px;
	height: 16px;
}

.api-tab-btn:hover {
	color: #374151;
}

.api-tab-btn.active {
	background: #f3f4f6;
	color: #111827;
	box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.api-tab-content {
	animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
	from { opacity: 0; transform: translateY(5px); }
	to { opacity: 1; transform: translateY(0); }
}

/* Query Cards (Replaces Table) */
.api-table-wrapper {
	background-color: #ffffff;
	border-radius: 8px;
	border: 1px solid #e5e7eb;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
	overflow: hidden;
}

.api-table-header-wrapper {
	padding: 20px 24px;
	border-bottom: 1px solid #e5e7eb;
	background-color: #f9fafb;
}

.api-table-title {
	font-size: 1.125rem;
	font-weight: 600;
	color: #111827;
	margin: 0;
}

.api-query-list {
	display: flex;
	flex-direction: column;
}

.api-query-card {
	border-bottom: 1px solid #f3f4f6;
	transition: background-color 0.2s;
}

.api-query-card:hover {
	background-color: #f9fafb;
}

.api-query-card:last-child {
	border-bottom: none;
}

.api-query-card-header {
	display: grid;
	grid-template-columns: 180px 1fr 200px 40px;
	align-items: center;
	padding: 16px 24px;
	cursor: pointer;
	gap: 16px;
}

@media (max-width: 1024px) {
	.api-query-card-header { grid-template-columns: 140px 1fr 40px; }
	.api-query-origin { display: none; }
}

.api-query-meta {
	display: flex;
	align-items: center;
	gap: 12px;
	font-size: 0.875rem;
}

.api-query-number {
	font-weight: 600;
	color: #6b7280;
	width: 30px;
}

.api-query-time {
	font-variant-numeric: tabular-nums;
	font-weight: 500;
	color: #4b5563;
}

.api-query-preview {
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
	font-size: 0.8125rem;
	color: #374151;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.api-query-origin {
	font-size: 0.75rem;
	color: #9ca3af;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.api-query-toggle {
	display: flex;
	justify-content: flex-end;
	color: #9ca3af;
}

.api-query-toggle svg {
	width: 20px;
	height: 20px;
	transition: transform 0.2s;
}

.api-query-card.expanded .api-query-toggle svg {
	transform: rotate(180deg);
}

.api-query-card-body {
	padding: 0 24px 20px 24px;
}

.api-query-sql {
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
	font-size: 0.8125rem;
	color: #111827;
	background-color: #f3f4f6;
	padding: 16px;
	border-radius: 6px;
	margin: 0;
	white-space: pre-wrap;
	word-break: break-all;
	border: 1px solid #e5e7eb;
	max-height: 250px;
	overflow-y: auto;
}

.api-badge {
	display: inline-flex;
	align-items: center;
	padding: 2px 8px;
	border-radius: 9999px;
	font-size: 0.75rem;
	font-weight: 600;
}

.api-badge-normal {
	background-color: #dbeafe;
	color: #1e40af;
}

.api-badge-slow {
	background-color: #fee2e2;
	color: #991b1b;
}

/* Pagination */
.api-pagination {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 16px 24px;
	border-top: 1px solid #e5e7eb;
	background-color: #f9fafb;
}

.api-pagination-info {
	font-size: 0.875rem;
	color: #6b7280;
}

.api-pagination-controls {
	display: flex;
	gap: 8px;
}

.api-btn {
	background-color: #ffffff;
	color: #374151;
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	padding: 6px 14px;
	font-size: 0.875rem;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.api-btn:hover:not(:disabled) {
	background-color: #f3f4f6;
	color: #111827;
}

.api-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	background-color: #f9fafb;
}

/* Scrollbar styling for a modern feel */
.api-chart-container::-webkit-scrollbar,
.api-query-sql::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.api-chart-container::-webkit-scrollbar-track,
.api-query-sql::-webkit-scrollbar-track {
    background: transparent;
}
.api-chart-container::-webkit-scrollbar-thumb,
.api-query-sql::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}
.api-chart-container::-webkit-scrollbar-thumb:hover,
.api-query-sql::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}