:root {
	--primary-color: #6366f1;
	--primary-hover: #4f46e5;
	--primary-light: #818cf8;
	--success-color: #10b981;
	--warning-color: #f59e0b;
	--danger-color: #ef4444;
	--info-color: #3b82f6;
	--gray-50: #f9fafb;
	--gray-100: #f3f4f6;
	--gray-200: #e5e7eb;
	--gray-300: #d1d5db;
	--gray-400: #9ca3af;
	--gray-500: #6b7280;
	--gray-600: #4b5563;
	--gray-700: #374151;
	--gray-800: #1f2937;
	--gray-900: #111827;
	--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
	--shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
	--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
	--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
	--shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body {
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	color: var(--gray-900);
	line-height: 1.6;
}

/* 登录页面 */
#loginPage {
	background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
	position: relative;
	overflow: hidden;
}

.login-card {
	background: white;
	padding: 3rem;
	border-radius: 1.5rem;
	box-shadow: var(--shadow-xl);
	width: 100%;
	max-width: 32rem;
	position: relative;
	z-index: 1;
}

.login-header {
	text-align: center;
	margin-bottom: 2.5rem;
}

.login-title {
	font-size: 3rem;
	font-weight: 800;
	background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	margin-bottom: 0.5rem;
	letter-spacing: -0.02em;
}

/* 导航栏 */
.navbar {
	background: white;
	box-shadow: var(--shadow);
	border-bottom: 1px solid var(--gray-100);
	position: sticky;
	top: 0;
	z-index: 40;
}

.navbar-container {
	max-width: 90rem;
	margin: 0 auto;
	padding: 0 2rem;
	display: flex;
	justify-content: space-between;
	align-items: center;
	height: 4.5rem;
}

.navbar-brand {
	display: flex;
	align-items: center;
}

.navbar-title {
	font-size: 1.75rem;
	font-weight: 800;
	background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	letter-spacing: -0.02em;
}

.navbar-actions {
	display: flex;
	align-items: center;
	gap: 1.5rem;
}

.user-info-card {
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
    text-align: right;
    padding: 0.5rem 1rem;
    background: var(--gray-50);
    border-radius: 0.75rem;
}

.root-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 2.5rem;
    width: 2.5rem;
    background: transparent;
    color: #dc2626;
    font-weight: 700;
    font-size: 1rem;
    border: 2px solid #dc2626;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.user-info-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.user-name {
	font-weight: 600;
	color: var(--gray-900);
	font-size: 0.875rem;
	line-height: 1.2;
}

.user-balance {
	font-size: 0.875rem;
	color: var(--success-color);
	font-weight: 500;
	line-height: 1.2;
}

/* 主容器 */
.main-container {
	max-width: 90rem;
	margin: 0 auto;
	padding: 2.5rem 2rem;
}

