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

:root {
    --bg-primary: #FFFFFF;
    --bg-secondary: #FFFFFF;
    --bg-card: #FFFFFF;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --accent: #2563EB;
    --accent-light: #EFF6FF;
    --border: #E5E7EB;
    --success: #16A34A;
    --danger: #DC2626;
    --warning: #F59E0B;
    --info: #2563EB;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05);
    --transition: all 0.2s ease;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Noto Sans CJK SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

a { text-decoration: none; color: inherit; }

/* LOGIN */
.login-bg {
    min-height: 100vh;
    background: var(--bg-primary);
    display: flex;
    position: relative;
    overflow: hidden;
}

.login-visual {
    flex: 1;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 60px;
    border-right: 1px solid var(--border);
}

.login-visual .visual-logo {
    width: 80px; height: 80px;
    background: var(--accent);
    border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 36px; color: white;
    margin-bottom: 24px;
}

.login-visual h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.login-visual p {
    color: var(--text-secondary);
    font-size: 14px;
}

.login-container {
    width: 480px;
    padding: 60px;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 100vh;
}

.login-container .login-logo {
    display: none;
}

.login-container h2 {
    text-align: left;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 700;
    width: 100%;
}

.login-container .login-subtitle {
    text-align: left;
    color: var(--text-muted);
    margin-bottom: 32px;
    font-size: 13px;
    width: 100%;
}

.login-container form {
    width: 100%;
}

.form-group {
    margin-bottom: 20px;
}

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

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

.form-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    gap: 6px;
}

.btn-primary {
    background: var(--accent);
    color: #FFFFFF;
    width: 100%;
    padding: 14px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius);
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    text-decoration: none;
    display: inline-block;
}

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

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

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

.btn-success:hover {
    background: #15803D;
}

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

.btn-edit {
    background: var(--accent-light);
    color: var(--accent);
    border: 1px solid #BFDBFE;
    transition: var(--transition);
}

.btn-edit:hover {
    background: #DBEAFE;
}

.text-danger {
    color: var(--danger) !important;
    font-weight: 600;
}

/* DASHBOARD LAYOUT */
.dashboard {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}

.sidebar h1 {
    font-size: 18px;
    padding: 24px 24px 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
    color: var(--text-primary);
}

.sidebar ul {
    list-style: none;
    padding: 8px 12px;
    flex: 1;
}

.sidebar ul li {
    margin-bottom: 2px;
}

.sidebar ul li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 14px;
    transition: var(--transition);
}

.sidebar ul li a:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.sidebar ul li a.active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 500;
}

.sidebar .logout {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

.sidebar .logout a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 14px;
    transition: var(--transition);
}

.sidebar .logout a:hover {
    color: var(--danger);
}

/* CONTENT */
.content {
    flex: 1;
    margin-left: 250px;
    min-height: 100vh;
    position: relative;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
}

.top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 32px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.top-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.top-header .header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-muted);
    font-size: 13px;
}

.content-body {
    padding: 32px;
    flex: 1;
}

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

.content-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

/* STATS */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--accent);
}

.stat-card.green::before {
    background: var(--success);
}
.stat-card.orange::before {
    background: var(--warning);
}
.stat-card.blue::before {
    background: var(--accent);
}

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

.stat-card .stat-icon.purple { background: rgba(37, 99, 235, 0.1); color: var(--accent); }
.stat-card .stat-icon.green { background: rgba(22, 163, 74, 0.1); color: var(--success); }
.stat-card .stat-icon.orange { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.stat-card .stat-icon.blue { background: rgba(37, 99, 235, 0.1); color: var(--accent); }

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

/* CARD */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

/* TABLE */
table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    background: #F9FAFB;
}

table th {
    padding: 13px 18px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

table td {
    padding: 14px 18px;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

table tbody tr {
    transition: var(--transition);
}

table tbody tr:hover {
    background: #F9FAFB;
}

/* PAGINATION */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 18px;
    border-top: 1px solid var(--border);
}

.pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text-secondary);
    transition: var(--transition);
    border: 1px solid var(--border);
}

.pagination a:hover {
    background: var(--accent-light);
    border-color: #BFDBFE;
    color: var(--accent);
}

.pagination a.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* BADGE */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success { background: rgba(22, 163, 74, 0.1); color: var(--success); border: 1px solid rgba(22, 163, 74, 0.2); }
.badge-danger { background: rgba(220, 38, 38, 0.1); color: var(--danger); border: 1px solid rgba(220, 38, 38, 0.2); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-info { background: rgba(37, 99, 235, 0.1); color: var(--accent); border: 1px solid rgba(37, 99, 235, 0.2); }

/* ALERT */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-danger {
    background: rgba(220, 38, 38, 0.06);
    color: var(--danger);
    border: 1px solid rgba(220, 38, 38, 0.15);
}

.alert-success {
    background: rgba(22, 163, 74, 0.06);
    color: var(--success);
    border: 1px solid rgba(22, 163, 74, 0.15);
}

/* SEARCH BAR */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-bar input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.search-bar input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

/* EMPTY STATE */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* TABLE FOOTER */
.table-footer {
    padding: 12px 16px;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

/* DASHBOARD BOTTOM LAYOUT */
.dashboard-bottom {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 24px;
    align-items: flex-start;
    width: 100%;
}

.dashboard-left {
    flex: 2 1 0;
    min-width: 0;
    overflow: hidden;
}

.dashboard-left .card {
    overflow-x: auto;
}

.dashboard-right {
    flex: 1 1 0;
    min-width: 280px;
    max-width: 380px;
}

/* LEADERBOARD */
.leaderboard-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}

.leaderboard-section {
    margin-bottom: 20px;
}

.leaderboard-section:last-child {
    margin-bottom: 0;
}

.leaderboard-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    transition: var(--transition);
}

