* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

header {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 1.5rem;
    color: #333;
}

.header-buttons {
    display: flex;
    gap: 10px;
}

.toggle-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.toggle-btn:hover {
    background: #5568d3;
}

.toggle-btn.hidden {
    display: none;
}

/* 登录弹窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
    position: relative;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.close-btn:hover {
    color: #333;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #333;
}

.admin-panel {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.admin-panel.hidden {
    display: none;
}

.admin-panel h2,
.admin-panel h3 {
    color: #333;
    margin-bottom: 15px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-group label {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    cursor: pointer;
}

.btn-primary {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    width: 100%;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #48bb78;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.btn-secondary:hover {
    background: #38a169;
}

/* 关键词列表 */
.keywords-list {
    margin-top: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.keyword-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f7fafc;
    border-radius: 6px;
    margin-bottom: 8px;
}

.keyword-item button {
    padding: 5px 10px;
    background: #f56565;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* 分类标签 */
.tags {
    margin: 10px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tags .tag {
    background: #e2e8f0;
    color: #4a5568;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-weight: bold;
    color: #667eea;
}

.filter-group select {
    padding: 8px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9rem;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f7fafc;
    border-radius: 6px;
    margin-bottom: 8px;
}

.category-item button {
    padding: 5px 10px;
    background: #f56565;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.filter-section {
    background: white;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.filter-btn {
    background: #f7fafc;
    color: #4a5568;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.filter-btn:hover {
    background: #e2e8f0;
}

.filter-btn.active {
    background: #667eea;
    color: white;
}

.posts-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.post-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.post-card.pinned {
    border: 3px solid #f6e05e;
}

.post-card .pinned-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #f6e05e;
    color: #744210;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.post-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
    flex: 1;
}

.post-category {
    background: #e2e8f0;
    color: #4a5568;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
}

.post-content {
    color: #666;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 15px;
}

.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.post-date {
    color: #999;
    font-size: 0.85rem;
}

.post-actions {
    display: flex;
    gap: 8px;
}

.post-actions button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
}

.btn-copy {
    background: #4299e1;
    color: white;
}

.btn-copy:hover {
    background: #3182ce;
}

.btn-pin {
    background: #f6e05e;
    color: #744210;
}

.btn-pin:hover {
    background: #ecc94b;
}

.btn-delete {
    background: #f56565;
    color: white;
}

.btn-delete:hover {
    background: #e53e3e;
}

.loading {
    text-align: center;
    color: white;
    padding: 40px;
}

.empty {
    text-align: center;
    color: white;
    padding: 40px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
}

/* 分类管理单列布局 */
.categories-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.category-section {
    display: flex;
    flex-direction: column;
}

.category-section h3 {
    margin-bottom: 10px;
    color: #333;
}

/* 单行展示5个分类 */
.category-section .sortable-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    list-style: none;
    padding: 0;
}

.category-section .sortable-item {
    background: #f7fafc;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    transition: all 0.2s;
    flex: 0 0 calc(20% - 8px);
    min-width: 150px;
}

.category-section .sortable-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.category-section .sortable-item.dragging {
    opacity: 0.5;
    border-color: #667eea;
}

.category-section .sortable-item .drag-handle {
    cursor: grab;
    color: #999;
    margin-right: 10px;
    font-size: 1.2rem;
}

.category-section .sortable-item .drag-handle:active {
    cursor: grabbing;
}

.category-section .sortable-item .category-name {
    cursor: pointer;
    color: #667eea;
    text-decoration: underline;
    flex: 1;
    font-size: 0.9rem;
}

.category-section .sortable-item .category-name:hover {
    color: #5568d3;
}

.sortable-list.compact {
    max-height: 150px;
    overflow-y: auto;
}

/* 响应式设计 - 手机适配 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header {
        padding: 15px;
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    header h1 {
        font-size: 1.2rem;
    }

    .toggle-btn {
        width: 100%;
        padding: 12px;
    }

    .admin-panel {
        padding: 15px;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 16px;
        padding: 15px;
    }

    .post-card {
        padding: 15px;
    }

    .post-title {
        font-size: 1.1rem;
    }

    .post-header {
        flex-direction: column;
    }

    .post-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .post-actions {
        flex-direction: column;
    }

    .post-actions button {
        width: 100%;
        padding: 12px;
    }

    .filter-section {
        justify-content: flex-start;
    }

    .filter-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
}

/* 分类按钮容器 */
.category-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-buttons-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
    justify-content: flex-start;
    align-items: flex-start;
}

.category-buttons .category-btn,
.category-buttons-inline .category-btn {
    background: #f7fafc;
    color: #4a5568;
    border: 2px solid #e0e0e0;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
}

.category-buttons .category-btn:hover,
.category-buttons-inline .category-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e0;
}

.category-buttons .category-btn.active,
.category-buttons-inline .category-btn.active {
    background: #dc2626;
    color: white;
    border-color: #dc2626;
}

/* 分类筛选行布局 */
.filter-row {
    display: flex;
    width: 100%;
    justify-content: center;
}

.filter-row.platform-row {
    width: 100%;
    margin-bottom: 10px;
}

.filter-row.product-row {
    width: 100%;
}

.filter-group-inline {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    max-width: 100%;
}

    .filter-group-inline label {
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
    text-align: left;
}

/* Toast 提示 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #48bb78;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    font-size: 0.9rem;
    animation: slideIn 0.3s, fadeOut 0.3s 0.7s;
}

.toast.success {
    background: #48bb78;
}

.toast.error {
    background: #f56565;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1rem;
    }

    .btn-primary,
    .btn-secondary {
        padding: 14px;
        font-size: 0.9rem;
    }

    .post-content {
        font-size: 0.95rem;
    }
}
