/* ============================================================
   产品咨询清单插件 - consult-list.css
   命名空间前缀: .cl- (Consult List)
   使用 Shadow DOM 或 iframe 可进一步隔离，此处采用高特异性选择器
   ============================================================ */

/* --- 悬浮入口按钮 --- */
.cl-float-entry {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 56px;
    height: 56px;
    background: #1a73e8;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2147483640;
    box-shadow: 0 4px 16px rgba(26, 115, 232, 0.35);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.25s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.cl-float-entry:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(26, 115, 232, 0.45);
}

.cl-float-entry:active {
    transform: scale(0.95);
}

/* 图标 */
.cl-float-entry__icon {
    width: 24px;
    height: 24px;
    fill: #fff;
    flex-shrink: 0;
}

/* 角标 */
.cl-float-entry__badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    background: #e53935;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    border-radius: 10px;
    box-sizing: border-box;
    transition: transform 0.2s ease;
}

.cl-float-entry__badge--bump {
    animation: cl-bump 0.3s ease;
}

@keyframes cl-bump {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.35); }
    100% { transform: scale(1); }
}

/* 脉冲动画（有数据时提示） */
.cl-float-entry--has-items::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid #1a73e8;
    animation: cl-pulse 2s ease-out infinite;
    opacity: 0;
}

@keyframes cl-pulse {
    0%   { transform: scale(1);   opacity: 0.6; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* --- 展开面板 --- */
.cl-drawer {
    position: fixed;
    right: 24px;
    bottom: 96px;
    width: 340px;
    max-height: 70vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
    z-index: 2147483641;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #333;
}

.cl-drawer--open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* 头部 */
.cl-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
    color: #fff;
    flex-shrink: 0;
}

.cl-drawer__title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cl-drawer__title-icon {
    width: 18px;
    height: 18px;
    fill: #fff;
}

.cl-drawer__count {
    font-size: 12px;
    opacity: 0.85;
    font-weight: 400;
}

.cl-drawer__close {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.cl-drawer__close:hover {
    background: rgba(255,255,255,0.28);
}

/* 列表主体 */
.cl-drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    min-height: 80px;
}

.cl-drawer__body::-webkit-scrollbar {
    width: 4px;
}

.cl-drawer__body::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}

/* 空状态 */
.cl-drawer__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #999;
    text-align: center;
}

.cl-drawer__empty-icon {
    width: 48px;
    height: 48px;
    fill: #ddd;
    margin-bottom: 12px;
}

.cl-drawer__empty-text {
    font-size: 14px;
    line-height: 1.6;
}

/* 列表项 */
.cl-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cl-list__item {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.15s;
    animation: cl-slide-in 0.25s ease;
}

@keyframes cl-slide-in {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

.cl-list__item:hover {
    background: #f8faff;
}

.cl-list__item--removing {
    animation: cl-slide-out 0.25s ease forwards;
}

@keyframes cl-slide-out {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(40px); }
}

/* 缩略图 */
.cl-list__thumb {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: #f0f0f0;
    border: 1px solid #eee;
}

.cl-list__thumb-placeholder {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    flex-shrink: 0;
    background: #f0f4ff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a73e8;
    font-size: 20px;
    font-weight: 700;
    border: 1px solid #e0e8ff;
}

/* 信息区 */
.cl-list__info {
    flex: 1;
    margin-left: 12px;
    min-width: 0;
}

.cl-list__brand {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.cl-list__product {
    font-size: 13px;
    color: #333;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 删除按钮 */
.cl-list__remove {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #bbb;
    font-size: 16px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
    flex-shrink: 0;
    margin-left: 8px;
}

.cl-list__remove:hover {
    color: #e53935;
    background: #fef0f0;
}

/* 底部 */
.cl-drawer__footer {
    padding: 14px 20px;
    border-top: 1px solid #eee;
    background: #fafbfc;
    flex-shrink: 0;
}

.cl-drawer__summary {
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
}

.cl-drawer__summary strong {
    color: #1a73e8;
}

.cl-drawer__submit {
    width: 100%;
    height: 42px;
    border: none;
    background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.cl-drawer__submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.35);
}

.cl-drawer__submit:active:not(:disabled) {
    transform: translateY(0);
}

.cl-drawer__submit:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.cl-drawer__submit-icon {
    width: 16px;
    height: 16px;
    fill: #fff;
}

/* --- 提示 Toast --- */
.cl-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #323232;
    color: #fff;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 13px;
    z-index: 2147483642;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    white-space: nowrap;
}

.cl-toast--show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ============================================================
   按钮集成样式（页面中的"添加/删去"按钮）
   默认选择器: .add2list  | 已添加类: .is-added
   这些类名短且通用，因此优先级刻意压低，允许页面样式覆盖
   ============================================================ */

/* 默认态 —— 仅做最小样式，主要外观由页面自身 CSS 控制 */
.add2list {
    cursor: pointer;
}

/* 已添加态 —— 插件写入的文字与类名，页面可据此自定义样式 */
.add2list.is-added {
    /* 留空：让使用方在自己的 CSS 中定义视觉差异 */
}

/* --- 响应式 (移动端) --- */
@media (max-width: 480px) {
    .cl-drawer {
        right: 12px;
        left: 12px;
        width: auto;
        bottom: 80px;
        max-height: 60vh;
    }

    .cl-float-entry {
        right: 16px;
        bottom: 16px;
    }
}
