/* 蛙音后台样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-login-box {
    width: 380px;
    max-width: 90vw;
    background: #fff;
    border-radius: 16px;
    padding: 40px 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.admin-login-header {
    text-align: center;
    margin-bottom: 32px;
}

.admin-logo {
    font-size: 48px;
    margin-bottom: 8px;
}

.admin-login-header h1 {
    font-size: 22px;
    color: #333;
    margin-bottom: 4px;
}

.admin-login-header p {
    font-size: 14px;
    color: #888;
}

.login-error {
    margin-bottom: 16px;
    padding: 10px 14px;
    border-radius: 8px;
    background: #fff1f0;
    border: 1px solid #ffccc7;
    color: #cf1322;
    font-size: 14px;
}

.admin-login-form .form-item {
    margin-bottom: 16px;
}

.admin-login-form input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    outline: none;
    background: #fafafa;
}

.admin-login-form input:focus {
    border-color: #667eea;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-submit {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.3s ease;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* ============================
   后台管理布局
   ============================ */
body.admin-body {
    display: block;
    align-items: initial;
    justify-content: initial;
    background: #f4f6fb;
    min-height: 100vh;
    color: #2b2f3a;
}

.admin-shell {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 232px;
    background: #ffffff;
    border-right: 1px solid #eef0f7;
    display: flex;
    flex-direction: column;
    z-index: 20;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 20px 18px;
}

.brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.brand-text strong {
    font-size: 16px;
    color: #2b2f3a;
}

.brand-text span {
    font-size: 12px;
    color: #9aa0b4;
}

.sidebar-nav {
    flex: 1;
    padding: 8px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    color: #6b7280;
    font-size: 14px;
    text-decoration: none;
    transition: all .2s ease;
}

.nav-item i {
    font-size: 18px;
}

.nav-item:hover {
    background: #f5f6fc;
    color: #4c56a8;
}

.nav-item.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    box-shadow: 0 8px 20px rgba(102, 126, 234, .3);
}

.nav-item.logout {
    color: #e05555;
}

.sidebar-foot {
    padding: 14px;
    border-top: 1px solid #f0f1f7;
}

