/* 管理后台样式 */

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

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

/* 加载动画 */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #666;
}

.loading-spinner span {
    margin-top: 12px;
    font-size: 14px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e0e0e0;
    border-top-color: #1890ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 布局 */
#admin-app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    background: #001529;
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.sidebar-user {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    margin-top: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 10px 0;
    overflow-y: auto;
}

.sidebar-nav button {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.sidebar-nav button:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.sidebar-nav button.active {
    background: #1890ff;
    color: #fff;
}

.nav-icon {
    margin-right: 10px;
    font-size: 16px;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.back-link, .logout-link {
    display: block;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 13px;
    margin-bottom: 8px;
    transition: color 0.2s;
}

.back-link:hover, .logout-link:hover {
    color: #fff;
}

main {
    flex: 1;
    margin-left: 220px;
    padding: 24px;
    max-width: 1200px;
}

/* 标题 */
h2 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #1a1a1a;
}

h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

/* 卡片 */
.form-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 20px;
}

/* 表单 */
.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.form-group {
    flex: 1;
    min-width: 150px;
}

.form-group-btn {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 6px;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24,144,255,0.2);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
}

.form-tip {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

/* 按钮 */
.btn-primary {
    background: #1890ff;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #40a9ff;
}

.btn-edit, .btn-delete, .btn-publish {
    padding: 5px 12px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    margin-right: 5px;
    transition: opacity 0.2s;
}

.btn-edit {
    background: #52c41a;
    color: #fff;
}

.btn-delete {
    background: #ff4d4f;
    color: #fff;
}

.btn-publish {
    background: #1890ff;
    color: #fff;
}

.btn-edit:hover, .btn-delete:hover, .btn-publish:hover {
    opacity: 0.85;
}

/* 表格 */
.table-wrapper {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow-x: auto;
}

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

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

th {
    background: #fafafa;
    font-weight: 600;
    color: #333;
}

tr:hover {
    background: #fafafa;
}

.action-cell {
    white-space: nowrap;
}

/* 状态徽章 */
.status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.status-badge.pending {
    background: #fff7e6;
    color: #fa8c16;
}

.status-badge.posting {
    background: #e6f7ff;
    color: #1890ff;
}

.status-badge.posted {
    background: #f6ffed;
    color: #52c41a;
}

.status-badge.failed {
    background: #fff1f0;
    color: #ff4d4f;
}

.progress-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    background: #f0f0f0;
    color: #666;
}

/* 内容预览 */
.content-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 批量预览 */
.batch-preview {
    margin-top: 8px;
}

.preview-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #e6f7ff;
    color: #1890ff;
    border-radius: 4px;
    font-size: 12px;
}

/* 教程卡片 */
.tutorial-card {
    background: #fffbe6;
    border: 1px solid #ffe58f;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.tutorial-card h4 {
    font-size: 15px;
    margin-bottom: 10px;
    color: #d48806;
}

.tutorial-card p {
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
}

.tutorial-card ol {
    padding-left: 20px;
    font-size: 13px;
    color: #666;
}

.tutorial-card li {
    margin-bottom: 5px;
}

.tutorial-card code {
    background: rgba(0,0,0,0.06);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.tutorial-card .tip {
    margin-top: 10px;
    color: #52c41a;
}

/* 弹窗 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-box {
    background: #fff;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-box-large {
    max-width: 700px;
}

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

.modal-box-header h3 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.modal-box-body {
    padding: 20px;
}

/* 禁用输入 */
.disabled-input {
    background: #f5f5f5;
    cursor: not-allowed;
}

/* Toast 提示 */
.admin-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    z-index: 2000;
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.3s;
}

.admin-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.admin-toast-success {
    background: #52c41a;
}

.admin-toast-error {
    background: #ff4d4f;
}

.admin-toast-info {
    background: #1890ff;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.stat-card .stat-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1890ff;
}

/* 响应式 */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    
    .sidebar-header h2,
    .sidebar-user,
    .sidebar-nav button span:not(.nav-icon),
    .sidebar-footer a {
        display: none;
    }
    
    main {
        margin-left: 60px;
        padding: 15px;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 图标输入框 */
.icon-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.icon-input-wrapper input {
    flex: 1;
}

.icon-picker-btn {
    flex-shrink: 0;
    padding: 10px 14px;
    background: #f0f0f0;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.icon-picker-btn:hover {
    background: #e6f7ff;
    border-color: #1890ff;
    color: #1890ff;
}

/* 图标选择器弹窗 */
.modal-box-icon-picker {
    max-width: 600px;
}

.icon-picker-search {
    margin-bottom: 16px;
}

.icon-picker-search input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.icon-picker-search input:focus {
    outline: none;
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24,144,255,0.2);
}

.icon-picker-groups {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 4px;
}

.icon-picker-groups::-webkit-scrollbar {
    width: 6px;
}

.icon-picker-groups::-webkit-scrollbar-thumb {
    background: #d9d9d9;
    border-radius: 3px;
}

.icon-picker-group {
    margin-bottom: 16px;
}

.icon-picker-group-name {
    font-size: 13px;
    color: #888;
    margin-bottom: 8px;
    font-weight: 500;
}

.icon-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    gap: 6px;
}

.icon-picker-item {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: #fafafa;
    border: 1px solid #f0f0f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
}

.icon-picker-item:hover {
    background: #e6f7ff;
    border-color: #1890ff;
    transform: scale(1.1);
}

.icon-picker-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 14px;
}

/* v-cloak */
[v-cloak] {
    display: none;
}

/* 头像上传 */
.avatar-upload-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-preview {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e0e0e0;
}

.avatar-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #999;
    border: 2px dashed #d0d0d0;
}

.btn-upload-avatar {
    padding: 6px 14px;
    background: #1890ff;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.btn-upload-avatar:hover {
    background: #40a9ff;
}