/* 选项卡导航 */
.tab-navigation {
	display: flex;
	gap: 1rem;
	border-bottom: 2px solid var(--gray-100);
	margin-bottom: 2.5rem;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.tab-button {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 1rem 1.75rem;
	border: none;
	background: none;
	color: var(--gray-500);
	font-weight: 500;
	font-size: 0.9375rem;
	cursor: pointer;
	border-bottom: 3px solid transparent;
	transition: all 0.3s ease;
	white-space: nowrap;
}

.tab-button:hover {
	color: var(--gray-700);
}

.tab-button.active {
	color: var(--primary-color);
	border-bottom-color: var(--primary-color);
}

.tab-icon {
	width: 1.25rem;
	height: 1.25rem;
}

/* 内容卡片 */
.content-card {
	background: white;
	border-radius: 1rem;
	box-shadow: var(--shadow-md);
	padding: 2rem;
	animation: fadeInUp 0.4s ease-out;
	border: 1px solid var(--gray-100);
}

@keyframes fadeInUp {
	from {
		opacity: 0;
		transform: translateY(20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.card-title {
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--gray-900);
	margin-bottom: 1.5rem;
	letter-spacing: -0.02em;
}

/* 表单样式 */
.form-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 1.5rem;
}

.form-vertical {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
}

.form-group {
	display: flex;
	flex-direction: column;
}

.form-label {
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--gray-700);
	margin-bottom: 0.5rem;
}

.form-label.required::after {
	content: ' *';
	color: var(--danger-color);
}

.form-input {
	padding: 0.75rem 1rem;
	border: 2px solid var(--gray-200);
	border-radius: 0.5rem;
	font-size: 0.9375rem;
	transition: all 0.3s ease;
	background: white;
}

textarea.form-input {
	resize: vertical;
	min-height: 100px;
}

.form-input:focus {
	outline: none;
	border-color: var(--primary-color);
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-input:hover {
	border-color: var(--gray-300);
}

.form-hint {
	font-size: 0.75rem;
	color: var(--gray-500);
	margin-top: 0.375rem;
}

.form-actions {
	display: flex;
	gap: 1rem;
	margin-top: 1.5rem;
}

/* 按钮样式 */
.btn-primary,
.btn-success,
.btn-info,
.btn-warning,
.btn-danger,
.btn-outline-danger,
.btn-outline {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.625rem 1.25rem;
	border: none;
	border-radius: 0.5rem;
	font-weight: 600;
	font-size: 0.875rem;
	cursor: pointer;
	transition: all 0.3s ease;
	white-space: nowrap;
}

.btn-primary {
	background: var(--primary-color);
	color: white;
	box-shadow: var(--shadow);
}

.btn-primary:hover:not(:disabled) {
	background: var(--primary-hover);
	transform: translateY(-1px);
	box-shadow: var(--shadow-md);
}

.btn-outline {
	background: transparent;
	color: var(--gray-700);
	border: 2px solid var(--gray-300);
}

.btn-outline:hover:not(:disabled) {
	background: var(--gray-100);
	border-color: var(--gray-400);
}

.btn-outline-danger {
	background: transparent;
	color: var(--danger-color);
	border: 2px solid var(--danger-color);
}

.btn-outline-danger:hover:not(:disabled) {
	background: var(--danger-color);
	color: white;
}

.btn-copy {
	background: var(--primary-color);
	color: white;
	padding: 0.375rem 0.75rem;
	border: none;
	border-radius: 0.375rem;
	font-size: 0.75rem;
	font-weight: 500;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	transition: all 0.2s;
}

.btn-copy:hover {
	background: var(--primary-hover);
}

button:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.btn-loading {
	animation: spin 1s linear infinite;
}

.spinner {
	stroke: currentColor;
	stroke-dasharray: 50;
	stroke-dashoffset: 50;
	animation: dash 1.5s ease-in-out infinite;
}

@keyframes spin {
	to { transform: rotate(360deg); }
}

@keyframes dash {
	0% { stroke-dashoffset: 50; }
	50% { stroke-dashoffset: 0; }
	100% { stroke-dashoffset: -50; }
}

/* 通知样式 */
#notificationContainer {
	position: fixed;
	top: 1.5rem;
	right: 1.5rem;
	z-index: 50;
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.notification {
	min-width: 280px;
	max-width: 400px;
	padding: 1rem 1.25rem;
	border-radius: 0.5rem;
	box-shadow: var(--shadow-lg);
	transform: translateX(400px);
	opacity: 0;
	transition: all 0.4s cubic-bezier(0.23, 1, 0.320, 1);
}

.notification.show {
	transform: translateX(0);
	opacity: 1;
}

.notification-content {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.notification-icon {
	width: 1.25rem;
	height: 1.25rem;
	flex-shrink: 0;
}

.notification-success {
	background: var(--success-color);
	color: white;
}

.notification-error {
	background: var(--danger-color);
	color: white;
}

.notification-warning {
	background: var(--warning-color);
	color: white;
}

.notification-info {
	background: var(--info-color);
	color: white;
}

/* 弹窗样式 */
.modal {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	z-index: 50;
}

.modal-content {
	background: white;
	border-radius: 1rem;
	width: 100%;
	max-width: 48rem;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	box-shadow: var(--shadow-xl);
	animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
	from {
		opacity: 0;
		transform: scale(0.95) translateY(20px);
	}
	to {
		opacity: 1;
		transform: scale(1) translateY(0);
	}
}

.modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1.5rem;
	border-bottom: 1px solid var(--gray-100);
}

.modal-title {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--gray-900);
}

.modal-close {
	background: none;
	border: none;
	padding: 0.375rem;
	cursor: pointer;
	color: var(--gray-400);
	transition: all 0.2s;
	border-radius: 0.375rem;
}

.modal-close:hover {
	color: var(--gray-600);
	background: var(--gray-100);
}

.modal-body {
	padding: 1.5rem;
	overflow-y: auto;
}

.result-content {
	background: var(--gray-50);
	border: 1px solid var(--gray-200);
	border-radius: 0.5rem;
	padding: 1rem;
	font-family: 'Monaco', 'Courier New', monospace;
	font-size: 0.875rem;
	line-height: 1.6;
	overflow-x: auto;
	white-space: pre-wrap;
	word-break: break-word;
}

/* 分区标题 */
.section-title {
	font-size: 1rem;
	font-weight: 700;
	color: var(--gray-700);
	margin-top: 2rem;
	margin-bottom: 1rem;
	padding-bottom: 0.5rem;
	border-bottom: 1px solid var(--gray-200);
}

.section-title:first-child {
	margin-top: 0;
}

/* 数据表格 */
.data-table {
	width: 100%;
	border-collapse: collapse;
	background: white;
	overflow: hidden;
}

.table-header {
	background: var(--gray-50);
}

.table-header th {
	padding: 1rem;
	text-align: left;
	font-weight: 600;
	color: var(--gray-700);
	border-bottom: 2px solid var(--gray-200);
}

.table-row {
	transition: background-color 0.2s;
}

.table-row:hover {
	background-color: var(--gray-50);
}

.table-row td {
	padding: 0.875rem 1rem;
	border-bottom: 1px solid var(--gray-100);
	font-size: 0.875rem;
	color: var(--gray-700);
}

/* 统计卡片 */
.provider-stats-cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
	gap: 1.5rem;
	margin-bottom: 2rem;
}

