@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* 颜色系统 - 浅色主题 */
    --bg-color: #f4f6f8;
    --surface-color: #ffffff;
    --surface-hover: #f9fafb;
    --primary-color: #ff8c00;
    --primary-hover: #e07a00;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --danger-color: #ef4444;
    --success-color: #10b981;
    
    /* 字体与边距 */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --sidebar-width: 260px;
    --border-radius: 16px;
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

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

/* === 侧边栏 Sidebar === */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--surface-color);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: transform var(--transition-normal);
}

.logo {
    height: 80px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    gap: 12px;
}

.logo i {
    font-size: 28px;
}

.nav-links {
    list-style: none;
    padding: 20px 12px;
    flex: 1;
}

.nav-links li {
    margin-bottom: 8px;
}

.nav-links a {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    transition: all var(--transition-fast);
    gap: 12px;
}

.nav-links a i {
    font-size: 20px;
}

.nav-links a:hover, .nav-links li.active a {
    background-color: rgba(255, 140, 0, 0.1);
    color: var(--primary-color);
}

/* 侧边栏遮罩层（仅移动端使用） */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    backdrop-filter: blur(4px);
}

/* === 主内容区 === */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 0 30px 40px;
    transition: margin-left var(--transition-normal);
}

/* === 顶部导航 Header === */
.header {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 30px;
}

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

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 28px;
    cursor: pointer;
}

.header h2 {
    font-size: 22px;
    font-weight: 600;
}

.admin-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.admin-profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
}

/* === 统计卡片区 === */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--surface-color);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    border-color: rgba(255, 140, 0, 0.3);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    background: rgba(255, 140, 0, 0.1);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}

.stat-info h3 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.stat-info p {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

/* === 用户列表区 === */
.user-management {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
}

/* 毛玻璃表格 */
.table-responsive {
    overflow-x: auto;
}

.glass-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: left;
}

.glass-table th {
    padding: 16px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.glass-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 15px;
    color: var(--text-primary);
}

.glass-table tbody tr {
    transition: background var(--transition-fast);
}

.glass-table tbody tr:hover {
    background: var(--surface-hover);
}

/* 标签样式 */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.badge.admin {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
}

.badge.user {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.badge.active {
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80;
}

.badge.banned {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}

/* 操作按钮 */
.action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 20px;
    padding: 6px;
    border-radius: 6px;
    transition: all var(--transition-fast);
}

.action-btn:hover {
    background: rgba(0,0,0,0.05);
    color: var(--primary-color);
}

/* 消息提示框 */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--primary-color);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
    font-weight: 500;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* === 响应式设计 (兼容移动端) === */
@media (max-width: 992px) {
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: 0 20px 30px;
    }

    .menu-toggle {
        display: block;
    }

    .dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    /* 隐藏顶部导航文字留出空间 */
    .admin-profile span {
        display: none;
    }
    
    /* 表单变成单列 */
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    /* 编辑器区域优化 */
    .competition-editor {
        padding: 16px;
    }
    
    .editor-tabs {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 8px;
    }
    
    .editor-tabs::-webkit-scrollbar {
        height: 4px;
    }
    .editor-tabs::-webkit-scrollbar-thumb {
        background: #d1d5db;
        border-radius: 4px;
    }
    
    /* 表格操作按钮响应式，允许折叠或保持单行 */
    .glass-table td, .glass-table th {
        padding: 12px 8px;
        font-size: 14px;
    }
    
    /* 卡片化表格响应式设计，所有数据一屏展示且无横向滚动 */
    .glass-table, .glass-table thead, .glass-table tbody, .glass-table th, .glass-table td, .glass-table tr {
        display: block;
    }
    
    .glass-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .glass-table tr {
        border: 1px solid var(--border-color);
        border-radius: 12px;
        margin-bottom: 16px;
        background: var(--surface-color);
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
        overflow: hidden;
    }
    
    .glass-table td {
        border: none;
        border-bottom: 1px solid var(--border-color);
        position: relative;
        padding: 12px 16px 12px 40%;
        text-align: right;
        display: flex;
        justify-content: flex-end;
        align-items: center;
        min-height: 44px;
        font-size: 14px;
    }
    
    .glass-table td:last-child {
        border-bottom: 0;
        justify-content: center;
        padding-left: 16px;
        padding-top: 16px;
        background: rgba(248, 249, 250, 0.5);
    }
    
    .glass-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 16px;
        width: 35%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: 600;
        color: var(--text-secondary);
        pointer-events: none; /* 防止遮挡按钮点击 */
    }
    
    /* 最后一个单元格（操作列）不需要显示标签，避免与居中的按钮重叠 */
    .glass-table td:last-child::before {
        display: none;
    }
}

/* === 独立全屏编辑器区域 === */
.competition-editor {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.editor-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}

.editor-header h3 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.btn-back:hover {
    color: var(--primary-color);
}

.btn-back i {
    font-size: 18px;
}

.editor-container-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* 多标签导航 */
.editor-tabs {
    display: flex;
    gap: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.tab-item {
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
}

.tab-item:hover {
    color: var(--primary-color);
}

.tab-item.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.editor-form-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.tab-content {
    display: none;
    flex: 1;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* 吸底操作条 */
.editor-footer {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    padding: 20px 0 0;
    margin-top: 30px;
    border-top: 1px solid var(--border-color);
    background: var(--surface-color);
    position: sticky;
    bottom: 0;
    z-index: 10;
}

/* === 表单控件样式 (适配深色主题) === */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 140, 0, 0.1);
}

.form-control::placeholder {
    color: #9ca3af;
}

/* 适配 select 在部分浏览器下的背景问题 */
select.form-control option {
    background-color: #ffffff;
    color: var(--text-primary);
}

.btn-secondary {
    background: #ffffff;
    color: var(--text-primary);
    border: 1px solid #d1d5db;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-secondary:hover {
    background: #f9fafb;
}

/* 覆盖 Quill 默认样式以适配深色主题 */
.editor-wrapper .ql-toolbar {
    background: #f9fafb; 
    border-color: #d1d5db !important;
    border-radius: 8px 8px 0 0;
}

.editor-wrapper #editor-container {
    height: 350px;
    background: #ffffff;
    color: #1f2937;
    border-color: #d1d5db !important;
    border-radius: 0 0 8px 8px;
    font-size: 15px;
}

/* === 名单列表弹窗样式 === */
.list-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.list-modal-content {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
    overflow: hidden;
    animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.list-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-color);
}

.list-modal-header h3 {
    font-size: 20px;
    color: var(--text-primary);
    margin: 0;
}

.list-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.close-modal-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.close-modal-btn:hover {
    color: var(--danger-color);
}
