/* ========================================
   profile.css - 全局档案 & 空间管理样式
   ======================================== */

/* ========================================
   容器布局
   ======================================== */
.profile-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
}

/* ========================================
   面包屑导航
   ======================================== */
.profile-breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    border-bottom: 1px solid var(--hairline);
    flex-shrink: 0;
    font-size: var(--text-caption);
}

.breadcrumb-link {
    color: var(--info);
    cursor: pointer;
    text-decoration: none;
}
.breadcrumb-link:hover {
    text-decoration: underline;
}

.breadcrumb-sep {
    color: var(--text-secondary);
}

.breadcrumb-current {
    color: var(--muted);
    font-weight: 500;
}

/* ========================================
   内容布局：左侧边栏 + 右侧主体
   ======================================== */
.profile-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.profile-sidebar {
    width: 360px;
    flex-shrink: 0;
    overflow: hidden;
    border-right: 1px solid var(--hairline);
    display: flex;
    flex-direction: column;
    background: var(--canvas);
}

/* 置顶：头像+姓名+画像 */
.profile-sticky-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--hairline);
    background: var(--canvas);
    flex-shrink: 0;
}

/* 标签页切换栏 */
.profile-tabbar {
    display: flex; gap: 0; margin-bottom: var(--space-lg);
    border-bottom: 2px solid var(--hairline);
    background: var(--canvas);
    position: sticky; top: 0; z-index: 10;
}
.profile-tab {
    flex: 1; padding: 8px 0; text-align: center; cursor: pointer;
    background: none; border: none; border-bottom: 2px solid transparent;
    font-size: 13px; font-weight: 500; color: var(--text-secondary);
    margin-bottom: -2px; transition: all var(--transition-fast);
}
.profile-tab.active {
    color: var(--primary); border-bottom-color: var(--primary);
}
.profile-tab:hover { color: var(--primary); }

/* 可滚动：优势标签/性格/职业/分析/话术 */
.profile-scroll-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
    background: var(--canvas);
}

.profile-tabbar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--canvas);
    padding-bottom: 8px;
}

.profile-tab {
    border: 1px solid var(--hairline);
    background: var(--canvas);
    color: var(--text-secondary);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.profile-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.profile-main {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg) var(--space-xl);
}

/* ========================================
   左侧边栏 - 客户全局信息
   ======================================== */

/* 客户基本信息头 */
.profile-user-header {
    margin-bottom: var(--space-xl);
}

.profile-user-name {
    font-size: var(--text-title-lg);
    font-weight: 700;
    color: var(--ink);
    margin-bottom: var(--space-xs);
}

.profile-user-tag {
    display: inline-block;
    font-size: var(--text-small);
    color: var(--tag-text);
    background: var(--tag-bg);
    padding: 2px var(--space-sm);
    border-radius: var(--radius-pill);
    border: 1px solid var(--tag-border);
    margin-bottom: var(--space-md);
}

.profile-user-meta {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    font-size: var(--text-caption);
    color: var(--text-secondary);
}

/* 优势池标签云 */
.profile-advantage-section {
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--hairline);
}

.profile-advantage-title {
    font-size: var(--text-caption);
    font-weight: 600;
    color: var(--muted);
    margin-bottom: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-bottom: var(--space-lg);
}

.profile-strengths-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.profile-strength-item {
    font-size: var(--text-body-md);
    color: var(--body);
    padding: var(--space-sm) var(--space-md);
    background: var(--surface-soft);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
}

/* 加载状态 */
.profile-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xxl);
    color: var(--text-secondary);
}

/* ========================================
   右侧主体 - 工作空间管理
   ======================================== */
.profile-main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
}

.profile-main-header h2 {
    font-size: var(--text-title-md);
    font-weight: 600;
    color: var(--ink);
    margin: 0;
}

/* 工作空间卡片列表 */
.profile-workspace-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.profile-workspace-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: var(--space-md);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    cursor: pointer;
    background: var(--canvas);
    gap: 8px;
    min-width: 0;
}

