:root {
    --primary: #0071e3;
    --primary-dark: #005ac1;
    --secondary: #1d1d1f;
    --background: #f5f5f7;
    --card: #ffffff;
    --text: #1d1d1f;
    --text-secondary: #6e6e73;
    --border: #d2d2d7;
    --success: #32d74b;
    --warning: #ffd60a;
    --error: #ff375f;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--background);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Apple风格滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #a7a7ad;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #787880;
}

/* 卡片设计 */
.card {
    background: var(--card);
    border-radius: 18px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: var(--transition);
}
.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* 按钮设计 */
.btn {
    font-family: 'SF Pro Display', sans-serif;
    font-weight: 500;
    border-radius: 12px;
    padding: 10px 20px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: -0.02em;
}
.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-dark);
    transform: scale(1.02);
}
.btn-secondary {
    background: #f5f5f7;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: #e9e9ed;
    transform: scale(1.02);
}
.btn-success {
    background: var(--success);
    color: white;
}
.btn-success:hover {
    background: #2ac845;
    transform: scale(1.02);
}
.btn-warning {
    background: var(--warning);
    color: var(--secondary);
}
.btn-warning:hover {
    background: #eac700;
    transform: scale(1.02);
}
.btn-danger {
    background: var(--error);
    color: white;
}
.btn-danger:hover {
    background: #e52f4d;
    transform: scale(1.02);
}
.btn-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* 输入框设计 */
.input-field {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    font-family: 'SF Pro Display', sans-serif;
    font-size: 16px;
    background: #f9f9fb;
    transition: var(--transition);
}
.input-field:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.2);
}

/* Toast通知 */
#toastContainer {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999 !important;
    pointer-events: none;
}
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100000 !important;
    min-width: 320px;
    padding: 16px 24px;
    border-radius: 16px;
    color: white;
    box-shadow: var(--shadow-lg);
    transform: translateX(400px);
    transition: transform 0.35s cubic-bezier(0.165, 0.84, 0.44, 1);
    font-family: 'SF Pro Display', sans-serif;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
}
.toast.show {
    transform: translateX(0);
}
.toast.success { background: rgba(50, 215, 75, 0.95); }
.toast.error { background: rgba(255, 55, 95, 0.95); }
.toast.info { background: rgba(0, 113, 227, 0.95); }
.toast.warning { background: rgba(255, 214, 10, 0.95); color: var(--secondary); }

/* 加载遮罩 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.loading-overlay.show {
    opacity: 1;
    pointer-events: all;
}

/* Apple风格加载动画 */
.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(0, 113, 227, 0.2);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 导航栏设计 */
.navbar {
    background: white;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
}
.navbar-scrolled {
    box-shadow: var(--shadow-md);
    transform: translateY(0);
}

/* 页脚设计 */
.footer {
    background: var(--secondary);
    color: rgba(255, 255, 255, 0.8);
    padding: 32px 0;
    font-size: 14px;
    line-height: 1.6;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.footer a {
    color: white;
    text-decoration: none;
    transition: var(--transition);
}
.footer a:hover {
    color: var(--primary);
}

/* 新闻卡片设计 */
.news-card {
    background: var(--card);
    border-radius: 16px;
    padding: 22px;
    margin-bottom: 18px;
    border: 1px solid var(--border);
    transition: var(--transition);
    cursor: pointer;
}
.news-card:hover {
    border-color: var(--primary);
    transform: translateX(4px);
}
.news-card.top {
    border-left: 4px solid var(--primary);
    background: linear-gradient(135deg, #f0f9ff 0%, #e6f7ff 100%);
}
.news-card.pending {
    border-left: 4px solid var(--warning);
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}
.news-card.rejected {
    border-left: 4px solid var(--error);
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

.media-name {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 220px;
    font-size: 15px;
    font-weight: 600;
    color: #333333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: keep-all;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.1;
    border: 1px solid transparent;
    letter-spacing: 0.01em;
}

.type-status-cell {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: default;
}

.type-status-sep {
    color: #9ca3af;
    font-size: 12px;
    flex-shrink: 0;
}

.type-status-cell .type-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #bbdefb;
    flex-shrink: 0;
}

.type-status-cell .status-badge {
    padding: 2px 8px;
    font-size: 12px;
    flex-shrink: 0;
}

.status-draft {
    color: #1d4ed8;
    background: #dbeafe;
    border-color: #bfdbfe;
}

.status-pending {
    color: #92400e;
    background: #fef3c7;
    border-color: #fcd34d;
}

.status-passed,
.status-published {
    color: #166534;
    background: #dcfce7;
    border-color: #86efac;
}

.status-rejected {
    color: #991b1b;
    background: #fee2e2;
    border-color: #fecaca;
}

.status-withdrawn {
    color: #9a3412;
    background: #ffedd5;
    border-color: #fdba74;
}

.status-default {
    color: #374151;
    background: #f3f4f6;
    border-color: #d1d5db;
}

.article-row {
    min-height: 48px;
}

.article-row:hover {
    background-color: #f9fbfd;
}

/* ---- 新闻列表标题样式 ---- */
.news-list-title {
    font-size: 22px;
    font-weight: 600;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    margin-top: 4px;
}

.news-list-icon {
    flex-shrink: 0;
    vertical-align: middle;
    transition: transform 0.2s ease;
}

.news-list-title:hover .news-list-icon {
    transform: scaleX(1.1);
}

/* ---- 新闻表格统一样式 ---- */
.news-table th,
.news-table td {
    text-align: center;
    vertical-align: middle;
    line-height: 1.5;
}

.news-table th:first-child,
.news-table td:first-child {
    text-align: center;
}

.news-table .article-title-col {
    text-align: left;
}

.news-table .action-btns {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* 富文本编辑器 */
.rich-editor {
    min-height: 300px;
    border: 1px solid var(--border);
    border-radius: 0 0 14px 14px;
    padding: 16px;
    background: #f9f9fb;
    transition: var(--transition);
    font-family: 'SF Pro Display', sans-serif;
    font-size: 16px;
    line-height: 1.8;
    resize: vertical;
    overflow-y: auto;
    outline: none;
}
.rich-editor:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.2);
}
.rich-editor:empty::before {
    content: attr(data-placeholder);
    color: #aeaeb2;
    pointer-events: none;
    display: block;
}
.rich-editor h2 {
    font-size: 1.3em;
    font-weight: 700;
    margin: 0.6em 0 0.3em;
}
.rich-editor blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 1em;
    margin: 0.5em 0;
    color: var(--text-secondary);
}
.rich-editor ul, .rich-editor ol {
    padding-left: 1.5em;
    margin: 0.4em 0;
}
.rich-editor li {
    margin: 0.2em 0;
}
.rich-editor b, .rich-editor strong {
    font-weight: 700;
}
.rich-editor i, .rich-editor em {
    font-style: italic;
}

