﻿:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --sidebar-width: 250px;
    --header-height: 60px;
}

[data-theme="dark"] {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-hover);
}

/* 甯冨眬 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

/* 渚ц竟鏍忓竷灞€ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--card-bg);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    left: 0;
    top: 0;
    z-index: 100;
    /* Ensure visibility */
}

/* Hide toggle on desktop */
.mobile-menu-toggle {
    display: none;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 20px;
    max-width: calc(100vw - var(--sidebar-width));
}

/* 渚ц竟鏍忓鑸?*/
.nav-group {
    margin-bottom: 20px;
}

.nav-group-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-weight: 600;
    padding-left: 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--text-main);
    margin-bottom: 2px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.nav-item:hover {
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.nav-item.active {
    background-color: var(--primary-color);
    color: white;
}

.nav-item .count {
    margin-left: auto;
    background-color: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.75rem;
}

.nav-item.active .count {
    background-color: rgba(255, 255, 255, 0.2);
}

/* 鍗＄墖 */
.card {
    position: relative;
    /* Ensure absolute children (overlays) are positioned relative to card */
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    /* 浠呭鏈変氦浜掔殑鍗＄墖鐢熸晥锛屽彲鎵嬪姩娣诲姞 class */
    /* transform: translateY(-2px); */
    /* box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); */
}

/* 鐗规畩浜や簰鍗＄墖 */
.article-list .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
}

.card-meta {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    gap: 15px;
}

.card-source {
    display: flex;
    align-items: center;
    gap: 6px;
}

.source-icon {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    object-fit: contain;
}

.card-summary {
    color: var(--text-main);
    font-size: 0.95rem;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
    /* 鍏佽鎹㈣ */
    gap: 10px;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* 鎸夐挳 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    /* ... */
    white-space: nowrap;
    /* 闃叉鏂囧瓧鎹㈣ */
    flex-shrink: 0;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-size: 0.9rem;
    gap: 6px;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* 鏍囩 */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    background-color: #eff6ff;
    color: var(--primary-color);
}

.tag-sentiment-positive {
    background-color: #dcfce7;
    color: #166534;
}

.tag-sentiment-negative {
    background-color: #fee2e2;
    color: #991b1b;
}

.tag-ai {
    background-color: #f3e8ff;
    color: #7e22ce;
}

/* 鐘舵€?*/
.card.is-read {
    opacity: 0.7;
}

.card.is-read .card-title {
    font-weight: 400;
}

.star-btn {
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
}

.star-btn.active {
    color: var(--warning-color);
}

/* 鎼滅储妗?*/
.search-box {
    position: relative;
    width: 100%;
    margin-bottom: 20px;
}

.search-input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--card-bg);
    color: var(--text-main);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

/* 琛ㄥ崟 */
.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text-main);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--card-bg);
    color: var(--text-main);
    font-family: inherit;
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

/* 琛ㄦ牸 */
table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: 600;
    color: var(--text-secondary);
    background-color: rgba(0, 0, 0, 0.02);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-footer {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Loaders */
.loading-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
    margin: 30px auto;
    display: none;
}

.loading-spinner.active {
    display: block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 鍝嶅簲寮?*/
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
        z-index: 100;
        position: fixed;
        width: 250px;
        height: 100%;
        top: 0;
        left: 0;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
        width: 100%;
        max-width: 100vw;
        padding: 15px;
    }

    /* 鍚庡彴琛ㄦ牸鍝嶅簲寮?*/
    .admin-container {
        flex-direction: column;
    }

    .table-container {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-menu-toggle {
        display: block;
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        background-color: var(--primary-color);
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
        z-index: 1000;
        font-size: 1.5rem;
        border: none;
    }
}

/* 鎵归噺鎿嶄綔鏍峰紡 */
.batch-bar {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    background: var(--card-bg);
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.select-overlay {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 60px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 25px;
    z-index: 10;
    cursor: pointer;
}

.select-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.card-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    /* 闃叉鎸夐挳琚尋鍘?*/
}

.btn-text {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-text:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Modal Animation */
@keyframes modal-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modal-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal Overlay Base (Shared Props) */
.frontend-modal-overlay,
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    /* Higher z-index */
    animation: modal-fade-in 0.2s ease-out;
}

/* Modal Content Base Animation */
.frontend-modal-content,
.modal-panel {
    animation: modal-slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

/* --- Front-end Modal Specifics --- */
.frontend-modal-content {
    width: 90%;
    max-width: 400px;
    /* PC max width */
    padding: 24px;
    margin: 0 auto;
    /* Center ensure */
}

@media (max-width: 768px) {
    .frontend-modal-content {
        width: 85%;
        padding: 20px;
    }
}

.frontend-modal-content h3 {
    margin-top: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 12px;
}

.frontend-modal-content p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.6;
}

/* --- Back-end Modal Specifics --- */
.modal-panel {
    width: 90%;
    max-width: 600px;
    padding: 0;
    height: auto;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

/* Headers & Titles */
.modal-title,
.modal-header .title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Actions & Footer */
.modal-actions,
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-footer {
    padding: 16px 24px;
    background: var(--bg-color);
    border-top: 1px solid var(--border-color);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

/* Close Button */
.modal-header button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-header button:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-main);
}

/* Form Beautification */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-main);
    font-size: 0.95rem;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    /* Slight contrast */
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-main);
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background-color: var(--card-bg);
}

/* Table Style Tweaks */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 14px 16px;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    color: var(--text-main);
}

tr:hover td {
    background-color: rgba(0, 0, 0, 0.01);
}

/* Empty State / Loading */
.loading-spinner {
    display: none;
    width: 30px;
    height: 30px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
    margin: 20px auto;
}

.loading-spinner.active {
    display: block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Filter Bar Styles */
.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-bar select,
.filter-bar input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text-main);
    font-size: 0.9rem;
}

.filter-bar select:focus,
.filter-bar input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-main);
    transition: all 0.2s;
}

.filter-tag:hover {
    border-color: var(--primary-color);
}

.filter-tag.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}
/* 强制修复 PC 端侧边栏显示 */
@media (min-width: 769px) {
    .sidebar {
        display: block !important;
        width: 250px !important;
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        height: 100vh !important;
        transform: none !important;
        z-index: 100 !important;
        border-right: 1px solid var(--border-color);
    }
    .main-content {
        margin-left: 250px !important;
        width: auto !important;
        padding: 30px !important;
    }
    .mobile-menu-toggle {
        display: none !important;
    }
}

/* 文章卡片固定高度与布局优化 */
.article-card {
    height: 340px !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}
.card-summary {
    flex: 1 !important;
    overflow: hidden !important;
    margin-bottom: 10px !important;
    display: -webkit-box;
    -webkit-line-clamp: 6 !important;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
}
.card-footer {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    margin-top: auto !important;
    padding-top: 10px;
}
.card-actions {
    align-self: flex-end !important;
    width: 100% !important;
    display: flex !important;
    justify-content: flex-end !important;
}