.stat-card {
	background: white;
	padding: 1.5rem;
	border-radius: 1rem;
	box-shadow: var(--shadow);
	border: 1px solid var(--gray-100);
	display: flex;
	align-items: center;
	gap: 1.25rem;
	transition: all 0.3s ease;
}

.stat-card:hover {
	transform: translateY(-2px);
	box-shadow: var(--shadow-md);
}

.stat-icon {
	width: 4rem;
	height: 4rem;
	border-radius: 1rem;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.stat-content {
	flex: 1;
	min-width: 0;
}

.stat-label {
	font-size: 0.875rem;
	color: var(--gray-600);
	margin-bottom: 0.25rem;
}

.stat-value {
	font-size: 1.5rem;
	font-weight: 600;
	color: var(--gray-900);
}

/* 操作日志 */
.logs-container {
	max-width: 90rem;
	margin: 0 auto;
}

.logs-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 2rem;
}

.logs-title {
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--gray-900);
}

.logs-filters {
	display: flex;
	gap: 1rem;
	margin-bottom: 1.5rem;
	background: white;
	padding: 1.5rem;
	border-radius: 0.75rem;
	box-shadow: var(--shadow);
	border: 1px solid var(--gray-100);
}

.filter-group {
	flex: 1;
}

.filter-group input,
.filter-group select {
	width: 100%;
}

.logs-table-container {
	background: white;
	border-radius: 1rem;
	box-shadow: var(--shadow-md);
	overflow: hidden;
	border: 1px solid var(--gray-100);
}

.logs-table {
	width: 100%;
}

.logs-table thead th {
	background: var(--gray-50);
	font-weight: 600;
	color: var(--gray-700);
	padding: 1rem;
	text-align: left;
	font-size: 0.875rem;
	border-bottom: 2px solid var(--gray-200);
}

.log-row:hover {
	background-color: var(--gray-50);
}

.log-time {
	font-family: 'Monaco', 'Courier New', monospace;
	font-size: 0.875rem;
	color: var(--gray-600);
	white-space: nowrap;
}

.operator-info,
.target-info {
	display: flex;
	flex-direction: column;
	gap: 0.125rem;
}

.operator-name,
.target-name {
	font-weight: 500;
	color: var(--gray-900);
}

.operator-id,
.target-id {
	font-size: 0.75rem;
	color: var(--gray-500);
}

.log-action {
	padding: 0.25rem 0.75rem;
	border-radius: 9999px;
	font-size: 0.875rem;
	font-weight: 500;
	display: inline-block;
}

.action-create {
	background: #d1fae5;
	color: #065f46;
}

.action-update {
	background: #dbeafe;
	color: #1e40af;
}

.action-view {
	background: #e9d5ff;
	color: #6b21a8;
}

.action-delete {
	background: #fee2e2;
	color: #991b1b;
}

.action-news {
	background: #ffedd5;
	color: #ea580c;
}

.action-default {
	background: var(--gray-100);
	color: var(--gray-700);
}

.log-details {
	max-width: 300px;
}

.log-details-text {
	font-size: 0.875rem;
	color: var(--gray-600);
	display: block;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.log-details-json {
	color: var(--primary-color);
	cursor: pointer;
	font-size: 0.875rem;
	text-decoration: underline;
	transition: color 0.2s;
}

.log-details-json:hover {
	color: var(--primary-hover);
}

.log-ip {
	font-family: 'Monaco', 'Courier New', monospace;
	font-size: 0.875rem;
	color: var(--gray-600);
}

/* 加载状态 */
.loading-state,
.empty-state,
.logs-loading,
.no-logs {
	text-align: center;
	padding: 4rem 2rem;
	color: var(--gray-500);
}

.loading-spinner {
	margin: 0 auto 1.5rem;
	width: 3rem;
	height: 3rem;
}

.spinner-icon {
	animation: spin 1s linear infinite;
}

.spinner-circle {
	stroke: var(--primary-color);
	stroke-dasharray: 125;
	stroke-dashoffset: 125;
	animation: dash 1.5s ease-in-out infinite;
}

/* 广播通知优化样式 */
.news-create-card {
	background: white;
	border-radius: 1rem;
	box-shadow: var(--shadow-md);
	padding: 2rem;
	margin-bottom: 2rem;
	border: 1px solid var(--gray-100);
}

.news-card-header {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin-bottom: 1.5rem;
	padding-bottom: 1rem;
	border-bottom: 2px solid var(--gray-100);
}

.news-card-title {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--gray-900);
}

