:root {
    /* Light Mode Variables */
    --bg-color: #ffffff;
    --bg-secondary: #f9fafb; /* Lighter secondary background */
    --text-primary: #111827; /* Darker, more contrast text */
    --text-secondary: #6b7280; /* Softer secondary text */
    --primary-color: #e63946; /* Red Theme */
    --primary-hover: #d62828;
    --border-color: #e5e7eb;
    --header-bg: rgba(255, 255, 255, 0.8); /* Translucent for blur effect */
    --sidebar-bg: #ffffff;
    --accent-color: #e63946;
    --hover-bg: #f3f4f6;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Dark mode removed as per request */


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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.25;
    margin-bottom: 1rem;
}

h1 { font-size: 2.25rem; letter-spacing: -0.025em; }
h2 { font-size: 1.875rem; letter-spacing: -0.025em; margin-top: 2rem; }
h3 { font-size: 1.5rem; margin-top: 1.5rem; }

p { margin-bottom: 1rem; color: var(--text-secondary); }
a { color: var(--accent-color); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-hover); }

/* Layout */
.layout-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
header {
    background-color: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo a {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary) !important;
    letter-spacing: -0.025em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
    padding: 3rem 2rem;
    gap: 3rem;
}

sidebar {
    width: 260px;
    flex-shrink: 0;
}

main {
    flex: 1;
    min-width: 0; /* Prevent overflow */
}

/* Sidebar Navigation */
.sidebar-nav ul { list-style: none; }
.sidebar-nav li { margin-bottom: 0.25rem; }

.sidebar-nav a {
    color: var(--text-secondary);
    display: block;
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all 0.2s;
}

.sidebar-nav a:hover, .sidebar-nav a.active {
    background-color: var(--hover-bg);
    color: var(--text-primary);
}

.nav-divider {
    border-top: 1px solid var(--border-color);
    margin: 0.75rem 0.5rem;
}

.text-warning {
    color: #e67e22 !important;
}

.sidebar-search {
    margin-top: 2rem;
}

.search-input {
    font-size: 0.875rem;
}

/* Footer */
footer {
    border-top: 1px solid var(--border-color);
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: auto;
}

/* UI Elements */
.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    color: white;
}

.badge-user { background-color: var(--primary-color) !important; color: white !important; }
.badge-moderator { background-color: #3498db !important; color: white !important; } /* 蓝色 - 版主 */
.badge-admin { background-color: #f1c40f !important; color: #333 !important; } /* 黄色 - 管理员 */
.badge-super-admin { background-color: #e74c3c !important; color: white !important; } /* 红色 - 超级管理员 */

/* Components */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    color: white;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s;
    line-height: 1.25rem;
}

.btn:hover {
    background-color: var(--primary-hover);
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background-color: var(--hover-bg);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

/* Theme Toggle & Icons */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.theme-toggle:hover {
    background-color: var(--hover-bg);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

/* Forms */
.form-group { margin-bottom: 1.5rem; }
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Wiki Content */
.wiki-content {
    color: var(--text-primary);
    font-size: 1.0625rem; /* 17px */
}

.wiki-content p {
    margin-bottom: 1.5rem;
    line-height: 1.75;
}

.wiki-content ul, .wiki-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
    color: var(--text-secondary);
}

.wiki-content li { margin-bottom: 0.5rem; }

.wiki-content pre {
    background-color: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.wiki-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin-left: 0;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Header User Actions */
.header-user-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-left: 0.75rem;
    border-left: 1px solid var(--border-color);
}

.notification-wrapper {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: #ef4444;
    color: white;
    border-radius: 9999px;
    padding: 0 0.25rem;
    font-size: 0.625rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--header-bg);
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    width: 320px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    margin-top: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
}

.dropdown-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.dropdown-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.dropdown-actions a {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--accent-color);
}

.empty-notifications {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-style: italic;
}

.notification-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.notification-item.unread {
    background-color: rgba(37, 99, 235, 0.05);
}

.notification-title-row {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.notification-link {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--accent-color);
    text-decoration: underline;
    text-decoration-style: dashed;
    cursor: pointer;
    flex: 1;
}

.notification-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: default;
    flex: 1;
}

.unread-dot {
    width: 8px;
    height: 8px;
    background-color: var(--primary-color);
    border-radius: 50%;
    flex-shrink: 0;
    margin-left: 0.5rem;
    margin-top: 6px;
    cursor: pointer;
}

.notification-message {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-meta {
    font-size: 0.75rem;
    color: #9ca3af;
    display: flex;
    justify-content: space-between;
}

.user-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
}

.user-avatar-wrapper {
    position: relative;
    width: 24px;
    height: 24px;
}

.user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.verified-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    border-radius: 50%;
    border: 1px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.default-avatar {
    font-size: 1.1rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--bg-color);
    margin: 10% auto;
    padding: 20px;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    color: var(--text-primary);
}

.close-report {
    color: var(--text-secondary);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

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

/* Mobile */
@media (max-width: 768px) {
    /* Force colors to respect data-theme attribute, overriding system preference */
    :root[data-theme="light"] {
        --bg-color: #ffffff;
        --bg-secondary: #f9fafb;
        --text-primary: #111827;
        --text-secondary: #6b7280;
        --border-color: #e5e7eb;
        --header-bg: rgba(255, 255, 255, 0.8);
        --sidebar-bg: #ffffff;
        --hover-bg: #f3f4f6;
    }

    /* Dark mode removed */

    .main-content {
        flex-direction: column;
        padding: 1rem;
        gap: 1.5rem;
    }
    
    sidebar {
        position: fixed;
        top: 0;
        left: -280px; /* Width + padding */
        width: 260px;
        height: 100vh;
        background-color: var(--sidebar-bg);
        z-index: 1000;
        padding: 2rem;
        box-shadow: var(--shadow-md);
        transition: left 0.3s ease;
        overflow-y: auto;
    }

    sidebar.active {
        left: 0;
    }
    
    /* Overlay for sidebar */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }
    
    header { 
        padding: 0.75rem 1rem; 
    }

    .header-logo a {
        font-size: 1.1rem;
    }

    /* Hide user text on mobile, keep icon */
    .user-link {
        font-size: 0;
    }
    .user-link .user-avatar-wrapper, .user-link .default-avatar {
        margin-right: 0;
    }
    .user-link::after {
        content: none;
    }

    /* Make tables scrollable */
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .menu-toggle {
        display: flex !important;
        z-index: 1001; /* Ensure it's clickable */
    }
}

.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-primary);
    margin-right: 1rem;
    padding: 0.25rem;
}
