/* ====== 一课管理后台样式 ====== */
/* 参考SaiAdmin布局设计：左侧导航 + 顶部工具栏 + 主内容区 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: #f0f2f5;
    color: #1f2937;
    overflow: hidden;
}

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

/* 左侧导航 */
.sidebar {
    width: 220px;
    background: #1f2937;
    color: white;
    display: flex;
    flex-direction: column;
    transition: width 0.2s;
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar.collapsed {
    width: 64px;
}

.sidebar-header {
    padding: 20px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header i {
    font-size: 24px;
    color: #60a5fa;
}

.sidebar-header .brand {
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
}

.sidebar.collapsed .sidebar-header .brand { display: none; }

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

.nav-group-title {
    padding: 8px 16px;
    font-size: 12px;
    color: #9ca3af;
    letter-spacing: 1px;
    white-space: nowrap;
}

.sidebar.collapsed .nav-group-title { display: none; }

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: #d1d5db;
    cursor: pointer;
    transition: all 0.15s;
    gap: 12px;
    white-space: nowrap;
    border-radius: 6px;
    margin: 2px 8px;
}

.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

.nav-item.active {
    background: rgba(96,165,250,0.15);
    color: #60a5fa;
}

.nav-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.nav-item .nav-text {
    font-size: 14px;
}

.sidebar.collapsed .nav-item .nav-text { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px; }

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-footer .toggle-btn {
    cursor: pointer;
    color: #9ca3af;
    font-size: 16px;
    transition: color 0.15s;
}

.sidebar-footer .toggle-btn:hover { color: white; }

/* ====== 右侧主区域 ====== */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 顶部栏 */
.top-bar {
    background: white;
    padding: 0 24px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.breadcrumb {
    font-size: 14px;
    color: #6b7280;
}

.breadcrumb span { color: #1f2937; font-weight: 500; }

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #374151;
}

.admin-info .avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: #374151; color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
}

.logout-btn {
    padding: 6px 12px; background: none; border: 1px solid #d1d5db;
    border-radius: 6px; font-size: 13px; color: #6b7280;
    cursor: pointer; transition: all 0.15s;
}

.logout-btn:hover { border-color: #374151; color: #374151; }

.pwd-btn {
    padding: 6px 10px; background: none; border: 1px solid #d1d5db;
    border-radius: 6px; font-size: 13px; color: #6b7280;
    cursor: pointer; transition: all 0.15s;
}
.pwd-btn:hover { border-color: #374151; color: #374151; background: #f9fafb; }

/* ====== 内容区 ====== */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* ====== 仪表盘 ====== */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e5e7eb;
    transition: transform 0.15s;
}

.stat-card:hover { transform: translateY(-2px); }

.stat-card .stat-icon {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; margin-bottom: 12px;
}

.stat-card .stat-icon.blue { background: #dbeafe; color: #3b82f6; }
.stat-card .stat-icon.green { background: #d1fae5; color: #10b981; }
.stat-card .stat-icon.orange { background: #fed7aa; color: #f97316; }
.stat-card .stat-icon.purple { background: #ede9fe; color: #8b5cf6; }

.stat-card .stat-num {
    font-size: 28px; font-weight: 600; color: #1f2937;
}

.stat-card .stat-label {
    font-size: 13px; color: #9ca3af; margin-top: 4px;
}

/* 仪表盘下半区域 */
.dashboard-bottom {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.panel-card {
    background: white;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    padding: 20px;
}

.panel-title {
    font-size: 16px; font-weight: 600; color: #1f2937;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-title i { color: #6b7280; }

/* 快捷入口网格 */
.quick-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.quick-item {
    text-align: center;
    padding: 16px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.quick-item:hover { background: #f3f4f6; }

.quick-item i { font-size: 24px; color: #374151; margin-bottom: 8px; }
.quick-item .quick-name { font-size: 13px; color: #6b7280; }

/* ====== 数据表格 ====== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: #f9fafb;
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
    border-bottom: 1px solid #e5e7eb;
}

.data-table td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid #f3f4f6;
}

.data-table tr:hover td { background: #f9fafb; }

.table-actions {
    display: flex;
    gap: 8px;
}

.btn-sm {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
}

.btn-edit { background: #dbeafe; color: #3b82f6; }
.btn-edit:hover { background: #bfdbfe; }
.btn-del { background: #fee2e2; color: #ef4444; }
.btn-del:hover { background: #fecaca; }

.status-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status-tag.active { background: #d1fae5; color: #059669; }
.status-tag.inactive { background: #f3f4f6; color: #9ca3af; }
.status-tag.banned { background: #fee2e2; color: #ef4444; }

.btn-ban { background: #fef3c7; color: #d97706; }
.btn-ban:hover { background: #fde68a; }
.btn-unban { background: #d1fae5; color: #059669; }
.btn-unban:hover { background: #a7f3d0; }

/* ====== 工具栏 ====== */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.toolbar-title {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.toolbar-actions {
    display: flex;
    gap: 8px;
}

.btn-primary {
    padding: 8px 16px;
    background: #374151;
    color: white;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s;
}

.btn-primary:hover { background: #1f2937; }

.btn-secondary {
    padding: 8px 16px;
    background: white;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-secondary:hover { border-color: #374151; }

/* ====== 弹窗/模态框 ====== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-box {
    background: white;
    border-radius: 12px;
    width: 480px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.modal-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    font-size: 18px;
    color: #9ca3af;
    cursor: pointer;
}

.modal-close:hover { color: #374151; }

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid #e5e7eb;
}

/* ====== 表单 ====== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: #374151;
    box-shadow: 0 0 0 3px rgba(55,65,81,0.1);
}

.form-textarea {
    min-height: 80px;
    resize: vertical;
}

.config-value textarea {
    width: 100%;
    max-width: 300px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    min-height: 60px;
    resize: vertical;
}

.config-value textarea:focus {
    outline: none;
    border-color: #374151;
}

.form-hint {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 4px;
}

/* 开关按钮 */
.switch {
    position: relative;
    width: 44px;
    height: 24px;
    display: inline-block;
}

.switch input { opacity: 0; width: 0; height: 0; }

.switch .slider {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: #d1d5db;
    border-radius: 24px;
    cursor: pointer;
    transition: background 0.2s;
}

.switch .slider::before {
    content: '';
    position: absolute;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: white;
    left: 2px; top: 2px;
    transition: transform 0.2s;
}

.switch input:checked + .slider { background: #374151; }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ====== 系统配置 ====== */
.config-group {
    margin-bottom: 24px;
}

.config-group-title {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.config-group-title i { color: #6b7280; }

.config-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
}

.config-item:last-child { border-bottom: none; }

.config-key {
    width: 140px;
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

.config-desc {
    width: 200px;
    font-size: 13px;
    color: #9ca3af;
}

.config-value {
    flex: 1;
}

.config-value input, .config-value select {
    width: 100%;
    max-width: 300px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

.config-value input:focus {
    outline: none;
    border-color: #374151;
}

/* ====== 空状态 ====== */
.empty-state {
    text-align: center;
    padding: 48px;
    color: #9ca3af;
}

.empty-state i { font-size: 48px; margin-bottom: 12px; color: #d1d5db; }
.empty-state p { font-size: 14px; }

/* ====== Toast ====== */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 2000;
}

.toast-item {
    background: white;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    animation: slideIn 0.2s ease;
}

.toast-item.success { border-left: 3px solid #10b981; }
.toast-item.error { border-left: 3px solid #ef4444; }
.toast-item.info { border-left: 3px solid #3b82f6; }

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

/* ====== 响应式 ====== */
@media (max-width: 768px) {
    .sidebar { width: 64px; }
    .sidebar .nav-text, .sidebar .brand, .sidebar .nav-group-title { display: none; }
    .sidebar .nav-item { justify-content: center; padding: 10px; }

    .dashboard-stats { grid-template-columns: repeat(2, 1fr); }
    .dashboard-bottom { grid-template-columns: 1fr; }
    .quick-grid { grid-template-columns: repeat(3, 1fr); }
    .content-area { padding: 16px; }
}