/* ==================== 全局变量与重置 ==================== */
:root {
    --primary-color: #3b82f6; /* 现代蓝 */
    --primary-hover: #2563eb;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --text-main: #1f2937;
    --text-secondary: #6b7280;
    --bg-body: #f3f4f6;
    --bg-card: #ffffff;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
}

/* ==================== 顶部状态栏 (Sticky 固定) ==================== */
.status-bar {
    position: sticky;
    top: -20px; /* 抵消body的padding，贴顶 */
    z-index: 100;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px); /* 毛玻璃效果 */
    border-bottom: 1px solid var(--border-color);
    padding: 12px 20px;
    margin: -20px -20px 20px -20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
}

.status-content {
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #d1d5db;
    margin-right: 8px;
    transition: background-color 0.3s ease;
}

.status-dot.online {
    background-color: var(--success-color);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.status-dot.offline {
    background-color: var(--danger-color);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.api-info {
    font-size: 12px;
    color: var(--text-secondary);
    background: #f9fafb;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    font-family: Consolas, Monaco, "Andale Mono", monospace;
}

/* ==================== 主容器样式 ==================== */
.container {
    max-width: 480px;
    margin: 0 auto;
    background: var(--bg-card);
    padding: 40px 30px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

/* Admin 页面容器更宽 */
.container.admin {
    max-width: 1000px;
    padding: 30px;
}

/* ==================== 标题 ==================== */
h1, h2 {
    margin-top: 0;
    color: var(--text-main);
    font-weight: 700;
}

h1 { font-size: 24px; margin-bottom: 25px; }
h2 { font-size: 18px; margin-bottom: 15px; border-left: 4px solid var(--primary-color); padding-left: 10px; }

/* ==================== 表单元素 ==================== */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
    background-color: #f9fafb;
    color: var(--text-main);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ==================== 按钮样式 ==================== */
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: 6px;
    background-color: var(--primary-color);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

button:active {
    transform: translateY(0);
}

button.block {
    width: 100%;
    padding: 12px;
    font-size: 16px;
}

/* ==================== 消息提示 ==================== */
.message {
    margin-top: 20px;
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
    display: none;
    animation: fadeIn 0.3s ease;
}

.message.show { display: block; }

.success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ==================== Admin 面板特定样式 ==================== */
.section {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.section:last-child {
    border-bottom: none;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.input-group input {
    flex: 1;
}

/* 列表组 (数据表格风格) */
.list-group {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden; /* 确保子元素圆角不溢出 */
    background: #fff;
}

.list-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    transition: background-color 0.1s;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:hover {
    background-color: #f9fafb;
}

/* 徽章样式 */
.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 9999px; /* 全圆角 */
    letter-spacing: 0.025em;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

/* 动画 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 响应式适配 */
@media (max-width: 640px) {
    body { padding: 10px; }
    .container { padding: 20px; }
    .status-bar { margin: -10px -10px 20px -10px; top: -10px; }
    .input-group { flex-direction: column; gap: 10px; }
    .input-group button { width: 100%; }
}