.news-form {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

.news-target-selector {
	margin-top: 0.5rem;
}

.target-options {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 1rem;
	margin-top: 0.75rem;
}

.target-option {
	position: relative;
	cursor: pointer;
}

.target-option input[type="radio"] {
	position: absolute;
	opacity: 0;
}

.target-option-content {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 1rem;
	border: 2px solid var(--gray-200);
	border-radius: 0.75rem;
	transition: all 0.2s;
}

.target-option input[type="radio"]:checked + .target-option-content {
	border-color: var(--primary-color);
	background-color: var(--primary-color);
	background-color: rgba(99, 102, 241, 0.05);
}

.target-option svg {
	color: var(--gray-400);
	transition: color 0.2s;
}

.target-option input[type="radio"]:checked + .target-option-content svg {
	color: var(--primary-color);
}

.target-title {
	font-weight: 600;
	color: var(--gray-900);
	font-size: 0.875rem;
}

.target-desc {
	font-size: 0.75rem;
	color: var(--gray-500);
}

.news-list-container {
	background: white;
	border-radius: 1rem;
	box-shadow: var(--shadow-md);
	padding: 1.5rem;
	border: 1px solid var(--gray-100);
}

.news-list-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 1.5rem;
	padding-bottom: 1rem;
	border-bottom: 1px solid var(--gray-100);
}

.news-list-title {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--gray-900);
}

.news-list {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.news-item {
	background: var(--gray-50);
	padding: 1.25rem;
	border-radius: 0.75rem;
	border: 1px solid var(--gray-200);
	transition: all 0.2s;
}

.news-item:hover {
	border-color: var(--gray-300);
	box-shadow: var(--shadow-sm);
}

.news-item-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	margin-bottom: 0.75rem;
}

.news-item-title {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.news-item-title h4 {
	font-size: 1rem;
	font-weight: 600;
	color: var(--gray-900);
}

.news-type-badge {
	padding: 0.25rem 0.75rem;
	border-radius: 9999px;
	font-size: 0.75rem;
	font-weight: 500;
}

.news-type-sys {
	background: #dbeafe;
	color: #1e40af;
}

.news-type-user {
	background: #d1fae5;
	color: #065f46;
}

.news-type-dna {
	background: #e9d5ff;
	color: #6b21a8;
}

.news-content {
	color: var(--gray-600);
	font-size: 0.875rem;
	line-height: 1.5;
	margin-bottom: 0.75rem;
}

.news-meta {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 0.75rem;
	color: var(--gray-500);
}

.news-time {
	display: flex;
	align-items: center;
	gap: 0.25rem;
}

.news-expire {
	font-weight: 500;
}

.news-expire.expired {
	color: var(--danger-color);
}

.news-expire.warning {
	color: var(--warning-color);
}

.delete-news-btn {
	background: none;
	border: none;
	padding: 0.25rem;
	cursor: pointer;
	color: var(--danger-color);
	opacity: 0.7;
	transition: opacity 0.2s;
	border-radius: 0.25rem;
}

.delete-news-btn:hover {
	opacity: 1;
	background-color: rgba(239, 68, 68, 0.1);
}

/* API 文档页面样式 */
.api-docs-container {
	max-width: 80rem;
	margin: 0 auto;
	padding: 1.5rem;
}

.api-section {
	background: white;
	border-radius: 1rem;
	padding: 2rem;
	margin-bottom: 1.5rem;
	box-shadow: var(--shadow-md);
	border: 1px solid var(--gray-100);
	animation: fadeInUp 0.4s ease-out;
}

.api-section-title {
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--gray-900);
	margin-bottom: 1.5rem;
	letter-spacing: -0.02em;
}

.api-link-card {
	background: var(--gray-50);
	padding: 1rem 1.5rem;
	border-radius: 0.5rem;
	border: 1px solid var(--gray-200);
}

.api-link {
	color: var(--primary-color);
	text-decoration: none;
	font-weight: 500;
	transition: all 0.2s;
}

