/* =========================================================================
   AI 深度诊断能力清单（Schema Drawer）通用样式
   -----------------------------------------------
   - 浮动按钮（fab）：固定在视口右侧中部，竖向文字
   - 遮罩（backdrop）：半透明覆盖层
   - 抽屉（drawer）：从右侧滑入，宽 440px
   - 字段矩阵（matrix）：三档（required / recommended / advanced）
   ========================================================================= */

/* ---- 浮动按钮 ---- */
.sd-fab {
    position: fixed; right: 0; top: 40%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #3b82f6, #0ea5e9);
    color: white; padding: 16px 10px;
    border: none; border-radius: 12px 0 0 12px;
    cursor: pointer; z-index: 80;
    writing-mode: vertical-rl; text-orientation: mixed;
    font-size: 0.82rem; font-weight: 600; letter-spacing: 3px;
    box-shadow: -2px 4px 16px rgba(59, 130, 246, 0.35);
    transition: all 0.2s ease;
    display: none; user-select: none;
    align-items: center; gap: 6px;
}
.sd-fab.visible { display: inline-flex; }
.sd-fab:hover { padding-right: 14px; box-shadow: -2px 4px 22px rgba(59, 130, 246, 0.55); }
.sd-fab i { writing-mode: horizontal-tb; font-size: 1rem; }
/* 竖排按钮内局部横排字符（如 "AI"）：text-combine-upright 把多字符合并为一个字宽 */
.sd-fab-tcu {
    text-combine-upright: all;
    -ms-text-combine-horizontal: all;
    -webkit-text-combine: horizontal;
    letter-spacing: 0;
}

/* ---- 遮罩 ---- */
.sd-backdrop {
    position: fixed; inset: 0; background: rgba(15, 23, 42, 0.35);
    z-index: 85; opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease;
}
.sd-backdrop.open { opacity: 1; pointer-events: auto; }

/* ---- 抽屉 ---- */
.sd-drawer {
    position: fixed; top: 0; right: 0; height: 100vh;
    width: 440px; max-width: 94vw;
    background: white; z-index: 90;
    box-shadow: -4px 0 28px rgba(0,0,0,0.12);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex; flex-direction: column;
}
.sd-drawer.open { transform: translateX(0); }

.sd-drawer-head {
    display: flex; align-items: center; gap: 10px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}
.sd-drawer-head-icon {
    width: 32px; height: 32px; border-radius: 8px;
    background: linear-gradient(135deg, #3b82f6, #0ea5e9);
    color: white; display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.sd-drawer-head-text { flex: 1; min-width: 0; }
.sd-drawer-head-title { font-weight: 700; color: #1e3a8a; font-size: 0.95rem; }
.sd-drawer-head-desc  { font-size: 0.72rem; color: #1e40af; margin-top: 2px; }
.sd-drawer-close {
    background: none; border: none; cursor: pointer;
    font-size: 1.3rem; color: #9ca3af;
    width: 34px; height: 34px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; flex-shrink: 0;
}
.sd-drawer-close:hover { background: #e5e7eb; color: #1f2937; }

.sd-drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px; }

/* ---- 分档 ---- */
.sd-tier { margin-bottom: 16px; }
.sd-tier-head {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.82rem; font-weight: 700; margin-bottom: 10px;
    padding-bottom: 6px; border-bottom: 1px dashed #e5e7eb;
}
.sd-tier-badge {
    padding: 2px 8px; border-radius: 999px; font-size: 0.68rem; font-weight: 700;
}
.sd-tier--required   .sd-tier-head { color: #b91c1c; }
.sd-tier--required   .sd-tier-badge { background: #fee2e2; color: #b91c1c; }
.sd-tier--recommended .sd-tier-head { color: #b45309; }
.sd-tier--recommended .sd-tier-badge { background: #fef3c7; color: #b45309; }
.sd-tier--advanced   .sd-tier-head { color: #15803d; }
.sd-tier--advanced   .sd-tier-badge { background: #dcfce7; color: #15803d; }

/* ---- 字段卡 ---- */
.sd-field {
    padding: 10px 12px; border-radius: 8px;
    background: #f8fafc; margin-bottom: 8px;
    border-left: 3px solid transparent; transition: all 0.2s;
}
.sd-field:hover { background: #f0f9ff; transform: translateX(2px); }
.sd-tier--required   .sd-field { border-left-color: #ef4444; }
.sd-tier--recommended .sd-field { border-left-color: #f59e0b; }
.sd-tier--advanced   .sd-field { border-left-color: #10b981; }

.sd-field-name {
    font-size: 0.85rem; font-weight: 600; color: #1f2937;
    display: flex; align-items: center; gap: 6px;
}
.sd-field-name i { font-size: 1rem; }
.sd-field-alias {
    font-size: 0.7rem; color: #9ca3af; margin-top: 2px; font-weight: 400;
}
.sd-field-unlock {
    font-size: 0.76rem; color: #4b5563; line-height: 1.7;
    margin-top: 4px;
}
.sd-field-unlock ul { margin: 0; padding-left: 18px; }
.sd-field-unlock li { margin-bottom: 2px; }
.sd-field-unlock li b { color: #0369a1; font-weight: 600; }

/* ---- 数据周期建议 ---- */
.sd-period {
    margin-top: 14px; padding: 12px 14px; border-radius: 8px;
    background: linear-gradient(135deg, #fef3c7 0%, #fffbeb 100%);
    border: 1px solid #fcd34d;
}
.sd-period-title {
    font-size: 0.78rem; font-weight: 700; color: #92400e;
    display: flex; align-items: center; gap: 6px; margin-bottom: 8px;
}
.sd-period-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
    font-size: 0.72rem; color: #78350f;
}
.sd-period-item {
    background: white; border-radius: 6px; padding: 6px 8px;
    text-align: center; border: 1px solid #fde68a;
}
.sd-period-item b { color: #92400e; font-size: 0.78rem; display: block; }

/* ---- AI 诊断 CTA 按钮 ---- */
.sd-cta-btn {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    width: 100%; margin-top: 18px;
    padding: 11px 0; border: none; border-radius: 10px; cursor: pointer;
    font-size: 0.875rem; font-weight: 600; color: #fff;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 60%, #a78bfa 100%);
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.30);
    transition: opacity 0.18s, transform 0.18s, box-shadow 0.18s;
}
.sd-cta-btn:hover {
    opacity: 0.92; transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.40);
}
.sd-cta-btn:active { transform: translateY(0); opacity: 1; }
.sd-cta-btn i { font-size: 1rem; }
