/********** 管理后台样式 **********/

/* Layout */
.admin-layout {
    display: flex;
    min-height: 100vh;
    background: #f8fafc;
}

/* Sidebar */
.admin-sidebar {
    width: 260px;
    background: #1e293b;
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.admin-brand {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #334155;
}

.admin-logo {
    font-size: 28px;
}

.admin-brand-text {
    font-size: 18px;
    font-weight: 600;
}

.admin-nav {
    flex: 1;
    padding: 16px 12px;
}

.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: all 0.2s;
    font-size: 14px;
    position: relative;
}

.admin-nav-item:hover {
    background: #334155;
    color: white;
}

.admin-nav-item.active {
    background: #4f46e5;
    color: white;
}

.admin-nav-item i {
    width: 20px;
    text-align: center;
}

.admin-badge {
    position: absolute;
    right: 12px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}

.admin-sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid #334155;
}

/* Main Content */
.admin-main {
    flex: 1;
    margin-left: 260px;
    padding: 32px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e2e8f0;
}

.admin-title {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.published {
    background: #dcfce7;
    color: #166534;
}

.stat-icon.drafts {
    background: #fef3c7;
    color: #92400e;
}

.stat-icon.wechat {
    background: #dcfce7;
    color: #22c55e;
}

.stat-number {
    display: block;
    font-size: 32px;
    font-weight: 700;
    color: #1e293b;
}

.stat-label {
    font-size: 14px;
    color: #64748b;
}

/* Tabs */
.admin-tab {
    display: none;
}

.admin-tab.active {
    display: block;
}

/* Articles Section */
.recent-articles h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #1e293b;
}

.articles-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
}

.filter-group select {
    padding: 10px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.search-group {
    position: relative;
    width: 300px;
}

.search-group i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

.search-group input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
}

/* Table */
.articles-table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.articles-table {
    width: 100%;
    border-collapse: collapse;
}

.articles-table th,
.articles-table td {
    padding: 16px;
    text-align: left;
    font-size: 14px;
}

.articles-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
    border-bottom: 1px solid #e2e8f0;
}

.articles-table td {
    border-bottom: 1px solid #f1f5f9;
}

.articles-table tr:hover td {
    background: #f8fafc;
}

.articles-table tr:last-child td {
    border-bottom: none;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.published {
    background: #dcfce7;
    color: #166534;
}

.status-badge.draft {
    background: #fef3c7;
    color: #92400e;
}

.sync-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 14px;
}

.sync-badge.synced {
    background: #dcfce7;
    color: #22c55e;
}

.sync-badge.not-synced {
    background: #f1f5f9;
    color: #cbd5e1;
}

.table-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #f1f5f9;
    color: #334155;
}

.btn-icon.edit:hover {
    background: #dbeafe;
    color: #2563eb;
}

.btn-icon.sync:hover {
    background: #dcfce7;
    color: #16a34a;
}

.btn-icon.delete:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 24px;
    border-top: 1px solid #e2e8f0;
}

.pagination button {
    padding: 8px 16px;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #64748b;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    border-color: #4f46e5;
    color: #4f46e5;
}

.pagination button.active {
    background: #4f46e5;
    border-color: #4f46e5;
    color: white;
}

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

/* Editor */
.article-form {
    max-width: 900px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
}

.form-group input[type="text"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.form-actions {
    display: flex;
    gap: 12px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
}

/* SimpleMDE Customization */
.editor-toolbar {
    border-radius: 8px 8px 0 0;
    border: 1px solid #e2e8f0;
    border-bottom: none;
}

.CodeMirror {
    border: 1px solid #e2e8f0;
    border-radius: 0 0 8px 8px;
    min-height: 400px;
}

.editor-statusbar {
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 8px 8px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.modal-content.modal-small {
    max-width: 400px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #64748b;
    cursor: pointer;
}

.modal-body {
    padding: 24px;
}

.modal-body p {
    color: #64748b;
    margin-bottom: 16px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
}

/* Sync Steps */
.sync-info {
    background: #f8fafc;
    padding: 16px;
    border-radius: 8px;
    margin: 16px 0;
}

.sync-info p {
    margin-bottom: 8px;
    font-size: 14px;
}

.sync-info p:last-child {
    margin-bottom: 0;
}

.sync-steps {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
}

.sync-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #94a3b8;
}

.sync-step i {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.sync-step.active i {
    background: #4f46e5;
    color: white;
}

.sync-step.completed i {
    background: #22c55e;
    color: white;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 32px;
    right: 32px;
    padding: 16px 24px;
    background: #1e293b;
    color: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    z-index: 1001;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    background: #22c55e;
}

.toast.error {
    background: #ef4444;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px;
    color: #64748b;
}

/* Responsive */
@media (max-width: 768px) {
    .admin-sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .admin-main {
        margin-left: 0;
    }
    
    .admin-layout {
        flex-direction: column;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .articles-toolbar {
        flex-direction: column;
    }
    
    .search-group {
        width: 100%;
    }
    
    .articles-table {
        font-size: 13px;
    }
    
    .articles-table th,
    .articles-table td {
        padding: 12px;
    }
}
