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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    width: 100%;
    margin: 0;
    padding: 20px;
}

/* Header */
header {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    color: #2c3e50;
    font-size: 28px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

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

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

/* Blog Grid */
.blogs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    max-width: none;
}

/* Blog Card */
.blog-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    position: relative;
    height: 350px;
    display: flex;
    flex-direction: column;
}

.blog-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.blog-card h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 20px;
}

.blog-card p {
    color: #7f8c8d;
    font-size: 14px;
    margin-bottom: 15px;
}

.blog-articles {
    margin: -15px 0;
    padding: 5px 0;
    border-top: 1px solid #ecf0f1;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.blog-articles h4 {
    color: #2c3e50;
    font-size: 14px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.blog-search-container {
    margin-bottom: 10px;
    flex-shrink: 0;
}

.blog-search-box {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    transition: border-color 0.3s ease;
}

.blog-search-box:focus {
    outline: none;
    border-color: #3498db;
}

.blog-search-box::placeholder {
    color: #95a5a6;
    font-style: italic;
}

.articles-scroll {
    flex: 1;
    overflow-y: auto;
    max-height: 150px;
}

.articles-scroll::-webkit-scrollbar {
    width: 4px;
}

.articles-scroll::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.articles-scroll::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.articles-scroll::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

.article-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    cursor: pointer;
    border-radius: 3px;
    transition: background-color 0.3s ease;
}

.article-link:hover {
    background-color: #f8f9fa;
    padding-left: 5px;
    padding-right: 5px;
}

.article-title {
    color: #3498db;
    font-size: 12px;
    flex: 1;
    margin-right: 10px;
}

.article-category {
    color: #95a5a6;
    font-size: 11px;
}

.more-articles {
    color: #95a5a6;
    font-size: 11px;
    margin-top: 5px;
    font-style: italic;
}

.blog-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #95a5a6;
    font-size: 12px;
    margin-top: auto;
    flex-shrink: 0;
}

.blog-card-id {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 10px;
    color: #bdc3c7;
    font-family: monospace;
    background: rgba(255, 255, 255, 0.8);
    padding: 2px 4px;
    border-radius: 2px;
    user-select: none;
    pointer-events: none;
    z-index: 1;
}

.blog-card-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.blog-card:hover .blog-card-actions {
    opacity: 1;
}

.blog-card-actions button {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow: auto;
}

.modal-content {
    background-color: #fff;
    margin: 50px auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

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

.modal-large {
    max-width: 900px;
}

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

.modal-header h2 {
    color: #2c3e50;
    font-size: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.close {
    color: #95a5a6;
    font-size: 28px;
    cursor: pointer;
    line-height: 20px;
}

.close:hover {
    color: #7f8c8d;
}

.modal-body {
    padding: 20px;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #2c3e50;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Category Selector */
.category-selector {
    display: flex;
    gap: 10px;
    align-items: center;
}

.category-selector select {
    flex: 1;
}

.category-display {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.3s ease;
}

.category-display:hover {
    border-color: #3498db;
}

.dropdown-arrow {
    color: #95a5a6;
    font-size: 12px;
    transition: transform 0.3s ease;
}

.category-display.active .dropdown-arrow {
    transform: rotate(180deg);
}

.category-add-btn {
    white-space: nowrap;
    background-color: #27ae60;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.category-add-btn:hover {
    background-color: #229954;
}

.inline-form {
    margin-top: 10px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.inline-form-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.inline-form-group input {
    flex: 1;
    margin: 0;
}

.inline-form-group button {
    margin: 0;
}

/* Editable Elements */
.editable-title {
    cursor: pointer;
    transition: color 0.3s ease;
}

.editable-title:hover {
    color: #3498db;
}

.blog-description-container {
    padding: 0 20px 10px 20px;
    border-bottom: 1px solid #ecf0f1;
}

.editable-description {
    color: #7f8c8d;
    font-size: 14px;
    margin: 0;
    cursor: pointer;
    transition: color 0.3s ease;
    min-height: 20px;
}

.editable-description:hover {
    color: #3498db;
}

.editable-description:empty:before {
    content: "点击添加描述...";
    color: #bdc3c7;
    font-style: italic;
}

.editable-category {
    position: relative;
    cursor: pointer;
}

.editable-category:hover {
    background-color: #e8f4f8 !important;
}

.editable-tag {
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.editable-tag:hover {
    background-color: #b3e5fc !important;
    transform: scale(1.05);
}

/* Inline edit forms */
.inline-edit-input {
    border: 2px solid #3498db;
    padding: 4px 8px;
    font-size: inherit;
    font-family: inherit;
    background: white;
    border-radius: 3px;
    outline: none;
}

.inline-edit-input:focus {
    border-color: #2980b9;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

/* Blog Detail Container */
.blog-detail-container {
    display: flex;
    gap: 20px;
    height: 600px;
}

.blog-sidebar {
    width: 250px;
    border-right: 1px solid #ecf0f1;
    padding-right: 20px;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.sidebar-header > div {
    display: flex;
    gap: 5px;
}

.sidebar-header h3 {
    color: #2c3e50;
    font-size: 16px;
}

.categories-list {
    list-style: none;
}

.categories-list li {
    padding: 10px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.categories-list li:hover {
    background-color: #f8f9fa;
}

.categories-list li.active {
    background-color: #e3f2fd;
    color: #3498db;
}

.blog-content {
    flex: 1;
    overflow-y: auto;
}

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

.content-header h3 {
    color: #2c3e50;
    font-size: 16px;
}

/* Articles List */
.articles-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.article-item {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.article-item:hover {
    background-color: #e9ecef;
}

.article-item h4 {
    color: #2c3e50;
    margin-bottom: 5px;
    font-size: 16px;
}

.article-item-meta {
    color: #95a5a6;
    font-size: 12px;
    margin-bottom: 5px;
}

.article-item-tags {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.tag {
    background-color: #e1f5fe;
    color: #0288d1;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
}

/* Article View */
.article-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    color: #7f8c8d;
    font-size: 14px;
}

.article-content {
    line-height: 1.8;
    color: #2c3e50;
    white-space: pre-wrap;
}

.article-tags {
    margin-top: 30px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Responsive */
@media (max-width: 768px) {
    .blogs-grid {
        grid-template-columns: 1fr;
    }
    
    .blog-detail-container {
        flex-direction: column;
        height: auto;
    }
    
    .blog-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #ecf0f1;
        padding-right: 0;
        padding-bottom: 20px;
        margin-bottom: 20px;
    }
    
    .modal-content {
        margin: 20px;
        width: calc(100% - 40px);
    }
}