:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #ec4899;
    --accent-color: #f59e0b;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--secondary-color);
}

.navbar {
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar-nav .nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.1);
}

.btn-primary-custom {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary-custom {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.card-custom {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.card-custom:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border-color: var(--primary-color);
}

.card-custom .card-img-top {
    height: 200px;
    object-fit: cover;
}

.card-custom .card-body {
    padding: 1.5rem;
}

.card-custom .card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.card-custom .card-text {
    color: var(--text-secondary);
}

.badge-custom {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.hero-section {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.1));
    padding: 4rem 0;
    margin-bottom: 3rem;
    border-bottom: 1px solid var(--border-color);
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
}

.article-content {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 2rem;
    border: 1px solid var(--border-color);
}

.article-content h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.article-content h2,
.article-content h3 {
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.article-content p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.8;
}

.article-content pre {
    background: var(--bg-input);
    border-radius: 10px;
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.article-content code {
    background: var(--bg-input);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.article-content img {
    max-width: 100%;
    border-radius: 10px;
    margin: 1rem 0;
}

.vote-buttons {
    display: flex;
    gap: 1rem;
    margin: 2rem 0;
}

.vote-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    border: 2px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

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

.vote-btn.liked {
    border-color: var(--success);
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.vote-btn.disliked {
    border-color: var(--danger);
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.comment-section {
    margin-top: 3rem;
}

.comment-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.comment-card .comment-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
}

.comment-card .comment-author {
    font-weight: 600;
    color: var(--text-primary);
}

.comment-card .comment-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.comment-card .comment-parent{
     font-size: 0.75rem;
    color: var(--text-muted);padding: 14px 18px;
  border-radius: 14px;
  background-color: var(--text-secondary);
  white-space: nowrap; /* 禁止文字换行 */
overflow: hidden; /* 隐藏超出容器宽度的部分 */
text-overflow: ellipsis; /* 显示省略号 */
}

.comment-card .comment-content {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.comment-card .comment-actions {
    display: flex;
    gap: 1rem;
}

.comment-vote-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: color 0.3s ease;
}

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

.reply-form {
    margin-left: 3rem;
    margin-top: 1rem;
}

.form-control-custom {
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    color: var(--text-primary);
    width: 100%;
    transition: border-color 0.3s ease;
}

.form-control-custom:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-control-custom::placeholder {
    color: var(--text-muted);
}

.sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
}

.sidebar-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--primary-color);
}

.category-list {
    list-style: none;
    padding: 0;
}

.category-list li {
    margin-bottom: 0.75rem;
}

.category-list a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border-radius: 8px;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.category-list a:hover,
.category-list a.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-item {
    background: var(--bg-input);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.tag-item:hover {
    background: var(--primary-color);
    color: white;
}

.pagination-custom {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 3rem 0;
}

.pagination-custom a,
.pagination-custom span {
    padding: 0.75rem 1.25rem;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.pagination-custom a:hover,
.pagination-custom .active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.pagination-custom .disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 3rem 0;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.footer-section h3 {
    color: var(--text-primary);
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.footer-section p,
.footer-section a {
    color: var(--text-secondary);
}

.footer-section a:hover {
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .card-custom .card-img-top {
        height: 150px;
    }

    .article-content h1 {
        font-size: 1.75rem;
    }

    .navbar-brand {
        font-size: 1.25rem;
    }

    .vote-buttons {
        flex-direction: column;
    }

    .reply-form {
        margin-left: 0;
    }
}

.alert-custom {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.alert-custom.success {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.alert-custom.error {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.admin-sidebar {
    background: var(--bg-card);
    min-height: 100vh;
    border-right: 1px solid var(--border-color);
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: var(--text-secondary);
    border-radius: 10px;
    margin: 0.5rem 0;
    transition: all 0.3s ease;
}

.admin-nav-link:hover,
.admin-nav-link.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.stats-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.stats-card .stats-number {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stats-card .stats-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.quill-editor {
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    min-height: 300px;
}

.ql-toolbar {
    border: none !important;
    border-bottom: 1px solid var(--border-color) !important;
    background: var(--bg-card);
}

.ql-container {
    border: none !important;
    font-size: 1rem;
    color: var(--text-primary);
}

.ql-editor {
    min-height: 250px;
    color: var(--text-primary);
}

.ql-editor.ql-blank::before {
    color: var(--text-muted);
    font-style: normal;
}

.search-box {
    position: relative;
}

.search-box input {
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: 50px;
    padding: 0.75rem 1.5rem;
    padding-left: 3rem;
    color: var(--text-primary);
    width: 100%;
    transition: border-color 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
}

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

.search-box i {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}