/* ========================================
   挖呗环保平台 - 深蓝色大气管理后台主题
   ======================================== */

:root {
    --sidebar-bg: #0f1a2e;
    --sidebar-hover: #1a2d4a;
    --sidebar-active: #1e3a5f;
    --sidebar-width: 240px;
    --topbar-height: 56px;
    --primary: #1a3a6b;
    --primary-light: #2c5f8a;
    --accent: #3498db;
    --accent-light: #5dade2;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --info: #17a2b8;
    --body-bg: #eef1f5;
    --card-shadow: 0 2px 8px rgba(0,0,0,0.08);
    --text-muted: #8c8c8c;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    color: #333;
    background: var(--body-bg);
    overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-light); }

/* ======= 登录页面 ======= */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f1a2e 0%, #1a3a6b 50%, #2c5f8a 100%);
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(52,152,219,0.1) 0%, transparent 50%);
    animation: loginGlow 10s ease-in-out infinite;
}
@keyframes loginGlow {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(20px, 20px); }
}
.login-box {
    background: rgba(255,255,255,0.95);
    border-radius: 16px;
    padding: 40px;
    width: 420px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
}
.login-box .logo {
    text-align: center;
    margin-bottom: 30px;
}
.login-box .logo h2 {
    font-size: 24px;
    color: var(--primary);
    font-weight: 700;
}
.login-box .logo p {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 5px;
}
.login-box .form-group {
    margin-bottom: 20px;
}
.login-box .form-group label {
    display: block;
    margin-bottom: 6px;
    color: #555;
    font-weight: 500;
    font-size: 13px;
}
.login-box .form-control {
    width: 100%;
    height: 44px;
    padding: 0 15px;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
    background: #fafafa;
}
.login-box .form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(52,152,219,0.15);
    outline: none;
    background: #fff;
}
.login-box .btn-login {
    width: 100%;
    height: 44px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}
.login-box .btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(26,58,107,0.4);
}
.login-error {
    background: #fef2f2;
    color: var(--danger);
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 13px;
    border: 1px solid #fecaca;
}

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

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    transition: all 0.3s;
    overflow-y: auto;
    overflow-x: hidden;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }
.sidebar-logo {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.sidebar-logo h3 {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
}
.sidebar-logo h3 span {
    color: var(--accent);
}
.sidebar-menu { padding: 10px 0; }
.nav-item { list-style: none; }
.nav-item .nav-link {
    display: flex;
    align-items: center;
    padding: 11px 20px;
    color: rgba(255,255,255,0.7);
    transition: all 0.3s;
    cursor: pointer;
    border-left: 3px solid transparent;
    font-size: 14px;
}
.nav-item .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
    padding-left: 24px;
}
.nav-item .nav-link.active {
    background: var(--sidebar-active);
    color: #fff;
    border-left-color: var(--accent);
}
.nav-item .nav-link i {
    width: 22px;
    font-size: 16px;
    margin-right: 10px;
    text-align: center;
}
.nav-item .nav-link .arrow {
    margin-left: auto;
    transition: transform 0.3s;
    font-size: 12px;
}
.nav-item .nav-link .arrow.open { transform: rotate(90deg); }
.nav-item .sub-menu {
    background: rgba(0,0,0,0.15);
    display: none;
    padding: 5px 0;
}
.nav-item .sub-menu.open { display: block; }
.nav-item .sub-menu .nav-link {
    padding-left: 52px;
    font-size: 13px;
}