.api-link:hover {
	color: var(--primary-hover);
	text-decoration: underline;
}

.providers-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 1rem;
	margin-bottom: 1.5rem;
}

.provider-card {
	background: var(--gray-50);
	padding: 1.25rem;
	border-radius: 0.75rem;
	border: 1px solid var(--gray-200);
	transition: all 0.3s ease;
}

.provider-card:hover {
	border-color: var(--primary-color);
	box-shadow: var(--shadow);
	transform: translateY(-2px);
}

.provider-card h3 {
	font-size: 1.125rem;
	font-weight: 600;
	color: var(--gray-900);
	margin-bottom: 0.5rem;
}

.provider-link {
	color: var(--primary-color);
	text-decoration: none;
	font-size: 0.875rem;
	transition: all 0.2s;
}

.provider-link:hover {
	color: var(--primary-hover);
	text-decoration: underline;
}

.api-note {
	background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
	color: white;
	padding: 1.5rem;
	border-radius: 0.75rem;
	margin-top: 1rem;
}

.api-note p {
	margin: 0;
	line-height: 1.6;
}

.code-example {
	margin-bottom: 2rem;
}

.code-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 0.75rem;
}

.code-header h3 {
	font-size: 1.125rem;
	font-weight: 600;
	color: var(--gray-900);
}

.btn-copy-code {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	background: var(--primary-color);
	color: white;
	border: none;
	padding: 0.5rem 1rem;
	border-radius: 0.375rem;
	font-size: 0.875rem;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s;
}

.btn-copy-code:hover {
	background: var(--primary-hover);
	transform: translateY(-1px);
}

.code-block {
	background: #1e293b;
	color: #e2e8f0;
	padding: 1.5rem;
	border-radius: 0.75rem;
	overflow-x: auto;
	font-family: 'Monaco', 'Courier New', monospace;
	font-size: 0.875rem;
	line-height: 1.5;
	box-shadow: var(--shadow);
}

.code-block code {
	display: block;
	white-space: pre;
}

/* 移动端优化 */
@media (max-width: 768px) {
	.api-docs-container {
		padding: 1rem;
	}

	.api-section {
		padding: 1.5rem;
		margin-bottom: 1rem;
	}

	.api-section-title {
		font-size: 1.25rem;
		margin-bottom: 1rem;
	}

	.providers-grid {
		grid-template-columns: 1fr;
		gap: 0.75rem;
	}

	.provider-card {
		padding: 1rem;
	}

	.api-note {
		padding: 1.25rem;
		font-size: 0.875rem;
	}

	.code-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.5rem;
	}

	.btn-copy-code {
		width: 100%;
		justify-content: center;
	}

	.code-block {
		padding: 1rem;
		font-size: 0.75rem;
	}

	.user-info-card {
		gap: 0.5rem;
		padding: 0.375rem 0.75rem;
	}

	.root-badge
	.manage-badge {
		width: 1.25rem;
		font-size: 0.6875rem;
		border-width: 1px;
	}

	.user-name,
	.user-balance {
		font-size: 0.75rem;
	}
}

@media (max-width: 640px) {
	.providers-grid {
		grid-template-columns: 1fr;
	}
}

/* 代码高亮增强 */
.code-block .api-base-url,
.code-block .api-base-url-anthropic {
	color: #fbbf24;
	font-weight: 500;
}

/* Provider 管理页面样式 */
.provider-list-container {
	background: white;
	border-radius: 1rem;
	box-shadow: var(--shadow-md);
	padding: 1.5rem;
	margin-top: 2rem;
	border: 1px solid var(--gray-100);
}

.provider-list-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 1.5rem;
}

.provider-list-title {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--gray-900);
}

.provider-levels {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.provider-level-card {
	background: var(--gray-50);
	border: 1px solid var(--gray-200);
	border-radius: 0.75rem;
	overflow: hidden;
	transition: all 0.3s ease;
}

.provider-level-card:hover {
	box-shadow: var(--shadow);
	border-color: var(--primary-color);
}

.level-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 1.25rem;
	background: white;
}

.level-info {
	flex: 1;
}

.level-title {
	font-size: 1.125rem;
	font-weight: 700;
	color: var(--gray-900);
	margin-bottom: 0.25rem;
}

.level-primary {
	font-size: 0.875rem;
	color: var(--gray-600);
}

