/* ==================== 后台管理系统样式 ==================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
        'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.6;
}

/* ==================== 布局 ==================== */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    overflow-y: auto;
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
    transition: width 0.3s ease;
    z-index: 100;
}

.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .sidebar-header h2,
.sidebar.collapsed .user-details-sidebar,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-arrow,
.sidebar.collapsed .sidebar-footer .btn span {
    display: none;
}

.sidebar.collapsed .sidebar-header-top {
    justify-content: center;
}

.sidebar.collapsed .user-info-sidebar {
    justify-content: center;
}

.sidebar.collapsed .nav-group-title {
    padding: 12px;
    justify-content: center;
}

.sidebar.collapsed .nav-item {
    padding: 12px;
    justify-content: center;
}

.sidebar.collapsed .sidebar-footer .btn {
    padding: 10px 5px;
    font-size: 0;
}

.sidebar.collapsed .sidebar-footer .btn::before {
    content: "←";
    font-size: 14px;
}

.sidebar.collapsed .sidebar-footer .btn.btn-danger::before {
    content: "⏻";
}

.sidebar-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.sidebar-toggle {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.sidebar-toggle:hover {
    background: rgba(255,255,255,0.2);
}

.sidebar.collapsed .sidebar-toggle .toggle-icon,
.sidebar-toggle-fixed .toggle-icon.collapsed {
    transform: rotate(180deg);
}

/* 固定在侧边栏中间位置的toggle按钮 */
.sidebar-toggle-fixed {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    left: 276px;
    z-index: 1000;
    background: #1e3c72;
    border: none;
    color: white;
    width: 20px;
    height: 50px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    padding: 0;
}

.sidebar-toggle-fixed:hover {
    background: #2a5298;
}

/* 侧边栏收起时，图标旋转 */
.sidebar-toggle-fixed .toggle-icon {
    font-size: 12px;
    transition: transform 0.3s;
}

.sidebar-toggle-fixed .toggle-icon.collapsed {
    transform: rotate(180deg);
}

/* 侧边栏收起时按钮位置 */
.sidebar.collapsed ~ .sidebar-toggle-fixed,
.sidebar-toggle-fixed.collapsed-state {
    left: 66px;
}

/* 导航组可折叠 */
.nav-group-title {
    padding: 12px 24px;
    font-size: 12px;
    text-transform: uppercase;
    opacity: 0.6;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
    user-select: none;
}

.nav-group-title:hover {
    background: rgba(255,255,255,0.05);
}

.nav-arrow {
    font-size: 10px;
    transition: transform 0.3s;
    opacity: 0.6;
}

.nav-arrow.expanded {
    transform: rotate(180deg);
}

.nav-group-items {
    overflow: visible;
    max-height: none;
}

.nav-group-items.expanded {
    max-height: none;
}

/* 收起侧边栏时主内容区调整 */
.main-content.expanded {
    margin-left: 70px;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    font-size: 20px;
    margin-bottom: 16px;
}

.user-info-sidebar {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar-sidebar {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
}

.user-details-sidebar {
    flex: 1;
}

.user-details-sidebar .user-name {
    display: block;
    font-weight: 600;
    font-size: 14px;
}

.user-details-sidebar .user-role {
    display: block;
    font-size: 12px;
    opacity: 0.8;
}

/* 侧边栏导航 */
.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.3s;
    cursor: pointer;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-item.active {
    background: rgba(255,255,255,0.15);
    color: white;
    border-right: 3px solid #fff;
}

.nav-item .icon {
    font-size: 18px;
}

/* 侧边栏底部 */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-footer .btn {
    display: block;
    width: 100%;
    margin-bottom: 8px;
    text-align: center;
    padding: 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar-footer .btn-secondary {
    background: rgba(255,255,255,0.1);
    color: white;
}

.sidebar-footer .btn-danger {
    background: #dc3545;
    color: white;
}

.sidebar-footer .btn:hover {
    opacity: 0.9;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 32px;
}

/* 内容头部 */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.content-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a2e;
}

/* 系统维护面板 - 右上角紧凑显示 */
.maintenance-panel {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e2e8f0;
    border-radius: 50px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.maintenance-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.maintenance-icon {
    font-size: 16px;
}

.maintenance-label {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.3s;
    border-radius: 20px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(16px);
}

.maintenance-status {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    background: #f1f5f9;
    color: #64748b;
    transition: all 0.3s;
}

.maintenance-status.active {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
    animation: pulse 2s infinite;
}

.maintenance-save-btn {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.maintenance-save-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.maintenance-save-btn:active {
    transform: scale(0.98);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* 夜间模式适配 */
.theme-dark .maintenance-panel {
    background: rgba(30, 41, 59, 0.9);
    border-color: #334155;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.theme-dark .maintenance-label {
    color: #94a3b8;
}

.theme-dark .maintenance-status {
    background: #334155;
    color: #94a3b8;
}

.theme-dark .maintenance-status.active {
    background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%);
    color: #fca5a5;
}

.header-actions {
    display: flex;
    gap: 12px;
}

.current-date {
    padding: 8px 16px;
    background: white;
    border-radius: 6px;
    color: #666;
    font-size: 14px;
}

/* ==================== 卡片 ==================== */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
}

.card-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a2e;
}

.card-body {
    padding: 24px;
}

/* ==================== 统计卡片 ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: all 0.3s;
}

.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;
}

.stat-icon-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-icon-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.stat-icon-warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-icon-info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a2e;
}

/* ==================== 快捷入口 ==================== */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.action-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow: hidden;
    transition: all 0.3s;
}

.action-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.12);
}

