/* ========== 全局基础样式 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f6fa;
    color: #333;
    min-height: 100vh;
}

/* ========== 顶部导航栏 ========== */
.top-bar {
    background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
    color: #fff;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 1100;
}
.top-bar .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    color: #fff;
}
.top-bar .logo-icon {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.top-bar .nav-center {
    display: flex;
    align-items: center;
    gap: 4px;
}
.top-bar .nav-center a {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 13px;
    padding: 6px 16px;
    border-radius: 6px;
    transition: all 0.2s;
}
.top-bar .nav-center a:hover {
    color: #fff;
    background: rgba(255,255,255,0.12);
}
.top-bar .nav-center a.active {
    color: #fff;
    background: rgba(255,255,255,0.2);
    font-weight: 600;
}
.top-bar .nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.top-bar .user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.2s;
    position: relative;
}
.top-bar .user-menu:hover {
    background: rgba(255,255,255,0.15);
}
.top-bar .user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    overflow: hidden;
}
.top-bar .user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.top-bar .user-nickname {
    font-size: 13px;
    color: rgba(255,255,255,0.9);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========== 用户下拉菜单 ========== */
.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    min-width: 180px;
    padding: 6px 0;
    z-index: 200;
    display: none;
}
.user-dropdown.show { display: block; }
.user-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
}
.user-dropdown .dropdown-item:hover { background: #f5f6fa; }
.user-dropdown .dropdown-item.danger { color: #ff4d4f; }
.user-dropdown .dropdown-divider {
    height: 1px;
    background: #f0f0f0;
    margin: 4px 0;
}

/* ========== 通用按钮 ========== */
.btn {
    padding: 6px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1.5;
}
.btn-primary { background: #1890ff; color: #fff; }
.btn-primary:hover { background: #096dd9; }
.btn-success { background: #52c41a; color: #fff; }
.btn-success:hover { background: #49b015; }
.btn-warning { background: #faad14; color: #fff; }
.btn-warning:hover { background: #e09e10; }
.btn-danger { background: #ff4d4f; color: #fff; }
.btn-danger:hover { background: #e04345; }
.btn-outline { background: #fff; color: #1890ff; border: 1px solid #1890ff; }
.btn-outline:hover { background: #e6f7ff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 10px 24px; font-size: 15px; }

/* ========== 通用表单 ========== */
.field-row { margin-bottom: 12px; }
.field-row label {
    display: block;
    font-size: 12px;
    color: #888;
    margin-bottom: 4px;
    font-weight: 500;
}
.field-row input,
.field-row textarea,
.field-row select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    transition: border-color 0.2s;
}
.field-row input:focus,
.field-row textarea:focus {
    outline: none;
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24,144,255,0.12);
}
.field-row textarea { resize: vertical; min-height: 60px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ========== Toast 提示 ========== */
.toast {
    position: fixed;
    top: 70px;
    right: 20px;
    padding: 10px 20px;
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    z-index: 3000;
    animation: toastSlideIn 0.3s ease;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.toast.success { background: #52c41a; }
.toast.error { background: #ff4d4f; }
.toast.info { background: #1890ff; }
@keyframes toastSlideIn {
    from { transform: translateX(100px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ========== 加载遮罩 ========== */
.loading-overlay {
    position: fixed;
    top: 56px; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 900;
}
.loading-overlay .spinner-box {
    background: #fff;
    padding: 28px 44px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e8e8e8;
    border-top-color: #1890ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== 模态框 ========== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal {
    background: #fff;
    border-radius: 12px;
    width: 700px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 12px 48px rgba(0,0,0,0.2);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e8e8e8;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
    padding: 4px 8px;
    border-radius: 4px;
}
.modal-close:hover { background: #f0f0f0; color: #333; }
.modal-body { padding: 20px; }
.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid #e8e8e8;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ========== 状态标签 ========== */
.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}
.tag-blue { background: #e6f7ff; color: #1890ff; }
.tag-green { background: #f6ffed; color: #52c41a; }
.tag-orange { background: #fff7e6; color: #faad14; }
.tag-red { background: #fff2f0; color: #ff4d4f; }
.tag-gray { background: #f5f5f5; color: #999; }

.status-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
    white-space: nowrap;
}
.status-badge.pending { background: #f0f0f0; color: #999; }
.status-badge.analyzing { background: #fff7e6; color: #faad14; }
.status-badge.completed { background: #f6ffed; color: #52c41a; }
.status-badge.error { background: #fff2f0; color: #ff4d4f; }

/* ========== 状态栏 ========== */
.status-bar {
    padding: 6px 14px;
    font-size: 11px;
    color: #888;
    background: #fff;
    border-top: 1px solid #e8e8e8;
    display: flex;
    align-items: center;
    gap: 6px;
}
.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #52c41a;
}
.status-dot.loading { background: #faad14; animation: pulse 1s infinite; }
.status-dot.error { background: #ff4d4f; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* ========== 图片预览 ========== */
.img-preview-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    cursor: pointer;
}
.img-preview-modal img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

/* ========== 工具类 ========== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: #999; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