.level-stats {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.stat-badge {
	padding: 0.25rem 0.75rem;
	background: white;
	border: 1px solid var(--gray-300);
	border-radius: 9999px;
	font-size: 0.75rem;
	font-weight: 500;
	color: var(--gray-700);
}

.btn-toggle-keys {
	background: none;
	border: none;
	padding: 0.5rem;
	cursor: pointer;
	color: var(--gray-600);
	transition: all 0.2s;
	border-radius: 0.375rem;
}

.btn-toggle-keys:hover {
	background: var(--gray-200);
	color: var(--gray-800);
}

.btn-toggle-keys svg {
	transition: transform 0.3s ease;
}

.btn-toggle-keys svg.rotate-180 {
	transform: rotate(180deg);
}

.level-providers {
	padding: 0 1.25rem 1.25rem;
	display: flex;
	align-items: center;
	gap: 0.75rem;
	flex-wrap: wrap;
}

.providers-label {
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--gray-700);
	margin: 0;
}

.providers-list {
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
}

.provider-tag {
	padding: 0.25rem 0.625rem;
	background: var(--primary-color);
	color: white;
	border-radius: 0.375rem;
	font-size: 0.75rem;
	font-weight: 500;
}

.level-keys {
	background: white;
	border-top: 1px solid var(--gray-200);
	overflow-x: auto;
}

.keys-table {
	width: 100%;
	border-collapse: collapse;
}

.keys-table thead th {
	background: var(--gray-50);
	padding: 0.75rem;
	text-align: left;
	font-weight: 600;
	color: var(--gray-700);
	font-size: 0.875rem;
	border-bottom: 1px solid var(--gray-200);
}

.key-row:hover {
	background-color: var(--gray-50);
}

.key-row td {
	padding: 0.75rem;
	border-bottom: 1px solid var(--gray-100);
	font-size: 0.875rem;
}

.key-id {
	font-weight: 600;
	color: var(--gray-900);
}

.key-name {
	color: var(--gray-700);
}

.key-provider {
	font-family: 'Monaco', 'Courier New', monospace;
	font-size: 0.8125rem;
	color: var(--gray-600);
}

