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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
}

.cms-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.cms-sidebar {
    width: 180px;
    background: #1e293b;
    color: white;
    padding: 20px 0;
    transition: width 0.3s ease, padding 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.cms-sidebar.collapsed {
    width: 60px;
    padding: 20px 0;
}

.cms-logo {
    padding: 0 15px 20px;
    font-size: 16px;
    font-weight: bold;
    border-bottom: 1px solid #334155;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.cms-sidebar.collapsed .cms-logo {
    padding: 0 0 20px;
    justify-content: center;
}

.cms-logo-text {
    transition: opacity 0.3s ease;
}

.cms-sidebar.collapsed .cms-logo-text {
    display: none;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: color 0.2s, transform 0.3s ease;
    border-radius: 4px;
}

.sidebar-toggle:hover {
    color: white;
    background: #334155;
}

.cms-sidebar.collapsed .sidebar-toggle {
    transform: rotate(180deg);
}

.cms-nav {
    overflow-y: auto;
    flex: 1;
}

.cms-menu-group {
    margin: 5px 0;
}

.cms-menu-group-title {
    padding: 8px 15px 4px;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
}

.cms-sidebar.collapsed .cms-menu-group-title {
    display: none;
}

.cms-menu-item {
    padding: 10px 15px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #cbd5e1;
    border-left: 3px solid transparent;
    white-space: nowrap;
    overflow: hidden;
    position: relative;
}

.cms-sidebar.collapsed .cms-menu-item {
    padding: 10px 0;
    justify-content: center;
    border-left: none;
    border-right: 3px solid transparent;
}

.cms-menu-item-icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.cms-menu-item-text {
    flex: 1;
}

.cms-sidebar.collapsed .cms-menu-item-text {
    display: none;
}

.cms-menu-item:hover {
    background: #334155;
    color: #fff;
}

.cms-menu-item.active {
    background: #1e3a5f;
    border-left-color: #3b82f6;
    color: #fff;
}

.cms-sidebar.collapsed .cms-menu-item.active {
    border-left-color: transparent;
    border-right-color: #3b82f6;
}

/* Main Content */
.cms-main {
    flex: 1;
    overflow: auto;
}

.cms-header {
    background: white;
    padding: 20px 30px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cms-content {
    padding: 30px;
}

/* Articles List */
.articles-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    color: white;
}

.btn-primary {
    background: #3b82f6;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-danger {
    background: #f87171;
    border: 1px solid #f87171;
}

.btn-danger:hover {
    background: #ef4444;
    border-color: #ef4444;
}

.btn-danger:disabled {
    background: #fecaca;
    border-color: #fecaca;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-small {
    padding: 4px 12px;
    font-size: 12px;
}

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

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

thead {
    background: #f9fafb;
}

th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
}

tbody tr:hover {
    background: #f9fafb;
}

.article-title {
    font-weight: 500;
    color: #111827;
    margin-bottom: 4px;
}

.article-meta {
    font-size: 12px;
    color: #6b7280;
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    background: #dbeafe;
    color: #1e40af;
    border-radius: 3px;
    font-size: 12px;
    margin-right: 4px;
}

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

/* Editor */
.editor-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

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

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

.form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea.form-input {
    min-height: 400px;
    font-family: 'Monaco', 'Menlo', monospace;
    resize: vertical;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #6b7280;
}

.error {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.success {
    background: #d1fae5;
    color: #065f46;
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 20px;
}

/* Item Cards */
.item-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.2s;
}

.item-card:hover {
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border-color: #d1d5db;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.btn-small {
    padding: 5px 15px;
    font-size: 13px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    color: white;
}

.btn-small:hover {
    opacity: 0.9;
}

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

.table-wrapper {
    max-height: 600px;
    overflow-y: auto;
    position: relative;
}

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

.data-table thead {
    position: sticky;
    top: 0;
    background: #f9fafb;
    z-index: 10;
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    color: #1f2937;
}

.data-table tbody tr:hover {
    background: #f9fafb;
}

.data-table tbody tr.selected {
    background: #eff6ff;
}

/* Toolbar */
.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e5e7eb;
    flex-wrap: wrap;
    gap: 10px;
}

.toolbar-left {
    display: flex;
    gap: 10px;
    align-items: center;
}

.toolbar-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-box {
    position: relative;
}

.search-box input {
    padding: 8px 12px 8px 36px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    width: 250px;
}

.search-box::before {
    content: '🔍';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-top: 1px solid #e5e7eb;
}

.pagination-info {
    color: #6b7280;
    font-size: 14px;
}

.pagination-controls {
    display: flex;
    gap: 5px;
}

.pagination-btn {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.pagination-btn:hover:not(:disabled) {
    background: #f3f4f6;
}

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

.pagination-btn.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

/* 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;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    margin: 0;
    color: #111827;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6b7280;
    padding: 0;
    width: 30px;
    height: 30px;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Action Buttons */
.action-btn {
    padding: 6px 10px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 16px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

.action-btn:hover {
    background: #f3f4f6;
}

.checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* 美化的确认对话框 */
.custom-confirm {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.custom-confirm.active {
    display: flex;
}

.confirm-content {
    background: white;
    border-radius: 12px;
    padding: 0;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

.confirm-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid #f3f4f6;
}

.confirm-title {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.confirm-body {
    padding: 20px 24px;
    color: #6b7280;
    font-size: 15px;
    line-height: 1.6;
}

.confirm-footer {
    padding: 16px 24px;
    background: #f9fafb;
    border-top: 1px solid #f3f4f6;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-radius: 0 0 12px 12px;
}

.confirm-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.confirm-btn-cancel {
    background: white;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.confirm-btn-cancel:hover {
    background: #f9fafb;
}

.confirm-btn-confirm {
    background: #ef4444;
    color: white;
}

.confirm-btn-confirm:hover {
    background: #dc2626;
}

/* 美化的通知提示 */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    min-width: 300px;
    padding: 16px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.3s ease;
}

.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.toast-message {
    font-size: 13px;
    color: #6b7280;
}

.toast-close {
    cursor: pointer;
    opacity: 0.5;
    font-size: 18px;
    flex-shrink: 0;
    padding: 0 4px;
}

.toast-close:hover {
    opacity: 1;
}

.toast.success {
    border-left: 4px solid #10b981;
}

.toast.success .toast-icon {
    color: #10b981;
}

.toast.success .toast-title {
    color: #065f46;
}

.toast.error {
    border-left: 4px solid #ef4444;
}

.toast.error .toast-icon {
    color: #ef4444;
}

.toast.error .toast-title {
    color: #991b1b;
}

.toast.warning {
    border-left: 4px solid #f59e0b;
}

.toast.warning .toast-icon {
    color: #f59e0b;
}

.toast.warning .toast-title {
    color: #92400e;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
