/* ===== 发菜模式工坊 - 后台深色科技风 ===== */

:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: #1a2236;
    --bg-input: #0f1729;
    --bg-hover: #1e293b;
    --border-color: #1e3a5f;
    --border-light: #2d4a6f;
    --text-primary: #e8edf5;
    --text-secondary: #8899b4;
    --text-muted: #5a6a85;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-glow: rgba(59, 130, 246, 0.25);
    --success: #22c55e;
    --warning: #eab308;
    --error: #ef4444;
    --sidebar-width: 240px;
    --header-height: 56px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* ===== 侧边栏 ===== */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    z-index: 100;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand .logo {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 700; color: #fff;
    flex-shrink: 0;
}

.sidebar-brand .brand-text {
    font-size: 14px; font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.sidebar-brand .brand-text small {
    display: block;
    font-size: 11px; font-weight: 400;
    color: var(--text-muted);
}

.sidebar-user {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
}

.sidebar-nav {
    padding: 12px 0;
    flex: 1;
}

.sidebar-nav .nav-section {
    padding: 8px 20px 4px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-nav a.active {
    color: var(--accent);
    background: rgba(59, 130, 246, 0.08);
    border-left-color: var(--accent);
}

.sidebar-nav a .nav-icon {
    width: 18px; text-align: center;
    font-size: 15px;
    flex-shrink: 0;
}

.sidebar-nav a .badge {
    margin-left: auto;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 600;
}

.sidebar-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s;
}

.sidebar-footer a:hover { color: var(--error); }

/* ===== 主内容区 ===== */
.main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.header-actions .admin-name {
    color: var(--accent);
    font-weight: 500;
}

.content {
    padding: 24px 28px;
}

/* ===== 卡片 ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ===== 仪表盘统计卡片 ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: border-color 0.2s;
}

.stat-card:hover {
    border-color: var(--accent);
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-card .stat-icon {
    font-size: 20px;
}

/* ===== 表单 ===== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    font-family: inherit;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.6;
}

select.form-control {
    cursor: pointer;
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.form-check input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

.form-check label {
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    font-family: inherit;
    line-height: 1;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 0 16px var(--accent-glow);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: var(--error);
    color: #fff;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-group {
    display: flex;
    gap: 8px;
}

/* ===== 表格 ===== */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

table th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(30, 58, 95, 0.4);
    color: var(--text-secondary);
}

table tr:hover td {
    background: rgba(59, 130, 246, 0.03);
}

table td .role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.role-badge.admin {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
}

.role-badge.user {
    background: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
}

.role-badge.published {
    background: rgba(34, 197, 94, 0.12);
    color: #4ade80;
}

.role-badge.draft {
    background: rgba(234, 179, 8, 0.12);
    color: #facc15;
}

/* ===== 搜索栏 ===== */
.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.search-bar .form-control {
    max-width: 300px;
}

/* ===== 消息提示 ===== */
.alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 14px;
}

/* ===== 操作列 ===== */
.action-col {
    white-space: nowrap;
}

/* ===== 分页信息 ===== */
.page-info {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 12px;
}

/* ===== 登录页独立样式 ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(59, 130, 246, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(139, 92, 246, 0.05) 0%, transparent 50%);
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 40px 36px 32px;
    width: 380px;
    max-width: 90vw;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
}
@media (max-width: 480px) {
    .login-card {
        padding: 28px 16px 24px;
        max-width: 82vw;
    }
}

.login-card .brand {
    text-align: center;
    margin-bottom: 32px;
}

.login-card .brand .logo {
    width: 48px; height: 48px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 700; color: #fff;
    margin-bottom: 12px;
}

.login-card .brand h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.login-card .brand p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.login-card .form-group {
    margin-bottom: 18px;
}

.login-card .form-group label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.login-card .btn {
    width: 100%;
    justify-content: center;
    padding: 11px;
    font-size: 14px;
    margin-top: 8px;
}

.login-card .login-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== 编辑器工具栏 ===== */
.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    align-items: center;
}
.editor-toolbar .sep {
    width: 1px;
    height: 22px;
    background: var(--border-color);
    margin: 0 4px;
    flex-shrink: 0;
}
.editor-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    line-height: 1.4;
    white-space: nowrap;
}
.editor-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-color);
}
.editor-btn.tag-h2 { font-size: 14px; font-weight: 700; }
.editor-btn.tag-h3 { font-size: 13px; font-weight: 600; }
.editor-btn.tag-p { font-size: 12px; }
.editor-btn.tag-strong { font-weight: 700; }
.editor-btn.tag-code {
    font-family: monospace;
    background: rgba(59,130,246,0.08);
    color: #60a5fa;
}
.editor-btn.tag-code:hover {
    background: rgba(59,130,246,0.15);
}
.editor-btn.tag-tip {
    color: #60a5fa;
}
.editor-btn.tag-img {
    color: #4ade80;
}
.editor-btn.tag-a {
    color: #a78bfa;
}
textarea.editor-textarea {
    border-radius: 0 0 8px 8px !important;
    border-top: none !important;
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main { margin-left: 0; }
    .content { padding: 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .header { padding: 0 16px; }
}