.secret-key-display {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.secret-key-text {
	font-family: 'Monaco', 'Courier New', monospace;
	font-size: 0.75rem;
	color: var(--gray-700);
	max-width: 200px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.btn-copy-key {
	background: none;
	border: none;
	padding: 0.25rem;
	cursor: pointer;
	color: var(--gray-400);
	transition: all 0.2s;
	border-radius: 0.25rem;
}

.btn-copy-key:hover {
	background: var(--gray-100);
	color: var(--primary-color);
}

.status-badge {
	padding: 0.25rem 0.625rem;
	border-radius: 9999px;
	font-size: 0.75rem;
	font-weight: 500;
}

.status-active {
	background: #d1fae5;
	color: #065f46;
}

.status-inactive {
	background: #fee2e2;
	color: #991b1b;
}

.key-actions {
	display: flex;
	gap: 0.5rem;
}

.btn-edit-key,
.btn-delete-key {
	background: none;
	border: none;
	padding: 0.375rem;
	cursor: pointer;
	border-radius: 0.375rem;
	transition: all 0.2s;
}

.btn-edit-key {
	color: var(--info-color);
}

.btn-edit-key:hover {
	background: #dbeafe;
}

.btn-delete-key {
	color: var(--danger-color);
}

.btn-delete-key:hover {
	background: #fee2e2;
}

/* 系统配置样式 */
.config-form {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.config-section {
    background: var(--gray-50);
    border-radius: 0.75rem;
    padding: 1.5rem;
    border: 1px solid var(--gray-200);
}

.config-section .section-title {
    margin-top: 0;
    margin-bottom: 1.25rem;
    font-size: 1.125rem;
    color: var(--gray-800);
    border-bottom: 2px solid var(--gray-300);
    padding-bottom: 0.75rem;
}

.config-form .form-group {
    margin-bottom: 1rem;
}

.config-form .form-group:last-child {
    margin-bottom: 0;
}

.config-form textarea.form-input {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* 编辑弹窗特定样式 */
.secret-key-edit-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* 开关切换样式 */
.status-toggle {
    display: flex;
    align-items: center;
}

.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.toggle-switch input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
    background-color: var(--gray-300);
    border-radius: 24px;
    transition: background-color 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--success-color);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(24px);
}

.toggle-label {
    margin-left: 12px;
    display: flex;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.toggle-on,
.toggle-off {
    transition: opacity 0.3s;
}

.toggle-switch input:checked ~ .toggle-label .toggle-off {
    opacity: 0.5;
}

.toggle-switch input:not(:checked) ~ .toggle-label .toggle-on {
    opacity: 0.5;
}

/* 背景色辅助类 */
.bg-blue-100 {
	background: #dbeafe;
}

.text-blue-600 {
	color: #2563eb;
}

.bg-green-100 {
	background: #d1fae5;
}

.text-green-600 {
	color: #059669;
}

.bg-purple-100 {
	background: #e9d5ff;
}

.text-purple-600 {
	color: #9333ea;
}

/* 工具类 */
.hidden {
	display: none !important;
}

.col-span-2 {
	grid-column: span 2;
}

.w-full {
	width: 100%;
}

.text-red-600 {
	color: var(--danger-color);
}

.text-primary {
	color: var(--primary-color);
}

.hover\:underline:hover {
	text-decoration: underline;
}

.transform {
	transform: translateZ(0);
}

.transition-transform {
	transition-property: transform;
	transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
	transition-duration: 150ms;
}

.rotate-180 {
	transform: rotate(180deg);
}

/* SVG 图标尺寸 */
.w-16 {
	width: 4rem;
}

.h-16 {
	height: 4rem;
}

.w-8 {
	width: 2rem;
}

.h-8 {
	height: 2rem;
}

.w-6 {
	width: 1.5rem;
}

.h-6 {
	height: 1.5rem;
}

.w-5 {
	width: 1.25rem;
}

.h-5 {
	height: 1.25rem;
}

.w-4 {
	width: 1rem;
}

.h-4 {
	height: 1rem;
}

/* 间距 */
.mr-2 {
	margin-right: 0.5rem;
}

.mr-3 {
	margin-right: 0.75rem;
}

.mx-auto {
	margin-left: auto;
	margin-right: auto;
}

.mb-4 {
	margin-bottom: 1rem;
}

.mt-2 {
	margin-top: 0.5rem;
}

.mt-6 {
	margin-top: 1.5rem;
}

.space-y-6 > * + * {
	margin-top: 1.5rem;
}

/* 布局 */
.text-center {
	text-align: center;
}

.text-gray-500 {
	color: var(--gray-500);
}

.min-h-screen {
	min-height: 100vh;
}

.flex {
	display: flex;
}

.items-center {
	align-items: center;
}

.justify-center {
	justify-content: center;
}

.justify-between {
	justify-content: space-between;
}

.gap-1 {
	gap: 0.25rem;
}

/* 初始加载遮罩 */
#initialLoader {
	background: rgba(255, 255, 255, 0.95);
	backdrop-filter: blur(10px);
	transition: opacity 0.3s ease-in-out;
}

#initialLoader.fade-out {
	opacity: 0;
}

/* 页面切换动画 */
#loginPage, #mainApp {
	animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.tab-content {
	animation: fadeIn 0.3s ease-out;
}

/* 响应式设计 */
@media (max-width: 768px) {
	.login-card {
		padding: 2rem 1.5rem;
		margin: 1rem;
	}

	.login-title {
		font-size: 2rem;
	}

	.navbar-container {
		padding: 0 1rem;
	}

	.navbar-brand img {
		width: 48px;
	}

	.navbar-title {
		font-size: 1.25rem;
	}

	.navbar-actions {
		gap: 0.75rem;
	}

	.btn-outline-danger {
		padding: 0.5rem 0.75rem;
		font-size: 0.75rem;
	}

	.btn-outline-danger .w-4 {
		display: none;
	}

	.main-container {
		padding: 1.5rem 1rem;
	}

	.tab-navigation {
		gap: 0.25rem;
		margin-bottom: 1.5rem;
	}

	.tab-button {
		padding: 0.75rem 1rem;
		font-size: 0.875rem;
	}

	.tab-icon {
		width: 1rem;
		height: 1rem;
	}

	.content-card,
	.news-create-card,
	.news-list-container {
		padding: 1.5rem;
		border-radius: 0.75rem;
	}

	.card-title {
		font-size: 1.25rem;
		margin-bottom: 1.25rem;
	}

	.form-grid {
		grid-template-columns: 1fr;
		gap: 1rem;
	}

	.col-span-2 {
		grid-column: span 1;
	}

	.form-actions {
		margin-top: 1.25rem;
	}

	.logs-header {
		flex-direction: column;
		align-items: stretch;
		gap: 1rem;
	}

	.logs-filters {
		flex-direction: column;
		gap: 0.75rem;
		padding: 1rem;
	}

	.logs-table {
		font-size: 0.75rem;
	}

	.logs-table thead th,
	.logs-table tbody td {
		padding: 0.625rem 0.5rem;
	}

	.logs-table thead th:nth-child(6),
	.logs-table tbody td:nth-child(6) {
		display: none;
	}

	.modal-content {
		max-height: 95vh;
		border-radius: 0.75rem;
	}

	.modal-header {
		padding: 1.25rem;
	}

	.modal-body {
		padding: 1.25rem;
	}

	#notificationContainer {
		left: 1rem;
		right: 1rem;
		top: 1rem;
	}

	.notification {
		min-width: auto;
		padding: 0.875rem 1rem;
		font-size: 0.875rem;
	}

	.user-info-card {
		padding: 0.375rem 0.75rem;
	}

	.user-name,
	.user-balance {
		font-size: 0.75rem;
	}

	.provider-list-container {
		padding: 1.25rem;
		margin-left: -1rem;
		margin-right: -1rem;
		border-radius: 0;
	}

	.level-header {
		padding: 1rem;
	}

	.level-title {
		font-size: 1rem;
	}

	.level-providers {
		padding: 0 1rem 1rem;
	}

	.keys-table {
		font-size: 0.75rem;
	}

	.keys-table thead th,
	.keys-table tbody td {
		padding: 0.5rem;
	}

	.secret-key-text {
		max-width: 120px;
	}

	.root-badge {
		height: 2rem;
		width: 2rem;
		font-size: 0.875rem;
		border-width: 1.5px;
	}

	.target-options {
		grid-template-columns: 1fr;
	}

	.config-section {
		padding: 1.25rem;
	}

	.config-form .form-grid {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 640px) {
	.tab-navigation {
		scrollbar-width: none;
		-ms-overflow-style: none;
	}

	.tab-navigation::-webkit-scrollbar {
		display: none;
	}

	.tab-button {
		flex-direction: column;
		gap: 0.25rem;
		padding: 0.625rem 0.875rem;
	}

	.logs-title {
		font-size: 1.25rem;
	}

	.logs-table thead th:nth-child(5),
	.logs-table tbody td:nth-child(5) {
		display: none;
	}

	.provider-stats-cards {
		grid-template-columns: 1fr;
		gap: 1rem;
	}

	.stat-card {
		padding: 1rem;
	}

	.stat-icon {
		width: 3rem;
		height: 3rem;
	}

	.stat-value {
		font-size: 1.25rem;
	}

	.level-stats {
		gap: 0.5rem;
	}

	.stat-badge {
		font-size: 0.6875rem;
		padding: 0.125rem 0.5rem;
	}

	.keys-table thead th:nth-child(3),
	.keys-table tbody td:nth-child(3) {
		display: none;
	}

	#editKeyModal .modal-content {
		max-width: 100%;
		margin: 1rem;
	}
}