.profile-workspace-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.profile-workspace-card.archived {
    opacity: 0.7;
}

.profile-workspace-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 0;
    flex: 1;
}

.profile-workspace-name {
    font-size: var(--text-label-md);
    font-weight: 600;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}

.profile-workspace-meta {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    font-size: var(--text-caption);
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-workspace-status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--text-small);
    padding: 2px var(--space-sm);
    border-radius: var(--radius-pill);
    white-space: nowrap;
    flex-shrink: 0;
}

.profile-workspace-status.active {
    background: var(--tag-bg-green);
    color: var(--success);
}

.profile-workspace-status.archived {
    background: var(--surface-soft);
    color: var(--text-secondary);
}

.profile-workspace-actions {
    display: flex;
    gap: var(--space-sm);
    flex-shrink: 0;
}

/* 空状态 */
.profile-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-xxl);
    color: var(--text-secondary);
    gap: var(--space-md);
    text-align: center;
}

/* ========================================
   补充：档案sidebar增强样式
   ======================================== */
.profile-user-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: var(--space-md);
}

.profile-tag-item {
    display: inline-block;
    padding: 3px 10px;
    background: var(--tag-bg);
    border: 1px solid var(--tag-border);
    border-radius: var(--radius-pill);
    font-size: var(--text-small);
    color: var(--tag-text);
    margin-bottom: 4px;
}

.profile-strength-item {
    padding: 4px 0;
    font-size: var(--text-small);
    color: var(--text-secondary);
    border-bottom: 1px solid var(--hairline);
}

.profile-strength-item:last-child {
    border-bottom: none;
}

/* 编辑按钮 */
.profile-edit-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    color: var(--text-secondary);
    opacity: 0.5;
    transition: all var(--transition-fast);
    vertical-align: middle;
}
.profile-edit-btn:hover {
    opacity: 1;
    color: var(--primary);
    border-color: var(--hairline);
    background: var(--bg-secondary);
}
.profile-advantage-title {
    display: flex;
    align-items: center;
    gap: 8px;
}
.profile-user-header {
    position: relative;
}
.profile-user-header .profile-edit-btn {
    position: absolute;
    top: 8px;
    right: 8px;
}

/* ── 档案 dossier 布局 ── */

.profile-dossier {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* ── Header Summary ── */

.profile-dossier-header {
    padding: 24px 28px 20px;
    border-bottom: 1px solid var(--hairline);
    background: var(--canvas);
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 20px;
}

.profile-dossier-header-main {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 280px;
}

.profile-dossier-header-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.profile-dossier-header-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--ink);
}

.profile-dossier-header-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-dossier-header-detail {
    font-size: 13px;
    color: var(--text-secondary);
}

.profile-summary-metrics {
    display: flex;
    gap: 20px;
    align-items: center;
}

.profile-metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 60px;
}

.profile-metric-icon {
    font-size: 18px;
}

.profile-metric-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
}

.profile-metric-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Grid: main + side ── */

.profile-dossier-grid {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 16px;
    padding: 16px 28px 28px;
}

.profile-dossier-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.profile-dossier-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── Cards ── */

.profile-dossier-card {
    border: 1px solid var(--hairline);
    border-radius: var(--radius-md);
    background: var(--canvas);
    overflow: hidden;
}

.profile-dossier-card-header {
    padding: 10px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--hairline);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

.profile-dossier-card-body {
    padding: 14px 16px;
}

/* ── Info rows ── */

.profile-info-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
}

.profile-info-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 13px;
}

.profile-info-label {
    color: var(--text-secondary);
    min-width: 48px;
}

.profile-info-value {
    color: var(--ink);
    font-weight: 500;
}

/* ── Grid layout for basic info (P0: layout optimization) ── */
.profile-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 20px;
}
.profile-info-grid .profile-info-item {
    padding: 6px 0;
}
.profile-info-grid .profile-info-label {
    min-width: 52px;
}