/* 编辑器工具栏 */
.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    background: #f5f5f7;
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 14px 14px 0 0;
}
.toolbar-group {
    display: flex;
    align-items: center;
    gap: 2px;
}
.toolbar-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 4px;
}
.toolbar-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 13px;
    transition: all 0.15s ease;
}
.toolbar-btn:hover {
    background: rgba(0, 113, 227, 0.1);
    color: var(--primary);
}
.toolbar-btn:active {
    background: rgba(0, 113, 227, 0.2);
    transform: scale(0.95);
}

/* 文章内容渲染 */
.article-content-render {
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.article-content-render h2 {
    font-size: 1.3em;
    font-weight: 700;
    margin: 0.8em 0 0.4em;
}
.article-content-render blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 1em;
    margin: 0.6em 0;
    color: var(--text-secondary);
    background: rgba(0, 113, 227, 0.03);
    border-radius: 0 8px 8px 0;
    padding: 0.5em 1em;
}
.article-content-render ul, .article-content-render ol {
    padding-left: 1.5em;
    margin: 0.4em 0;
}
.article-content-render li {
    margin: 0.2em 0;
}
.article-content-render br + br {
    display: block;
    margin-top: 0.3em;
    content: "";
}

/* 移动端工具栏适配 */
@media (max-width: 768px) {
    .editor-toolbar {
        padding: 4px 6px;
        gap: 1px;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .editor-toolbar::-webkit-scrollbar {
        display: none;
    }
    .toolbar-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
        flex-shrink: 0;
    }
    .toolbar-divider {
        flex-shrink: 0;
        margin: 0 2px;
    }
    .rich-editor {
        min-height: 200px;
        font-size: 15px;
    }
}

/* 角色徽章 */
.role-badge {
    padding: 4px 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.role-badge.media {
    background: rgba(0, 113, 227, 0.1);
    color: var(--primary);
}
.role-badge.president {
    background: rgba(50, 215, 75, 0.1);
    color: var(--success);
}
.role-badge.delegate {
    background: rgba(102, 102, 112, 0.1);
    color: #666670;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .navbar .container {
        padding: 0 16px;
    }
    .card {
        border-radius: 16px;
    }
    .btn {
        padding: 12px 16px;
        font-size: 15px;
    }
    .toast {
        min-width: 280px;
        right: 16px;
    }
    .container {
        padding: 0 16px;
    }
    #adminActionModal > div {
        max-height: 90vh;
        margin-top: auto;
        margin-bottom: auto;
    }
    .news-table th,
    .news-table td {
        padding: 8px 6px;
        font-size: 13px;
    }
    .news-table .type-status-cell {
        gap: 2px;
    }
    .news-table .type-badge,
    .news-table .status-badge {
        font-size: 11px;
        padding: 1px 5px;
    }
    .news-table .action-btns {
        gap: 3px;
    }
    .news-table .action-btns button {
        padding: 2px;
    }
}

/* 暗黑模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #151517;
        --card: #1c1c1e;
        --text: #f5f5f7;
        --text-secondary: #aeaeb2;
        --border: #3a3a3c;
    }
    .input-field {
        background: #2c2c2e;
    }
    .input-field:focus {
        background: #2c2c2e;
    }
    .rich-editor {
        background: #2c2c2e;
    }
    .rich-editor:focus {
        background: #2c2c2e;
    }
    .editor-toolbar {
        background: #2c2c2e;
        border-color: #3a3a3c;
    }
    .toolbar-btn {
        color: #aeaeb2;
    }
    .toolbar-btn:hover {
        background: rgba(0, 113, 227, 0.2);
        color: #6cb4ee;
    }
    .toolbar-divider {
        background: #3a3a3c;
    }
    .news-list-title {
        color: #f5f5f7;
    }
    .type-status-cell .type-badge {
        background: #1a3a5c;
        color: #90caf9;
        border-color: #2a5a8c;
    }
    .type-status-sep {
        color: #5a5a5e;
    }
    .article-row:hover {
        background-color: #252528;
    }
    .navbar {
        background: #1c1c1e;
        border-bottom: 1px solid #3a3a3c;
    }
    .footer {
        background: #151517;
        border-top: 1px solid #3a3a3c;
    }
}