.admin-main {
    margin-left: 232px;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.admin-topbar {
    height: 68px;
    background: rgba(255, 255, 255, .86);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #eef0f7;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 15;
}

.admin-topbar h2 {
    font-size: 19px;
    font-weight: 600;
    color: #24283a;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 18px;
    color: #8b90a6;
    font-size: 13px;
}

.topbar-admin {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f2f3fa;
    padding: 7px 14px;
    border-radius: 20px;
    color: #5a61a8;
    font-weight: 500;
}

.admin-content {
    padding: 24px 28px 40px;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

/* 统计卡片 */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-bottom: 22px;
}

.stat-card {
    background: #fff;
    border-radius: 16px;
    padding: 22px 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    border: 1px solid #f0f1f8;
    box-shadow: 0 6px 22px rgba(24, 31, 67, .05);
    transition: transform .25s ease, box-shadow .25s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(24, 31, 67, .09);
}

.stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.stat-icon.purple { background: rgba(102, 126, 234, .12); color: #667eea; }
.stat-icon.blue   { background: rgba(56, 189, 248, .14); color: #0ea5e9; }
.stat-icon.green  { background: rgba(34, 197, 148, .14); color: #10b981; }

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 13px;
    color: #8b90a6;
}

.stat-value {
    font-size: 30px;
    line-height: 1.1;
    color: #23273a;
    font-weight: 700;
    letter-spacing: .5px;
}

/* 面板 */
.panel {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #f0f1f8;
    box-shadow: 0 6px 22px rgba(24, 31, 67, .05);
    padding: 22px 24px;
    margin-bottom: 22px;
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.panel-head h3 {
    font-size: 16px;
    color: #24283a;
    font-weight: 600;
}

.panel-head p {
    font-size: 13px;
    color: #949bb2;
    margin-top: 4px;
}

.chart-legend {
    display: flex;
    gap: 18px;
    font-size: 13px;
    color: #7c8298;
    align-items: center;
}

.chart-legend span { display: flex; align-items: center; gap: 6px; }

.dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
}

.dot.purple { background: #667eea; }
.dot.green { background: #10b981; }

.chart-body {
    position: relative;
    width: 100%;
    height: 320px;
}

#trendChart {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

.chart-empty {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    color: #b3b8cc;
    font-size: 14px;
}

.note-panel {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    color: #7c8298;
    font-size: 13px;
    line-height: 1.7;
}

.note-panel i {
    color: #667eea;
    font-size: 18px;
    margin-top: 2px;
}

.note-panel strong { color: #4a4f66; display: block; margin-bottom: 2px; }

/* 表格与工具条 */
.toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.input {
    height: 40px;
    padding: 0 14px;
    border: 1px solid #e6e8f2;
    border-radius: 10px;
    background: #fafbfe;
    font-size: 14px;
    color: #333;
    outline: none;
    transition: all .2s ease;
    font-family: inherit;
}

.input:focus {
    border-color: #667eea;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, .12);
}

.input.select {
    min-width: 120px;
    cursor: pointer;
}

.btn {
    height: 40px;
    padding: 0 18px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    transition: all .2s ease;
}

.btn.primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    box-shadow: 0 6px 16px rgba(102, 126, 234, .28);
}

.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(102, 126, 234, .36); }

.btn.ghost {
    background: #fff;
    border-color: #e6e8f2;
    color: #5a6075;
}

.btn.ghost:hover { border-color: #cfd4ea; color: #4c56a8; }

.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }

.table-wrap { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 820px;
}

.data-table thead th {
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: #8b90a6;
    background: #f7f8fc;
    padding: 12px 14px;
    white-space: nowrap;
}

.data-table thead th:first-child { border-radius: 10px 0 0 10px; }
.data-table thead th:last-child { border-radius: 0 10px 10px 0; }

.data-table tbody td {
    padding: 14px;
    border-bottom: 1px solid #f2f3f9;
    color: #3a3f52;
    vertical-align: middle;
}

.data-table tbody tr:hover td { background: #fafbff; }

.text-right { text-align: right !important; }

.user-cell { display: flex; align-items: center; gap: 10px; }

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }

.user-meta { display: flex; flex-direction: column; line-height: 1.3; }
.user-meta strong { font-size: 14px; color: #2c3044; }
.user-meta span { font-size: 12px; color: #9aa0b4; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge.ok { background: rgba(16, 185, 129, .12); color: #059669; }
.badge.off { background: rgba(239, 68, 68, .1); color: #dc2626; }
.badge.online { background: rgba(59, 130, 246, .1); color: #2563eb; }
.badge.muted { background: #f1f2f8; color: #8b90a6; }

.link-btn {
    border: none;
    background: none;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    font-family: inherit;
}

.link-btn.warn { color: #d97706; }
.link-btn.danger { color: #dc2626; }
.link-btn:hover { background: rgba(0, 0, 0, .04); }

.table-empty {
    text-align: center;
    color: #a3a8bd;
    padding: 36px 0 !important;
}

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    font-size: 13px;
    color: #8b90a6;
}

.pager-btns { display: flex; align-items: center; gap: 10px; }

.pager-btns .btn { height: 34px; padding: 0 14px; font-size: 13px; }

/* 表单配置 */
.config-form { display: flex; flex-direction: column; gap: 16px; }

.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.form-field { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 8px; }
.form-field.sm { flex: 0 0 150px; min-width: 120px; }

.form-field label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

.form-actions { display: flex; gap: 12px; padding-top: 6px; }

.test-row { display: flex; gap: 12px; flex-wrap: wrap; }
.test-row .input { flex: 1; min-width: 240px; }

.test-result { margin-top: 12px; font-size: 13px; display: none; }
.test-result.show { display: block; }
.test-result.ok { color: #059669; }
.test-result.err { color: #dc2626; }

/* 提示 */
.admin-toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translate(-50%, -20px);
    background: rgba(35, 39, 58, .92);
    color: #fff;
    padding: 11px 20px;
    border-radius: 10px;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: all .28s ease;
    z-index: 9999;
    max-width: 80vw;
}

.admin-toast.show { opacity: 1; transform: translate(-50%, 0); }
.admin-toast.ok { background: #10b981; }
.admin-toast.err { background: #ef4444; }

@media (max-width: 900px) {
    .admin-sidebar { width: 68px; }
    .brand-text, .nav-item span { display: none; }
    .sidebar-nav, .sidebar-foot { padding: 8px; }
    .nav-item { justify-content: center; padding: 14px 0; }
    .sidebar-brand { justify-content: center; padding: 20px 0; }
    .admin-main { margin-left: 68px; }
    .stat-grid { grid-template-columns: 1fr; }
    .admin-content { padding: 18px 16px 30px; }
}
