/* ========================================
   小喻子人人都会用的调研平台 - 后台管理样式
   ======================================== */

:root {
    --primary: #667eea;
    --primary-dark: #5a6fd6;
    --primary-light: #e8ecff;
    --success: #52c41a;
    --warning: #faad14;
    --danger: #f5222d;
    --info: #1890ff;
    --text: #1a1a2e;
    --text-secondary: #6c757d;
    --text-light: #adb5bd;
    --bg: #f0f2f5;
    --bg-card: #ffffff;
    --bg-hover: #f8f9fa;
    --border: #e8e8e8;
    --border-light: #f0f0f0;
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius: 8px;
    --radius-sm: 6px;
    --sidebar-w: 220px;
}

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

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

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

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

.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s;
}

.sidebar-logo {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo .logo-icon { font-size: 32px; }
.sidebar-logo h2 { font-size: 16px; margin-top: 4px; font-weight: 600; }
.sidebar-logo p { font-size: 11px; opacity: 0.6; margin-top: 2px; }

.sidebar-nav { padding: 12px 0; }
.sidebar-nav .nav-section { padding: 8px 20px; font-size: 11px; color: rgba(255,255,255,0.4); text-transform: uppercase; letter-spacing: 1px; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.sidebar-nav a:hover { color: #fff; background: rgba(255,255,255,0.05); }
.sidebar-nav a.active { color: #fff; background: rgba(102,126,234,0.2); border-left-color: var(--primary); }
.sidebar-nav a .icon { font-size: 18px; width: 20px; text-align: center; }

.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 0;
}

.topbar {
    background: #fff;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    position: sticky; top: 0; z-index: 50;
}
.topbar .breadcrumb { font-size: 14px; color: var(--text-secondary); }
.topbar .breadcrumb .current { color: var(--text); font-weight: 500; }
.topbar .user-menu { display: flex; align-items: center; gap: 12px; }
.topbar .user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 600;
}
.topbar .user-name { font-size: 13px; }

.page-body { padding: 24px; }

/* ========== 卡片 ========== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 20px;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header h3 { font-size: 16px; font-weight: 600; }
.card-body { padding: 20px; }

/* ========== 统计卡片 ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card .stat-icon {
    width: 52px; height: 52px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
}
.stat-card .stat-info .stat-num { font-size: 28px; font-weight: 700; line-height: 1.2; }
.stat-card .stat-info .stat-label { font-size: 13px; color: var(--text-secondary); }

.bg-blue { background: #e6f7ff; color: #1890ff; }
.bg-green { background: #f6ffed; color: #52c41a; }
.bg-orange { background: #fff7e6; color: #fa8c16; }
.bg-purple { background: #f9f0ff; color: #722ed1; }

/* ========== 按钮 ========== */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #49b018; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #d4380d; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { display: flex; width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ========== 表格 ========== */
.table-wrap { overflow-x: auto; }
table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table th, .data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}
.data-table th {
    background: var(--bg-hover);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
    white-space: nowrap;
}
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table .actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ========== 标签 ========== */
.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}
.tag-active { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.tag-inactive { background: #fff2f0; color: #f5222d; border: 1px solid #ffccc7; }
.tag-blue { background: #e6f7ff; color: #1890ff; }
.tag-gray { background: #f5f5f5; color: #999; }

/* ========== 表单 ========== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; }
.form-group label .req { color: var(--danger); }
.form-control {
    width: 100%; padding: 8px 12px;
    border: 1px solid #d9d9d9; border-radius: var(--radius-sm);
    font-size: 14px; transition: all 0.2s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(102,126,234,0.15); }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state .empty-text { font-size: 15px; margin-bottom: 16px; }

/* ========== 弹窗 ========== */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    display: none;
    align-items: center; justify-content: center;
    z-index: 1000;
}
.modal-overlay.show { display: flex; }
.modal {
    background: #fff;
    border-radius: 12px;
    width: 90%; max-width: 480px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border-light); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 16px; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: #999; }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border-light); display: flex; justify-content: flex-end; gap: 8px; }

/* ========== 提示 ========== */
.alert { padding: 10px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13px; }
.alert-info { background: #e6f7ff; border: 1px solid #91d5ff; color: #096dd9; }
.alert-success { background: #f6ffed; border: 1px solid #b7eb8f; color: #389e0d; }
.alert-error { background: #fff2f0; border: 1px solid #ffccc7; color: #cf1322; }
.alert-warning { background: #fffbe6; border: 1px solid #ffe58f; color: #d4b106; }

/* ========== 分页 ========== */
.pagination { display: flex; gap: 4px; justify-content: center; padding: 20px 0; }
.pagination a, .pagination span {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
}
.pagination a:hover { background: var(--primary-light); border-color: var(--primary); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .page-body { padding: 12px; }
    .topbar { padding: 0 12px; }
}

/* ========== 登录页 ========== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}
.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .icon { font-size: 48px; }
.login-logo h1 { font-size: 22px; margin-top: 8px; }
.login-logo p { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }
.login-form .form-group { margin-bottom: 18px; }
.login-form .form-control { padding: 12px; font-size: 15px; }
.login-btn { width: 100%; padding: 12px; font-size: 15px; }
.login-footer { text-align: center; margin-top: 20px; font-size: 12px; color: var(--text-light); }
