/* =========================================================
   Etsy 电商平台管理系统 - 全局样式
   ========================================================= */
:root {
    --primary: #f56400;
    --primary-dark: #d95700;
    --bg: #f5f6f8;
    --sidebar-bg: #1f2430;
    --sidebar-text: #b8bcc8;
    --card-bg: #ffffff;
    --text: #2b2f36;
    --text-light: #7a7f8a;
    --border: #e7e9ee;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --info: #3498db;
}

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

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

a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* ---------- 登录页 ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f56400 0%, #f8a14d 100%);
}
.login-box {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    width: 380px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}
.login-box h1 {
    font-size: 24px;
    text-align: center;
    margin-bottom: 8px;
    color: var(--text);
}
.login-box .subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 28px;
}
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text);
}
.form-group input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color .2s;
}
.form-group input:focus { border-color: var(--primary); }
.btn {
    display: inline-block;
    padding: 11px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all .2s;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
    width: 100%;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-outline {
    background: #fff;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-outline:hover { background: #fff5ef; }
.login-error {
    color: var(--danger);
    text-align: center;
    margin-bottom: 12px;
    min-height: 20px;
    font-size: 13px;
}
.login-tip {
    margin-top: 16px;
    text-align: center;
    color: var(--text-light);
    font-size: 12px;
}

/* ---------- 主布局 ---------- */
.layout {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: 220px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.sidebar .logo {
    padding: 20px;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sidebar .logo .dot {
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
    display: inline-block;
}
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    font-size: 14px;
    transition: all .2s;
    cursor: pointer;
}
.sidebar-nav li a:hover { background: #2a3140; color: #fff; }
.sidebar-nav li a.active {
    background: var(--primary);
    color: #fff;
}
.sidebar-nav li a .icon { width: 18px; text-align: center; }

/* ---------- 主内容 ---------- */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.topbar {
    height: 60px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
}
.topbar .title { font-size: 18px; font-weight: 600; }
.topbar .spacer { flex: 1; }
.shop-select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    outline: none;
}
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}
.logout-btn { color: var(--text-light); font-size: 13px; cursor: pointer; }
.logout-btn:hover { color: var(--danger); }

.content {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
}

/* ---------- 数据卡片 ---------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.stat-card .label { color: var(--text-light); font-size: 13px; margin-bottom: 8px; }
.stat-card .value { font-size: 26px; font-weight: 700; }
.stat-card .value.primary { color: var(--primary); }
.stat-card .value.success { color: var(--success); }
.stat-card .value.danger { color: var(--danger); }
.stat-card .value.warning { color: var(--warning); }

/* ---------- 面板 ---------- */
.panel {
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    margin-bottom: 20px;
    overflow: hidden;
}
.panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}
.panel-header h3 { font-size: 16px; font-weight: 600; }
.panel-body { padding: 20px; }

/* ---------- 快捷操作 ---------- */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.quick-action {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 18px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: all .2s;
}
.quick-action:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0,0,0,.1); }
.quick-action .icon { font-size: 26px; margin-bottom: 8px; }
.quick-action .text { font-size: 13px; color: var(--text); }

/* ---------- 表格 ---------- */
table {
    width: 100%;
    border-collapse: collapse;
}
table th, table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
table th {
    background: #fafbfc;
    font-weight: 600;
    color: var(--text-light);
    white-space: nowrap;
}
table tr:hover td { background: #fafbfc; }

/* ---------- 徽章 ---------- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}
.badge-success { background: #e8f8ef; color: var(--success); }
.badge-warning { background: #fef5e7; color: var(--warning); }
.badge-danger { background: #fdecea; color: var(--danger); }
.badge-info { background: #eaf4fb; color: var(--info); }
.badge-gray { background: #f0f1f3; color: var(--text-light); }

/* ---------- 筛选栏 ---------- */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}
.filter-bar select, .filter-bar input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    outline: none;
}

/* ---------- 预警列表 ---------- */
.alert-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border);
}
.alert-item:last-child { border-bottom: none; }
.alert-item .alert-icon { font-size: 18px; }
.alert-item .alert-body { flex: 1; }
.alert-item .alert-title { font-weight: 500; margin-bottom: 2px; }
.alert-item .alert-detail { color: var(--text-light); font-size: 12px; }

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar .logo span:last-child,
    .sidebar-nav li a span:last-child { display: none; }
    .content { padding: 16px; }
    .card-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- 模态框 ---------- */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal {
    background: #fff;
    border-radius: 12px;
    padding: 28px;
    width: 520px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}
.modal h2 { margin-bottom: 20px; font-size: 18px; }
.modal .form-group input,
.modal .form-group select,
.modal .form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
}
.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}
.btn-gray { background: #eef0f3; color: var(--text); }

/* ---------- 图表 ---------- */
.chart-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}
.chart-container {
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    padding: 20px;
}
.chart-container h3 {
    font-size: 15px;
    margin-bottom: 14px;
    color: var(--text);
}
.chart {
    width: 100%;
    height: 420px;
}
.chart-sm { height: 420px; }
@media (max-width: 900px) {
    .chart-grid { grid-template-columns: 1fr; }
}
