/* ===== 基础样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0078d4;
    --primary-hover: #106ebe;
    --primary-light: #deecf9;
    --success-color: #107c10;
    --warning-color: #ffc107;
    --error-color: #d13438;
    --text-primary: #323130;
    --text-secondary: #605e5c;
    --text-disabled: #a19f9d;
    --bg-primary: #ffffff;
    --bg-secondary: #faf9f8;
    --bg-tertiary: #f3f2f1;
    --border-color: #e1dfdd;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.08);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius-sm: 2px;
    --radius-md: 4px;
    --radius-lg: 8px;
    --transition: all 0.2s ease;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    min-height: 100vh;
}

/* ===== 页面容器 ===== */
.page-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-container.admin {
    flex-direction: row;
}

/* ===== 头部 ===== */
.header {
    padding: 16px 24px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    width: 32px;
    height: 32px;
}

.logo svg {
    width: 100%;
    height: 100%;
}

.brand-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ===== 主内容区 ===== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 40px 24px;
}

.page-container.admin .main-content {
    padding: 0;
    background: var(--bg-secondary);
    margin-left: 240px;
}

/* ===== 认证容器 ===== */
.auth-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-box {
    width: 100%;
    max-width: 440px;
    background: var(--bg-primary);
    padding: 44px;
    box-shadow: var(--shadow-lg);
}

.auth-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* ===== 表单样式 ===== */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    position: relative;
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-input {
    width: 100%;
    height: 48px;
    padding: 12px 40px 12px 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    font-size: 15px;
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
}

.form-input:focus {
    border-color: var(--primary-color);
}

.form-input:focus + .form-label,
.form-input:not(:placeholder-shown) + .form-label {
    top: -8px;
    left: 8px;
    font-size: 12px;
    background: var(--bg-primary);
    padding: 0 4px;
    color: var(--primary-color);
}

.form-label {
    position: absolute;
    left: 12px;
    top: 14px;
    font-size: 15px;
    color: var(--text-secondary);
    pointer-events: none;
    transition: var(--transition);
}

.form-label-static {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-secondary);
}

.toggle-password svg {
    width: 20px;
    height: 20px;
}

.toggle-password:hover {
    color: var(--primary-color);
}

.checkbox-group {
    display: flex;
    align-items: center;
}

/* ===== 按钮样式 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 24px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

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

.btn-primary:disabled {
    background: var(--text-disabled);
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
}

.btn-secondary:disabled {
    color: var(--text-disabled);
    cursor: not-allowed;
}

.btn-text {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 12px;
    height: auto;
}

.btn-text:hover {
    color: var(--primary-color);
    background: var(--primary-light);
}

.btn-danger {
    background: var(--error-color);
    color: white;
}

.btn-danger:hover {
    background: #b92d27;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #0e6e0e;
}

.btn-sm {
    height: 32px;
    padding: 0 12px;
    font-size: 13px;
}

/* ===== 复选框样式 ===== */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
}

.checkbox-label input {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    border-radius: 2px;
}

.checkbox-label input:checked + .checkmark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-label input:checked + .checkmark::after {
    content: '✓';
    color: white;
    font-size: 12px;
}

/* ===== 认证页脚 ===== */
.auth-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
}

/* ===== 页面底部 ===== */
.footer {
    padding: 16px 24px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    font-size: 12px;
}

.footer-copyright {
    color: var(--text-disabled);
}

/* ===== 加载动画 ===== */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== 提示消息 ===== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

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

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-primary);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary-color);
    min-width: 300px;
}

.toast.success .toast-content {
    border-left-color: var(--success-color);
}

.toast.error .toast-content {
    border-left-color: var(--error-color);
}

.toast.warning .toast-content {
    border-left-color: var(--warning-color);
}

/* ===== 侧边栏 ===== */
.sidebar {
    width: 240px;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
}

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

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.nav-item svg {
    width: 20px;
    height: 20px;
}

.nav-item:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.sidebar-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
}

.admin-info {
    margin-bottom: 12px;
}

.admin-name {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
}

.admin-role {
    font-size: 12px;
    color: var(--text-secondary);
}

.sidebar-footer .btn {
    width: 100%;
    justify-content: flex-start;
}

.sidebar-footer svg {
    width: 18px;
    height: 18px;
}

/* ===== 顶部栏 ===== */
.topbar {
    height: 64px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.online {
    background: var(--success-color);
}

/* ===== 内容区域 ===== */
.content-section {
    display: none;
    padding: 24px;
    max-width: 1400px;
}

.content-section.active {
    display: block;
}

.section-header {
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.section-description {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ===== 统计卡片 ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.stat-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-icon.total {
    background: var(--primary-color);
}

.stat-icon.today {
    background: var(--success-color);
}

.stat-icon.beta {
    background: var(--warning-color);
}

.stat-icon.security {
    background: #8764b8;
}

.stat-icon.frozen {
    background: var(--error-color);
}

.stat-content h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
}

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

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 0 12px;
    flex: 1;
    max-width: 400px;
}

.search-box svg {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
}

.search-box input {
    flex: 1;
    height: 40px;
    border: none;
    background: transparent;
    font-size: 14px;
    outline: none;
}

/* ===== 表格 ===== */
.table-container {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
}

.data-table tr:hover {
    background: var(--bg-secondary);
}

.data-table td {
    color: var(--text-primary);
}

/* 状态标签 */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 12px;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-badge.active {
    background: #d4edda;
    color: var(--success-color);
}

.status-badge.active::before {
    background: var(--success-color);
}

.status-badge.frozen {
    background: #f8d7da;
    color: var(--error-color);
}

.status-badge.frozen::before {
    background: var(--error-color);
}

/* 操作按钮 */
.action-btns {
    display: flex;
    gap: 8px;
}

.action-btn {
    padding: 4px 8px;
    font-size: 12px;
    border: none;
    cursor: pointer;
    border-radius: 2px;
    transition: var(--transition);
}

.action-btn.view {
    background: var(--primary-light);
    color: var(--primary-color);
}

.action-btn.view:hover {
    background: var(--primary-color);
    color: white;
}

.action-btn.freeze {
    background: #fff3cd;
    color: #856404;
}

.action-btn.freeze:hover {
    background: var(--warning-color);
    color: white;
}

.action-btn.unfreeze {
    background: #d4edda;
    color: var(--success-color);
}

.action-btn.unfreeze:hover {
    background: var(--success-color);
    color: white;
}

.action-btn.beta {
    background: #e2e3f3;
    color: #5a5cbf;
}

.action-btn.beta:hover {
    background: #5a5cbf;
    color: white;
}

.action-btn.delete {
    background: #f8d7da;
    color: var(--error-color);
}

.action-btn.delete:hover {
    background: var(--error-color);
    color: white;
}

/* ===== 分页 ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.page-btn:hover:not(:disabled) {
    background: var(--bg-secondary);
}

.page-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.page-btn:disabled {
    color: var(--text-disabled);
    cursor: not-allowed;
}

/* ===== 模态框 ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    position: relative;
    background: var(--bg-primary);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    z-index: 1;
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

/* 用户详情 */
.user-detail-info {
    display: grid;
    gap: 16px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.detail-value {
    color: var(--text-primary);
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        transform: translateX(-100%);
        z-index: 200;
    }
    
    .page-container.admin .main-content {
        margin-left: 0;
    }
    
    .auth-box {
        padding: 24px;
        box-shadow: none;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        max-width: none;
    }
    
    .data-table {
        font-size: 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 12px;
    }
}
