/* ===== 后台公共样式 admin.css ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #1E3A8A;
    --secondary: #3B82F6;
    --accent: #F97316;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #DC2626;
    --bg-main: #F1F5F9;
    --bg-card: #FFFFFF;
    --text: #1E293B;
    --text-light: #64748B;
    --border: #E2E8F0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg-main);
    color: var(--text);
    font-size: 14px;
}

a { color: inherit; text-decoration: none; }

/* ===== 登录页 ===== */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1E3A8A 0%, #1e40af 100%);
    padding: 20px;
}
.login-box {
    background: white;
    border-radius: 20px;
    padding: 48px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}
.login-header { text-align: center; margin-bottom: 32px; }
.login-header .logo-icon {
    width: 64px; height: 64px;
    background: linear-gradient(135deg, #F97316, #EA580C);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px; font-size: 32px;
}
.login-header h2 { color: var(--primary); font-size: 24px; margin-bottom: 8px; }
.login-header p { color: var(--text-light); font-size: 14px; }
.error-msg {
    background: #FEE2E2; color: #DC2626;
    padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 20px; display: none;
}

/* ===== 登录表单/通用表单 ===== */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.form-group label .required { color: var(--accent); }
.form-control, input[type=text], input[type=password], input[type=email], input[type=number],
input[type=url], input[type=datetime-local], select, textarea {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    transition: all 0.25s;
}
.form-control:focus, .form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hint { font-size: 12px; color: var(--text-light); margin-top: 6px; }

/* ===== 按钮 ===== */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 22px; border-radius: 10px; font-size: 14px; font-weight: 600;
    border: none; cursor: pointer; transition: all 0.25s; font-family: inherit;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #EA580C; transform: translateY(-1px); }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover { background: #2563EB; }
.btn-ghost { background: var(--bg-main); color: var(--text); }
.btn-ghost:hover { background: #e2e8f0; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ===== 布局 ===== */
.admin-layout { display: flex; min-height: 100vh; }

/* 侧边栏 */
.sidebar {
    width: 250px; background: var(--primary); color: #fff;
    position: fixed; top: 0; bottom: 0; left: 0; overflow-y: auto; z-index: 100;
}
.sidebar-header { padding: 22px 20px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-brand { display: flex; align-items: center; gap: 12px; }
.sidebar-brand .logo-icon {
    width: 40px; height: 40px; background: var(--accent); border-radius: 8px;
    display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.sidebar-brand h3 { font-size: 15px; font-weight: 700; line-height: 1.3; }
.sidebar-brand p { font-size: 12px; opacity: 0.7; }
.sidebar-nav { padding: 16px 0; }
.nav-section { padding: 12px 20px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; opacity: 0.5; font-weight: 600; }
.nav-item {
    display: flex; align-items: center; gap: 12px; padding: 11px 20px;
    color: rgba(255,255,255,0.85); font-size: 14px; transition: all 0.2s; border-left: 3px solid transparent;
}
.nav-item:hover, .nav-item.active { color: #fff; background: rgba(255,255,255,0.06); }
.nav-item.active { border-left-color: var(--accent); }
.nav-item i { width: 20px; text-align: center; }
.nav-badge { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 700; }

/* 主内容 */
.main-content { flex: 1; margin-left: 250px; min-width: 0; }
.topbar {
    background: var(--bg-card); padding: 14px 28px; display: flex; align-items: center;
    border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50;
}
.topbar-left { font-size: 19px; font-weight: 700; color: var(--primary); }
.topbar-right { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.topbar-item {
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
    border-radius: 8px; cursor: pointer; color: var(--text-light); transition: all 0.2s; position: relative;
}
.topbar-item:hover { background: var(--bg-main); color: var(--text); }
.topbar-item .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; background: var(--accent); border-radius: 50%; }
.user-menu { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--secondary); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; }
.page-content { padding: 28px; }

/* 统计卡片 */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 24px; }
.stat-card { background: var(--bg-card); border-radius: 14px; padding: 22px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.stat-card .label { font-size: 13px; color: var(--text-light); margin-bottom: 8px; }
.stat-card .value { font-size: 30px; font-weight: 800; color: var(--primary); }
.stat-card .value small { font-size: 14px; color: var(--text-light); font-weight: 500; }
.stat-card .sub { font-size: 12px; color: var(--text-light); margin-top: 6px; }

/* 卡片容器 */
.card { background: var(--bg-card); border-radius: 14px; padding: 22px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); margin-bottom: 24px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.card-header h3 { font-size: 16px; font-weight: 700; }
.card-header .actions { display: flex; gap: 8px; }

/* 数据表格 */
.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px 14px; text-align: left; font-size: 14px; }
.data-table th { color: var(--text-light); font-weight: 600; border-bottom: 2px solid var(--border); white-space: nowrap; }
.data-table td { border-bottom: 1px solid var(--border); }
.data-table tbody tr:hover { background: #f8fafc; }
.thumbs { width: 64px; height: 44px; object-fit: cover; border-radius: 6px; }

/* 状态徽章 */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-new { background: #DBEAFE; color: #2563EB; }
.badge-contacted { background: #FEF3C7; color: #B45309; }
.badge-quoted { background: #D1FAE5; color: #059669; }
.badge-won { background: #DCFCE7; color: #16A34A; }
.badge-lost { background: #FEE2E2; color: #DC2626; }
.badge-draft { background: #E5E7EB; color: #6B7280; }
.badge-published { background: #D1FAE5; color: #059669; }
.badge-running { background: #D1FAE5; color: #059669; }
.badge-maintenance { background: #FEF3C7; color: #B45309; }
.badge-offline { background: #FEE2E2; color: #DC2626; }
.badge-dev { background: #EDE9FE; color: #7C3AED; }

/* 操作按钮 */
.action-btns { display: flex; gap: 6px; }
.icon-btn {
    width: 32px; height: 32px; border-radius: 6px; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center; color: var(--text-light); background: transparent; transition: all 0.2s;
}
.icon-btn:hover { background: var(--bg-main); color: var(--secondary); }
.icon-btn.danger:hover { color: var(--danger); }

/* 我的网站卡片 */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.project-card {
    background: var(--bg-card); border-radius: 14px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid var(--border); transition: all 0.2s; display: flex; flex-direction: column; gap: 10px;
}
.project-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,0.1); }
.project-card .pc-head { display: flex; align-items: center; gap: 12px; }
.project-card .pc-icon { width: 44px; height: 44px; border-radius: 10px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.project-card .pc-name { font-weight: 700; font-size: 15px; }
.project-card .pc-cat { font-size: 12px; color: var(--text-light); }
.project-card .pc-desc { font-size: 13px; color: var(--text-light); line-height: 1.5; min-height: 38px; }
.project-card .pc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--border); }
.project-card .pc-account { font-size: 12px; color: var(--text-light); }

/* 文章列表 */
.article-item { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); align-items: center; }
.article-item img { width: 80px; height: 54px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.article-item .ai-main { flex: 1; min-width: 0; }
.article-item .ai-title { font-weight: 600; }
.article-item .ai-meta { font-size: 12px; color: var(--text-light); margin-top: 4px; }

/* 媒体库 */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.media-item { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; position: relative; }
.media-item img { width: 100%; height: 120px; object-fit: cover; display: block; cursor: pointer; }
.media-item .mi-name { font-size: 11px; color: var(--text-light); padding: 6px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-item .mi-del { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 6px; background: rgba(220,38,38,0.9); color: #fff; border: none; cursor: pointer; display: none; align-items: center; justify-content: center; }
.media-item:hover .mi-del { display: flex; }

/* 弹窗 */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.55); z-index: 2000; display: none; align-items: flex-start; justify-content: center; padding: 40px 20px; overflow-y: auto; }
.modal-overlay.active { display: flex; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 640px; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.3); }
.modal-lg { max-width: 860px; }
.modal-header { padding: 20px 24px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 18px; color: var(--primary); }
.modal-body { padding: 24px; }
.modal-close { background: none; border: none; font-size: 22px; color: var(--text-light); cursor: pointer; width: 34px; height: 34px; border-radius: 8px; }
.modal-close:hover { background: var(--bg-main); color: var(--text); }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* Toast */
.toast-wrap { position: fixed; top: 24px; right: 24px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; }
.toast { background: #fff; border-left: 4px solid var(--secondary); padding: 14px 18px; border-radius: 8px; box-shadow: 0 8px 20px rgba(0,0,0,0.15); font-size: 14px; min-width: 240px; animation: slideIn 0.25s; }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--secondary); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* 富文本工具条 */
.editor-toolbar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.editor-toolbar button { width: 34px; height: 34px; border: 1px solid var(--border); background: #fff; border-radius: 6px; cursor: pointer; color: var(--text); }
.editor-toolbar button:hover { background: var(--bg-main); }
#articleContent { min-height: 280px; font-size: 14px; }

/* 过滤栏 */
.filter-bar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; }
.filter-bar .form-control { width: auto; min-width: 160px; }
.filter-bar .grow { flex: 1; min-width: 200px; }

/* 空状态 */
.empty { text-align: center; color: var(--text-light); padding: 40px 0; }
.empty i { font-size: 40px; opacity: 0.4; margin-bottom: 12px; display: block; }

/* 响应式 */
@media (max-width: 1024px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .menu-toggle { display: flex !important; }
}
.menu-toggle { display: none; width: 40px; height: 40px; align-items: center; justify-content: center; background: var(--bg-main); border: none; border-radius: 8px; cursor: pointer; color: var(--text); margin-right: 12px; }