.action-link {
    display: block;
    padding: 24px;
    text-decoration: none;
    color: inherit;
}

.action-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 12px;
}

.action-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 4px;
}

.action-desc {
    font-size: 13px;
    color: #666;
}

/* ==================== 最近活动 ==================== */
.recent-activity {
    margin-top: 32px;
}

.recent-activity h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #1a1a2e;
}

.activity-list {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-item:hover {
    background: #f8f9fa;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: #e3f2fd;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 500;
    color: #1a1a2e;
    margin-bottom: 4px;
}

.activity-meta {
    font-size: 13px;
    color: #666;
}

.activity-meta span {
    margin: 0 4px;
}

.activity-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.activity-status.approved {
    background: #e8f5e9;
    color: #2e7d32;
}

.activity-status.pending {
    background: #fff3e0;
    color: #e65100;
}

/* ==================== 表格 ==================== */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background: #f8f9fa;
}

.table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: #1a1a2e;
    font-size: 14px;
}

.table td {
    padding: 14px 16px;
    border-bottom: 1px solid #eee;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

/* ==================== 按钮 ==================== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-warning {
    background: #ffc107;
    color: #333;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

/* 操作按钮组 */
.action-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ==================== 模态框 ==================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    margin: 5% auto;
    width: 90%;
    max-width: 500px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    animation: slideDown 0.3s;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ==================== 表单 ==================== */
.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #1a1a2e;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
}

/* ==================== 提示框 ==================== */
.alert {
    padding: 14px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.alert-error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

/* 自动消失提示框 */
.alert {
    transition: opacity 0.5s ease, transform 0.5s ease;
}
.alert.fade-out {
    opacity: 0;
    transform: translateY(-10px);
}

/* ==================== 徽章 ==================== */
.badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-danger {
    background: #ffebee;
    color: #c62828;
}

.badge-secondary {
    background: #e0e0e0;
    color: #666;
}

.badge-super_admin {
    background: #f3e5f5;
    color: #7b1fa2;
}

.badge-admin {
    background: #e3f2fd;
    color: #1976d2;
}

.badge-teacher {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-student {
    background: #fff3e0;
    color: #e65100;
}

/* ==================== 空状态 ==================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

/* ==================== 筛选表单 ==================== */
.filter-form {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-form .form-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
}

.filter-form .form-group > label {
    min-width: 50px;
}

.filter-form input,
.filter-form select {
    min-width: 80px;
}

.filter-form label {
    font-size: 12px;
    color: #666;
    margin-bottom: 0;
    white-space: nowrap;
}

/* ==================== 状态样式 ==================== */
.status-pending { color: #ff9800; }
.status-completed { color: #4caf50; }
.status-checked { color: #2196f3; }
.status-absent { color: #f44336; }
.status-active { color: #4caf50; }
.status-inactive { color: #999; }

/* ==================== 弹窗样式 ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}

.modal.show {
    display: flex !important;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 10px;
    width: 450px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.filter-form .form-group {
    margin-bottom: 0;
}

.filter-form .form-group label {
    font-size: 13px;
    margin-bottom: 6px;
}

.filter-form input,
.filter-form select {
    font-size: 14px;
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 999;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
    }

    .stats-grid,
    .quick-actions {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}