@media (max-width: 480px) {
	.form-input {
		font-size: 16px;
	}

	.keys-table thead th:nth-child(4),
	.keys-table tbody td:nth-child(4) {
		display: none;
	}
}

/* 滚动条样式 */
::-webkit-scrollbar {
	width: 8px;
	height: 8px;
}

::-webkit-scrollbar-track {
	background: var(--gray-50);
	border-radius: 4px;
}

::-webkit-scrollbar-thumb {
	background: var(--gray-300);
	border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
	background: var(--gray-400);
}

/* 焦点样式 */
*:focus-visible {
	outline: 2px solid var(--primary-color);
	outline-offset: 2px;
}

/* 打印样式 */
@media print {
	.navbar,
	.tab-navigation,
	.btn-primary,
	.btn-outline,
	.btn-outline-danger,
	#notificationContainer {
		display: none !important;
	}

	.content-card {
		box-shadow: none;
		border: 1px solid #000;
	}
}

/* 认证切换 */
.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
}

/* 成功消息 */
.success-message {
    text-align: center;
    padding: 2rem;
}

/* 表单切换动画 */
.auth-form-transition {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 注册相关的输入框提示 */
#signupForm .form-hint {
    color: var(--gray-600);
    font-size: 0.75rem;
    margin-top: 0.5rem;
}
/* Sidebar layout (fixed collapsed, icons only) */
@media (min-width: 1024px) {
  .main-container.has-sidebar { display: grid; grid-template-columns: 72px minmax(0,1fr); gap: 1.5rem; align-items: start; }
  .main-container.has-sidebar .tab-navigation { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; border-right: 1px solid var(--gray-100); padding-right: 0.5rem; position: sticky; top: 6rem; max-height: calc(100vh - 7rem); overflow-y: auto; background: transparent; margin-bottom: 0; }
  .main-container.has-sidebar .tab-button { width: 100%; justify-content: center; gap: 0; padding: 0.5rem; border: 0; border-radius: 0.5rem; color: var(--gray-600); font-size: 0; }
  .main-container.has-sidebar .tab-button:hover { background: var(--gray-50); color: var(--gray-800); }
  .main-container.has-sidebar .tab-button.active { background: var(--gray-100); }
  .main-container.has-sidebar .tab-button .tab-icon { width: 1.25rem; height: 1.25rem; margin: 0; }
  .main-container.has-sidebar > :not(.tab-navigation) { grid-column: 2; }
}