.leaderboard-item:hover {
    background: #F3F4F6;
}

.leaderboard-item.top-three {
    background: #F9FAFB;
}

.rank {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    background: #F3F4F6;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.rank-1 {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FDE68A;
}

.rank-2 {
    background: #DBEAFE;
    color: #1E40AF;
    border: 1px solid #BFDBFE;
}

.rank-3 {
    background: #EDE9FE;
    color: #5B21B6;
    border: 1px solid #DDD6FE;
}

.leaderboard-name {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-score {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .content { margin-left: 0; padding: 20px; }
    .stats { grid-template-columns: 1fr 1fr; }
    table { font-size: 13px; }
    table th, table td { padding: 10px 12px; }
    .dashboard-bottom { flex-direction: column; }
    .dashboard-right { max-width: 100%; min-width: 0; }
}

/* SETTINGS PAGE */
.settings-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.settings-icon-sidebar {
    width: 62px;
    background: #1E293B;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-right: 1px solid #334155;
    flex-shrink: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.icon-sidebar-logo {
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #334155;
    width: 100%;
}

.icon-sidebar-logo .material-symbols-sharp {
    font-size: 22px;
    color: #60A5FA;
}

.icon-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 6px;
    width: 100%;
}

.icon-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 4px;
    border-radius: 8px;
    text-decoration: none;
    opacity: 0.65;
    transition: all 0.2s;
}

.icon-nav-item .material-symbols-sharp {
    font-size: 20px;
    color: #94A3B8;
}

.icon-nav-label {
    font-size: 9px;
    font-weight: 500;
    color: #94A3B8;
}

.icon-nav-item:hover {
    opacity: 1;
    background: rgba(255,255,255,0.05);
}

.icon-nav-item.active {
    opacity: 1;
    background: #3B82F6;
    border-radius: 8px;
}

.icon-nav-item.active .material-symbols-sharp,
.icon-nav-item.active .icon-nav-label {
    color: #FFFFFF;
}

.settings-secondary-menu {
    width: 200px;
    background: #FFFFFF;
    border-left: 1px dashed #E2E8F0;
    border-right: 1px dashed #E2E8F0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}

.secondary-menu-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 12px;
    border-bottom: 1px solid #E2E8F0;
}

.community-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.secondary-menu-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    padding: 12px 12px 6px;
}

.secondary-menu-items {
    padding: 0 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.menu-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.2s;
}

.menu-dropdown-header:hover {
    background: #DBEAFE;
    color: #2563EB;
}

.menu-dropdown-header.active {
    background: #DBEAFE;
    color: #2563EB;
}

.menu-dropdown-header .dropdown-arrow {
    font-size: 16px;
    transition: transform 0.2s;
}

.menu-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.menu-dropdown-body {
    display: none;
    flex-direction: column;
    gap: 1px;
    padding-top: 2px;
}

.menu-dropdown.open .menu-dropdown-body {
    display: flex;
}

.menu-sub-item {
    display: block;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s;
}

.menu-sub-item:hover {
    background: #DBEAFE;
    color: #2563EB;
}

.menu-sub-item.active {
    background: #EFF6FF;
    color: #2563EB;
    font-weight: 500;
}

.menu-single-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    line-height: normal;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.menu-single-item span {
    font-size: 13px;
}

.menu-single-item:hover,
.menu-single-item.active {
    background: #DBEAFE;
    color: #2563EB;
}

.settings-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: #F8FAFC;
}

.settings-top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: #FFFFFF;
    border-bottom: 1px solid #E2E8F0;
}

.settings-top-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.header-right {
    font-size: 13px;
    color: var(--text-muted);
}

.settings-tab-nav {
    display: flex;
    gap: 0;
    padding: 0 24px;
    background: #FFFFFF;
    border-bottom: 1px solid #E2E8F0;
    overflow-x: auto;
    min-height: 0;
}

.settings-tab-nav:empty {
    display: none;
}

.settings-tab-nav .tab-item {
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: all 0.2s;
}

.settings-tab-nav .tab-item:hover {
    color: #2563EB;
}

.settings-tab-nav .tab-item.active {
    color: #2563EB;
    border-bottom-color: #2563EB;
}

.settings-body {
    padding: 24px;
    flex: 1;
}

.settings-body .form-group {
    margin-bottom: 16px;
}

.settings-body .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.settings-body .form-group input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.settings-body .form-group input:focus {
    outline: none;
    border-color: #2563EB;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748B' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: border-color 0.2s;
}

.form-select:focus {
    outline: none;
    border-color: #2563EB;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid #E2E8F0;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-outline:hover {
    background: #F8FAFC;
    border-color: #CBD5E1;
}

.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

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

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

.switch-slider::before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.switch input:checked + .switch-slider {
    background: #3B82F6;
}

.switch input:checked + .switch-slider::before {
    transform: translateX(16px);
}