/* ── Dossier sections (text) ── */

.profile-dossier-section {
    margin-bottom: 14px;
}

.profile-dossier-section:last-child {
    margin-bottom: 0;
}

.profile-dossier-section-title {
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 4px;
    color: var(--ink);
}

.profile-dossier-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.profile-dossier-muted {
    color: var(--text-secondary);
    font-size: 12px;
}

/* ── Card footer (inline editing save/cancel) ── */

.profile-dossier-card-footer {
    padding: 8px 16px 14px;
    border-top: 1px solid var(--hairline);
    background: var(--bg-secondary);
}

.profile-edit-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
}

.profile-edit-save-btn {
    padding: 5px 14px;
    border: 1px solid var(--primary);
    border-radius: 4px;
    background: var(--primary);
    color: #fff;
    font-size: 12px;
    cursor: pointer;
}
.profile-edit-save-btn:hover {
    opacity: 0.85;
}

.profile-edit-cancel-btn {
    padding: 5px 14px;
    border: 1px solid var(--hairline);
    border-radius: 4px;
    background: var(--canvas);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
}
.profile-edit-cancel-btn:hover {
    border-color: var(--border-strong);
    background: var(--bg-secondary);
}

/* ── Card editing state ── */

.profile-dossier-card-editing {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}

.profile-dossier-card-editing .profile-dossier-card-body {
    padding: 12px 16px 8px;
}

/* ── Edit fields ── */

.profile-edit-field {
    margin-bottom: 10px;
}

.profile-edit-label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 3px;
    font-weight: 500;
}

.profile-edit-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--hairline);
    border-radius: 6px;
    font-size: 13px;
    background: var(--canvas);
    color: var(--ink);
    box-sizing: border-box;
    transition: border-color var(--transition-fast);
}
.profile-edit-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59,130,246,0.12);
}

.profile-edit-textarea {
    width: 100%;
    min-height: 60px;
    padding: 6px 10px;
    border: 1px solid var(--hairline);
    border-radius: 6px;
    font-size: 13px;
    background: var(--canvas);
    color: var(--ink);
    resize: vertical;
    box-sizing: border-box;
    transition: border-color var(--transition-fast);
}
.profile-edit-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59,130,246,0.12);
}

/* ── Chip editor ── */

.profile-edit-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}

.profile-edit-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: var(--tag-bg);
    border: 1px solid var(--tag-border);
    border-radius: 999px;
    font-size: 12px;
    color: var(--tag-text);
}

.profile-edit-chip-remove {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    color: var(--text-secondary);
    padding: 0 1px;
}
.profile-edit-chip-remove:hover {
    color: var(--error);
}

.profile-edit-chip-input {
    width: 100%;
    margin-top: 2px;
    font-size: 12px;
}

.profile-edit-chip-empty {
    font-size: 12px;
}

/* ── Validation error ── */

.profile-edit-error {
    color: var(--error);
    font-size: 11px;
    margin-top: 2px;
}

/* ── Responsive: narrow screen → single column ── */

@media (max-width: 800px) {
    .profile-dossier-grid {
        grid-template-columns: 1fr;
    }
    .profile-dossier-header {
        flex-direction: column;
    }
    .profile-summary-metrics {
        width: 100%;
        justify-content: flex-start;
    }
}

/* ── 顾问速览 briefing card ── */

.brief-card-body {
    padding: 14px 16px;
}

.brief-card[data-brief-collapsed="true"] .brief-card-body {
    display: none;
}

.brief-card[data-brief-collapsed="false"] .brief-card-body {
    display: block;
}

.brief-toggle-icon {
    display: inline-block;
    transition: transform 0.2s ease;
    font-size: 10px;
    margin-left: 6px;
}

.brief-card[data-brief-collapsed="false"] .brief-toggle-icon {
    transform: rotate(90deg);
}
