:root {
    --whp-primary: #667eea;
    --whp-secondary: #764ba2;
    --whp-success: #198754;
    --whp-warning: #ffc107;
    --whp-danger: #dc3545;
    --whp-info: #0dcaf0;
    --whp-bg: #f5f7fa;
    --whp-sidebar-bg: #2c3e50;
    --whp-sidebar-text: #ecf0f1;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--whp-bg);
    color: #333;
}

.admin-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: linear-gradient(180deg, #2c3e50 0%, #1a252f 100%);
    color: var(--whp-sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand i { font-size: 2rem; color: var(--whp-primary); }
.sidebar-brand span { font-size: 1.25rem; font-weight: 700; margin-top: 8px; }
.sidebar-brand small { font-size: 0.75rem; opacity: 0.7; }
.sidebar-brand .sidebar-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 12px;
    background: rgba(255,255,255,0.06);
    padding: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 15px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
    border-left-color: var(--whp-primary);
}

.nav-item.active {
    color: #fff;
    background: rgba(102, 126, 234, 0.2);
    border-left-color: var(--whp-primary);
}

.nav-item i { font-size: 1.1rem; width: 24px; text-align: center; }

/* ====== 管理员管理菜单项（仅 SUPER） ====== */
.nav-item-super {
    background: linear-gradient(90deg, rgba(220,53,69,0.12), transparent);
    color: rgba(255,200,200,0.9) !important;
    position: relative;
}
.nav-item-super:hover {
    background: linear-gradient(90deg, rgba(220,53,69,0.25), rgba(220,53,69,0.08));
    color: #fff !important;
    border-left-color: var(--whp-danger) !important;
}
.nav-item-super.active {
    background: rgba(220,53,69,0.25) !important;
    border-left-color: var(--whp-danger) !important;
}
.nav-super-tag {
    display: inline-block;
    margin-left: auto;
    padding: 1px 6px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: var(--whp-danger);
    color: #fff;
    border-radius: 3px;
}

.sidebar-footer {
    padding: 15px 0;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.main-content {
    flex: 1;
    margin-left: 240px;
    display: flex;
    flex-direction: column;
}

/* 底部版权条 */
.whp-footer {
    margin-left: 240px;
    padding: 12px 24px;
    background: #fff;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    text-align: center;
    font-size: 12px;
    color: #6c757d;
}
.whp-footer__inner {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}
.whp-footer__dot { color: #adb5bd; }
.whp-footer__author strong { color: #495057; font-weight: 600; }

.top-bar {
    background: #fff;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    position: relative;
    z-index: 50;
}

.breadcrumb { font-weight: 600; color: #555; }
.admin-info { display: flex; align-items: center; gap: 8px; color: #666; }

.content-area {
    flex: 1;
    padding: 25px 30px;
}

.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-icon.bg-primary { background: linear-gradient(135deg, #667eea, #764ba2); }
.stat-icon.bg-success { background: linear-gradient(135deg, #43e97b, #38f9d7); }
.stat-icon.bg-info { background: linear-gradient(135deg, #4facfe, #00f2fe); }
.stat-icon.bg-warning { background: linear-gradient(135deg, #fa709a, #fee140); }
.stat-icon.bg-secondary { background: linear-gradient(135deg, #a8edea, #fed6e3); }
.stat-icon.bg-danger { background: linear-gradient(135deg, #ff6b6b, #ee5a52); }

.stat-info h3 { margin: 0; font-size: 1.75rem; font-weight: 700; }
.stat-info p { margin: 0; color: #888; font-size: 0.85rem; }

.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    margin-bottom: 20px;
}

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafbfc;
    border-radius: 12px 12px 0 0 !important;
}

.card-body { padding: 20px; }
.card-footer { padding: 15px 20px; border-top: 1px solid #f0f0f0; background: #fafbfc; border-radius: 0 0 12px 12px !important; }

.table { margin-bottom: 0; }
.table th { font-weight: 600; font-size: 0.85rem; color: #666; border-bottom-width: 1px; }
.table td { padding: 12px; vertical-align: middle; }
.table tbody tr:hover { background: #f8f9fc; }

.btn-primary { background: linear-gradient(135deg, #667eea, #764ba2); border: none; }
.btn-primary:hover { opacity: 0.9; }

.pagination .page-link { border-radius: 6px; margin: 0 2px; }
.pagination .page-item.active .page-link { background: var(--whp-primary); border-color: var(--whp-primary); }

.badge { font-weight: 500; padding: 5px 10px; }

.whp-toast {
    position: fixed;
    top: 30px;
    right: 30px;
    padding: 12px 24px;
    border-radius: 8px;
    color: #fff;
    font-weight: 500;
    z-index: 9999;
    animation: slideIn 0.3s ease;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.toast-success { background: #28a745; }
.toast-error { background: #dc3545; }
.toast-warning { background: #ffc107; color: #333; }
.toast-info { background: #17a2b8; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.whp-confirm {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
}

.confirm-box {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    min-width: 300px;
    text-align: center;
}

.confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.form-control:focus, .form-select:focus {
    border-color: var(--whp-primary);
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

.input-group-text {
    background: #f8f9fc;
    border: 1px solid #e0e0e0;
    color: #888;
}

.table-responsive { max-height: 600px; overflow-y: auto; }

/* ====== 移动端汉堡菜单按钮（桌面端隐藏） ====== */
.sidebar-toggle {
    display: none;
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    color: #555;
    font-size: 1.4rem;
    line-height: 1;
    border-radius: 8px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}
.sidebar-toggle:hover {
    background: rgba(102, 126, 234, 0.1);
    color: var(--whp-primary);
}
.sidebar-toggle:active {
    background: rgba(102, 126, 234, 0.2);
}

/* ====== 移动端遮罩层 ====== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

@media (max-width: 768px) {
    .sidebar-toggle {
        display: inline-flex;
    }
    .sidebar {
        transform: translateX(-100%);
        z-index: 1000;
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.2);
        pointer-events: none;
    }
    .sidebar.open {
        transform: translateX(0);
        pointer-events: auto;
    }
    .main-content {
        margin-left: 0;
    }
    .whp-footer {
        margin-left: 0;
    }
    .content-area {
        padding: 15px;
    }
    .top-bar {
        padding: 12px 15px;
    }
    .stat-card {
        padding: 15px;
    }
    .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }
    .stat-info h3 { font-size: 1.3rem; }
    .table-responsive { overflow-x: auto; }
    .table th, .table td { font-size: 0.8rem; padding: 8px 6px; }

    /* 顶栏角色徽章在小屏下隐藏文字，仅保留图标，避免挤占 */
    .top-bar .admin-info .badge.rounded-pill {
        display: none;
    }
}

@media print {
    .sidebar, .top-bar, .btn, .pagination, .no-print, .whp-footer { display: none !important; }
    .main-content { margin-left: 0; }
}

/* ====== 超级管理员行（列表中高亮） ====== */
.table-super-admin,
.table-super-admin:hover {
    background: linear-gradient(90deg, #fff5f5, #fff) !important;
}
.table-super-admin td:first-child {
    border-left: 3px solid var(--whp-danger);
}
.table-super-admin .fw-bold {
    color: #b02a37;
}

/* ====== 确认框遮罩 & 盒子增强 ====== */
.whp-confirm {
    backdrop-filter: blur(2px);
    animation: fadeInBg 0.2s ease;
}
.whp-confirm .confirm-box {
    max-width: 480px;
    width: 92%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    transition: transform 0.2s ease, opacity 0.2s ease;
    animation: zoomIn 0.2s ease;
}
@keyframes fadeInBg {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes zoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.confirm-icon {
    font-size: 2.5rem;
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.confirm-icon-warn {
    background: #fff3cd;
    color: #856404;
}
.confirm-icon-danger {
    background: #f8d7da;
    color: #842029;
}
.confirm-icon-forbidden {
    background: #e2e3e5;
    color: #6c757d;
    background: #f8d7da;
    color: #842029;
}

.confirm-msg {
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ====== 敏感操作二次确认 ====== */
.whp-confirm-sensitive .confirm-box {
    padding: 0;
    overflow: hidden;
    text-align: left;
    border: 1px solid rgba(220,53,69,0.2);
}
.sensitive-header {
    padding: 14px 24px;
    background: linear-gradient(135deg, #dc3545, #b02a37);
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sensitive-header i { font-size: 1.15rem; }
.whp-confirm-sensitive .confirm-body {
    padding: 22px 24px 6px;
    display: flex;
    gap: 16px;
}
.whp-confirm-sensitive .confirm-icon {
    width: 48px; height: 48px; font-size: 1.6rem;
    margin: 0; flex-shrink: 0;
}
.sensitive-tip {
    margin-top: 8px;
    padding: 10px 12px;
    background: #fff5f5;
    border: 1px solid #fdd;
    border-radius: 6px;
    color: #842029;
    line-height: 1.5;
}
.whp-confirm-sensitive .confirm-actions {
    padding: 0 24px 22px;
    margin-top: 14px;
    justify-content: flex-end;
}

/* ====== 权限复选框组卡片 ====== */
.perm-cb .card-header {
    border-radius: 8px 8px 0 0 !important;
    background: #f8f9fc;
    border-bottom: 1px solid #e9ecef;
}
.perm-cb .form-check-input:checked {
    background-color: var(--whp-primary);
    border-color: var(--whp-primary);
}
.perm-cb .form-check-input:disabled {
    background-color: #fff5f5;
    border-color: #f5c2c7;
    cursor: not-allowed;
}
.perm-cb label.form-check-label {
    cursor: pointer;
}

/* ====== Toast 动画增强 ====== */
.whp-toast {
    opacity: 1;
    transition: opacity 0.3s ease, transform 0.3s ease;
    display: flex;
    align-items: center;
    max-width: 420px;
}

/* ====== 顶栏角色徽章阴影 ====== */
.top-bar .badge.rounded-pill {
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    font-size: 0.72rem;
}
