/* ============================================================
   河南省见义勇为考评系统 - 全局样式
   ============================================================ */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    --info: #0891b2;
    --dark: #1e293b;
    --light: #f8fafc;
    --sidebar-width: 240px;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active: #2563eb;
    --header-height: 60px;
    --body-bg: #f1f5f9;
    --card-border: #e2e8f0;
    --text-muted: #64748b;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    color: #1e293b;
    background: var(--body-bg);
}

a { text-decoration: none; color: var(--primary); }
a:hover { color: var(--primary-dark); }

/* ==================== 布局 ==================== */
.admin-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 1000;
    transition: width 0.3s;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding: 0 15px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-header .logo-icon {
    width: 32px; height: 32px;
    background: var(--primary);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    margin-right: 10px;
    flex-shrink: 0;
}

.sidebar-nav { padding: 10px 0; }

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    transition: all 0.2s;
    cursor: pointer;
    white-space: nowrap;
}

.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }

.nav-item i { width: 20px; text-align: center; margin-right: 10px; font-size: 16px; }

.nav-submenu { display: none; background: rgba(0,0,0,0.2); }
.nav-submenu .nav-item { padding-left: 50px; font-size: 13px; }
.nav-submenu.open { display: block; }

.nav-arrow { margin-left: auto; transition: transform 0.2s; font-size: 12px; }
.nav-arrow.rotate { transform: rotate(90deg); }

/* ==================== 主内容区 ==================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s;
}

.header {
    height: var(--header-height);
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 999;
}

.header-left { display: flex; align-items: center; gap: 15px; }
.header-right { display: flex; align-items: center; gap: 15px; }

.toggle-btn {
    background: none; border: none; cursor: pointer;
    font-size: 18px; color: var(--text-muted);
    padding: 5px 10px; border-radius: 4px;
}
.toggle-btn:hover { background: #f1f5f9; }

.breadcrumb { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 13px; }

.user-dropdown {
    display: flex; align-items: center; gap: 8px;
    cursor: pointer; padding: 5px 10px; border-radius: 4px;
}
.user-dropdown:hover { background: #f1f5f9; }
.user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: bold;
}
.user-info { display: flex; flex-direction: column; }
.user-name { font-size: 14px; font-weight: 500; }
.user-role { font-size: 12px; color: var(--text-muted); }

.content-body { flex: 1; padding: 24px; }

/* ==================== 卡片 ==================== */
.card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid var(--card-border);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title { font-size: 16px; font-weight: 600; color: var(--dark); }
.card-body { padding: 20px; }

/* ==================== 统计卡片 ==================== */
.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid var(--card-border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }

.stat-icon {
    width: 56px; height: 56px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; color: #fff; flex-shrink: 0;
}

.stat-icon.bg-primary { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.stat-icon.bg-success { background: linear-gradient(135deg, #22c55e, #16a34a); }
.stat-icon.bg-warning { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.stat-icon.bg-info { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.stat-icon.bg-danger { background: linear-gradient(135deg, #ef4444, #dc2626); }
.stat-icon.bg-purple { background: linear-gradient(135deg, #a855f7, #7c3aed); }

.stat-info { flex: 1; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--dark); line-height: 1; }

/* ==================== 表格 ==================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 13px;
    border-bottom: 2px solid var(--card-border);
    background: #f8fafc;
    white-space: nowrap;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--card-border);
    font-size: 14px;
}

.data-table tr:hover td { background: #f8fafc; }

/* ==================== 按钮 ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }

.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #15803d; color: #fff; }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; color: #fff; }

.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-warning:hover { background: #d97706; color: #fff; }

.btn-info { background: var(--info); color: #fff; border-color: var(--info); }
.btn-info:hover { background: #0e7490; color: #fff; }

.btn-default { background: #fff; color: var(--dark); border-color: #cbd5e1; }
.btn-default:hover { background: #f8fafc; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 12px; }

.btn-link { background: none; border: none; color: var(--primary); padding: 0; }
.btn-link:hover { color: var(--primary-dark); text-decoration: underline; }

/* ==================== 表单 ==================== */
.form-group { margin-bottom: 18px; }
.form-label { display: block; margin-bottom: 6px; font-weight: 500; color: var(--dark); font-size: 14px; }
.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }

.form-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    outline: none;
}

textarea.form-control { min-height: 80px; resize: vertical; }

/* ==================== 标签 ==================== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-primary { background: #dbeafe; color: #1d4ed8; }
.badge-success { background: #dcfce7; color: #16a34a; }
.badge-warning { background: #fef3c7; color: #d97706; }
.badge-danger { background: #fee2e2; color: #dc2626; }
.badge-info { background: #cffafe; color: #0891b2; }
.badge-secondary { background: #f1f5f9; color: #64748b; }

/* ==================== 搜索栏 ==================== */
.search-bar {
    background: #fff;
    padding: 16px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    border: 1px solid var(--card-border);
}

.search-bar .form-control,
.search-bar .form-select {
    width: auto;
    min-width: 180px;
}

/* ==================== 分页 ==================== */
.pagination {
    display: flex;
    align-items: center;
    gap: 5px;
    justify-content: flex-end;
    padding: 15px 0;
}

.pagination a, .pagination span {
    padding: 6px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 13px;
    color: var(--dark);
    background: #fff;
}

.pagination a:hover { background: #f1f5f9; }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ==================== 模态框 ==================== */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center; justify-content: center;
    z-index: 9999;
}

.modal-overlay.show { display: flex; }

.modal {
    background: #fff;
    border-radius: 10px;
    width: 600px;
    max-width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--card-border);
    display: flex; align-items: center; justify-content: space-between;
}

.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--card-border); display: flex; justify-content: flex-end; gap: 10px; }

/* ==================== 大屏样式 ==================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.chart-container { height: 320px; }

@media (max-width: 768px) {
    .chart-grid { grid-template-columns: 1fr; }
    .sidebar { width: 0; }
    .main-content { margin-left: 0; }
    .sidebar.open { width: var(--sidebar-width); }
}

/* ==================== 树形组件 ==================== */
.tree-item { padding: 6px 0; }
.tree-children { margin-left: 20px; border-left: 1px dashed #cbd5e1; padding-left: 10px; }
.tree-toggle { cursor: pointer; user-select: none; }
.tree-checkbox { margin-right: 8px; }

/* ==================== 登录页 ==================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #3b82f6 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.login-card {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 420px;
    max-width: 90%;
    padding: 40px;
    position: relative;
    z-index: 1;
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo .logo-circle {
    width: 64px; height: 64px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #fff;
    margin-bottom: 12px;
}

.login-title { font-size: 22px; font-weight: 700; color: #1e293b; }
.login-subtitle { font-size: 13px; color: #64748b; margin-top: 4px; }

.login-form .form-group { margin-bottom: 20px; }

.login-form .input-group {
    position: relative;
}

.login-form .input-group i {
    position: absolute;
    left: 14px; top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 16px;
}

.login-form .form-control {
    padding-left: 42px;
    height: 46px;
    border-radius: 8px;
}

.login-btn {
    width: 100%;
    height: 46px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.login-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,0.4); }

.login-footer { text-align: center; margin-top: 24px; color: #64748b; font-size: 12px; }

/* ==================== 空状态 ==================== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state i { font-size: 48px; margin-bottom: 16px; }

/* ==================== 工具类 ==================== */
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-bold { font-weight: 600; }

.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }

.w-full { width: 100%; }