/* 主内容区 */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
}
/* 顶部导航 */
.topbar {
    height: var(--topbar-height);
    background: #fff;
    display: flex;
    align-items: center;
    padding: 0 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    position: sticky;
    top: 0;
    z-index: 99;
}
.topbar-left {
    display: flex;
    align-items: center;
}
.toggle-sidebar {
    background: none;
    border: none;
    font-size: 20px;
    color: #555;
    cursor: pointer;
    padding: 8px;
    margin-right: 15px;
    border-radius: 6px;
    transition: all 0.3s;
}
.toggle-sidebar:hover { background: #f0f0f0; }
.topbar-title { font-size: 16px; font-weight: 600; color: #333; }
.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 15px;
}
.topbar-right .btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}
.topbar-right .btn-icon:hover { background: #f0f0f0; }
.topbar-right .badge-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
}
.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}
.user-info:hover { background: #f0f0f0; }
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}
.user-name { font-size: 13px; color: #333; font-weight: 500; }

/* 页面内容 */
.page-content {
    padding: 20px 24px;
}
.page-header {
    margin-bottom: 20px;
}
.page-header h1 {
    font-size: 20px;
    color: #222;
    font-weight: 600;
}
.page-header p {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 4px;
}
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: #ccc; }

/* ======= 卡片 & 组件 ======= */
.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    margin-bottom: 20px;
    border: none;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header h5 { font-size: 15px; font-weight: 600; color: #333; }
.card-body { padding: 20px; }
.card-body.pt-0 { padding-top: 0; }
.card-tools { display: flex; gap: 8px; align-items: center; }

/* 统计卡片 */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0,0,0,0.1); }
.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.stat-card .stat-icon.blue { background: #ebf5fb; color: var(--accent); }
.stat-card .stat-icon.green { background: #e8f8f0; color: var(--success); }
.stat-card .stat-icon.orange { background: #fef5e7; color: var(--warning); }
.stat-card .stat-icon.red { background: #fdedec; color: var(--danger); }
.stat-card .stat-icon.purple { background: #f0eef9; color: #7c3aed; }
.stat-card .stat-icon.teal { background: #e8f8f5; color: #1abc9c; }
.stat-card .stat-info { flex: 1; min-width: 0; }
.stat-card .stat-info .stat-label { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.stat-card .stat-info .stat-value { font-size: 22px; font-weight: 700; color: #222; }
.stat-card .stat-info .stat-change { font-size: 12px; margin-top: 4px; }
.stat-card .stat-info .stat-change.up { color: var(--success); }
.stat-card .stat-info .stat-change.down { color: var(--danger); }

/* 表格 */
.table-container { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    background: #f8f9fc;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #e8e8e8;
    white-space: nowrap;
}
.data-table td {
    padding: 11px 16px;
    border-bottom: 1px solid #f0f0f0;
    color: #444;
}
.data-table tbody tr:hover { background: #f8f9fc; }
.data-table .text-center { text-align: center; }
.data-table .text-right { text-align: right; }

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #555;
    font-weight: 500;
    font-size: 13px;
}
.form-control {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    transition: all 0.3s;
    background: #fff;
}
.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(52,152,219,0.1);
    outline: none;
}
textarea.form-control { height: auto; padding: 10px 12px; min-height: 80px; resize: vertical; }
select.form-control { appearance: auto; }
.form-control-sm { height: 32px; font-size: 12px; padding: 0 10px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 150px; }
.form-inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    line-height: 1.4;
}
.btn:active { transform: scale(0.97); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 10px 24px; font-size: 15px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #2980b9; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #219a52; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #e08e0b; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { background: #138496; }
.btn-light { background: #f0f0f0; color: #555; }
.btn-light:hover { background: #e4e4e4; }
.btn-outline {
    background: transparent;
    border: 1.5px solid #d0d0d0;
    color: #666;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-outline-primary { border-color: var(--accent); color: var(--accent); }
.btn-outline-primary:hover { background: var(--accent); color: #fff; }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* 搜索栏 */
.search-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    padding: 16px 20px;
    background: #f8f9fc;
    border-radius: 10px;
    margin-bottom: 16px;
}
.search-bar .form-control { width: auto; min-width: 150px; }

/* 分页 */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0 5px;
    font-size: 13px;
    color: #666;
}
.pagination .page-info { font-size: 13px; }
.pagination .page-btns { display: flex; gap: 4px; }
.pagination .page-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fff;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
}
.pagination .page-btn:hover { border-color: var(--accent); color: var(--accent); }
.pagination .page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination .page-btn.disabled { opacity: 0.5; cursor: not-allowed; }

/* 进度条 */
.progress {
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s;
}
.progress-bar.blue { background: var(--accent); }
.progress-bar.green { background: var(--success); }
.progress-bar.orange { background: var(--warning); }
.progress-bar.red { background: var(--danger); }

/* 弹窗 */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: #fff;
    border-radius: 16px;
    width: 500px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: modalIn 0.3s ease;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
    padding: 18px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h5 { font-size: 16px; font-weight: 600; }
.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: #f0f0f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    color: #999;
    transition: all 0.2s;
}
.modal-close:hover { background: #e0e0e0; color: #555; }
.modal-body { padding: 20px; }
.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* 标签 */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}
.badge-success { background: #e8f8f0; color: var(--success); }
.badge-danger { background: #fdedec; color: var(--danger); }
.badge-warning { background: #fef5e7; color: var(--warning); }
.badge-info { background: #ebf5fb; color: var(--accent); }
.badge-secondary { background: #f0f0f0; color: #888; }
.badge-primary { background: #e8eaf6; color: var(--primary); }

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state p { font-size: 14px; }

/* 工具类 */
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.fw-600 { font-weight: 600; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mr-2 { margin-right: 8px; }
.ml-2 { margin-left: 8px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }

/* 图表容器 */
.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
}
.chart-container-sm { height: 220px; }

/* 响应式 */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .stat-cards {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
    .sidebar-overlay {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.4);
        z-index: 99;
        display: none;
    }
    .sidebar-overlay.open { display: block; }
}

@media (max-width: 768px) {
    .page-content { padding: 15px; }
    .stat-cards { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 15px; }
    .stat-card .stat-value { font-size: 18px; }
    .search-bar .form-control { width: 100%; }
    .form-row .form-group { min-width: 100%; }
}

@media (max-width: 480px) {
    .stat-cards { grid-template-columns: 1fr; }
    .card-body { padding: 15px; }
}

/* 额外动画 */
.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.slide-up { animation: slideUp 0.3s ease; }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Tab导航 */
.tab-nav {
    display: flex;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 20px;
    overflow-x: auto;
}
.tab-nav .tab-item {
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: #888;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s;
    white-space: nowrap;
}
.tab-nav .tab-item:hover { color: var(--accent); }
.tab-nav .tab-item.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content .tab-pane { display: none; }
.tab-content .tab-pane.active { display: block; }

/* 树形选择 */
.tree-select { list-style: none; }
.tree-select li { padding: 4px 0; }
.tree-select .tree-toggle { cursor: pointer; padding: 2px 8px; border-radius: 4px; }
.tree-select .tree-toggle:hover { background: #f0f0f0; }
.tree-select .tree-children { padding-left: 24px; display: none; }
.tree-select .tree-children.open { display: block; }
