/* 自定义样式 */

/* 合约颜色（背景 + 边框） */
.contract-rb { background: #fff3e0; border-left: 4px solid #ff9800; }
.contract-i { background: #e3f2fd; border-left: 4px solid #2196f3; }
.contract-c { background: #f3e5f5; border-left: 4px solid #9c27b0; }
.contract-p { background: #e8f5e9; border-left: 4px solid #4caf50; }
.contract-ru { background: #fce4ec; border-left: 4px solid #e91e63; }
.contract-sp { background: #fff9c4; border-left: 4px solid #fbc02d; }
.contract-sn { background: #e0f2f1; border-left: 4px solid #009688; }
.contract-ao { background: #f1f8e9; border-left: 4px solid #8bc34a; }
.contract-SR { background: #ede7f6; border-left: 4px solid #673ab7; }
.contract-SA { background: #fbe9e7; border-left: 4px solid #ff5722; }
.contract-FG { background: #e1f5fe; border-left: 4px solid #03a9f4; }
.contract-CF { background: #fff8e1; border-left: 4px solid #ff9800; }
.contract-j { background: #efebe9; border-left: 4px solid #795548; }
.contract-default { background: #f5f5f5; border-left: 4px solid #9e9e9e; }

/* 重要性颜色 */
.imp-10, .imp-9 { color: #d32f2f; }
.imp-8, .imp-7 { color: #f57c00; }
.imp-6, .imp-5 { color: #fbc02d; }
.imp-4, .imp-3, .imp-2, .imp-1, .imp-0 { color: #9e9e9e; }

/* 情绪颜色（涨红跌绿） */
.bull-strong { color: #b71c1c; background: #ffcdd2; }  /* 强烈看涨：深红 */
.bull { color: #d32f2f; background: #ffebee; }        /* 看涨：浅红 */
.neutral { color: #616161; background: #f5f5f5; }     /* 中性：灰色 */
.bear { color: #388e3c; background: #e8f5e9; }        /* 看跌：浅绿 */
.bear-strong { color: #1b5e20; background: #c8e6c9; } /* 强烈看跌：深绿 */

/* 合约标签 */
.contract-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
}

/* 详情页样式 */
.contract-analysis {
    border-color: #e5e7eb;
}

.contract-analysis.contract-rb { border-left-color: #ff9800; }
.contract-analysis.contract-i { border-left-color: #2196f3; }
.contract-analysis.contract-c { border-left-color: #9c27b0; }
.contract-analysis.contract-p { border-left-color: #4caf50; }

/* 加载动画 */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* 因素列样式 - 允许换行 */
.factor-cell {
    width: 350px;
    min-width: 350px;
    max-width: 350px;
    word-break: break-word;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .contract-periods {
        flex-direction: column;
    }
    
    .period-item {
        min-width: 100%;
    }
}

/* 筛选面板动画 */
#filtersContainer {
    transition: width 0.3s ease, opacity 0.3s ease;
}

#filtersContainer.collapsed {
    width: 0 !important;
    opacity: 0;
    overflow: hidden;
}

/* 时间预设按钮选中状态 */
.time-preset-btn.active {
    background-color: #dbeafe;
    border-color: #3b82f6;
    color: #1e40af;
}

/* Checkbox样式 */
.contract-checkbox {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.contract-checkbox:hover {
    background-color: #f9fafb;
}

.contract-checkbox input[type="checkbox"] {
    margin-right: 6px;
}

.contract-checkbox label {
    font-size: 0.875rem;
    cursor: pointer;
    flex: 1;
}

/* 源过滤器复选框 */
.source-checkbox {
    display: flex;
    align-items: center;
    padding: 4px 6px;
    cursor: pointer;
}

.source-checkbox:hover {
    background-color: #f9fafb;
}

.source-checkbox input[type="checkbox"] {
    margin-right: 6px;
}

.source-checkbox label {
    font-size: 0.875rem;
    cursor: pointer;
    flex: 1;
}

/* 新闻源宽度由 JS 动态计算 */
.news-source {
    display: inline-block;
    text-align: left;
}

/* ========== 移动端触摸设备适配 ========== */

/* 触摸设备上禁用CSS hover效果，改由JS控制 */
@media (hover: none) and (pointer: coarse) {
    /* 搜索帮助：禁用hover，由JS点击控制 */
    .search-help-trigger:hover .search-help-tooltip {
        visibility: hidden;
        opacity: 0;
    }
    
    /* Tooltip：禁用hover，由JS点击控制 */
    .tooltip:hover .tooltip-text,
    .tooltip .tooltip-text:hover {
        visibility: hidden;
        opacity: 0;
    }
    
    /* 重复新闻徽章：增加点击区域 */
    .duplicate-badge {
        padding: 4px;
        margin: -4px;
    }
    
    /* Tooltip 增加点击区域 */
    .tooltip .importance-badge,
    .tooltip .sentiment-badge {
        padding: 4px 8px;
        min-width: 32px;
        min-height: 32px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* 移动端悬浮框位置优化 */
@media (max-width: 640px) {
    .duplicate-tooltip {
        left: 8px !important;
        right: 8px !important;
        min-width: auto;
        max-width: calc(100vw - 16px);
    }
    
    .tooltip .tooltip-text {
        width: calc(100vw - 32px);
        max-width: 350px;
        left: 8px !important;
        right: auto;
    }
    
    .search-help-tooltip {
        right: -60px !important;
        left: auto !important;
    }
}

/* 移动端悬浮框底部可点击 */
@media (hover: none) and (pointer: coarse) {
    .duplicate-tooltip {
        pointer-events: auto;
    }
    
    .duplicate-tooltip-footer {
        cursor: pointer;
        padding: 10px 8px;
        margin: 0 -12px -12px -12px;
        background: rgba(59, 130, 246, 0.15);
        border-radius: 0 0 8px 8px;
        text-align: center;
    }
    
    .duplicate-tooltip-footer span {
        color: #93c5fd;
        font-weight: 500;
    }
    
    .duplicate-tooltip-footer:active {
        background: rgba(59, 130, 246, 0.3);
    }
}

/* 移动端重复新闻悬浮框 - 模态框样式 */
.duplicate-tooltip.mobile-modal {
    z-index: 10000;
}

.duplicate-tooltip.mobile-modal::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
}

.duplicate-tooltip-close {
    display: none;
}

.duplicate-tooltip.mobile-modal .duplicate-tooltip-close {
    display: flex;
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    color: #e5e7eb;
    cursor: pointer;
    transition: background 0.2s;
}

.duplicate-tooltip.mobile-modal .duplicate-tooltip-close:hover,
.duplicate-tooltip.mobile-modal .duplicate-tooltip-close:active {
    background: rgba(255, 255, 255, 0.25);
}

/* 移动端：增大可点击区域 */
@media (max-width: 640px) {
    .duplicate-badge {
        padding: 6px 10px !important;
        margin: -4px !important;
        font-size: 13px !important;
    }
    
    .duplicate-tooltip-row {
        padding: 10px 8px;
        min-height: 48px;
    }
    
    .dup-title {
        font-size: 13px;
    }
    
    .dup-row-meta {
        font-size: 12px;
        padding-left: 60px;
    }
}

/* ========== 复制链接按钮样式 ========== */

.share-btn {
    cursor: pointer;
    transition: transform 0.15s ease, color 0.15s ease;
    padding: 2px 4px;
    border-radius: 4px;
}

.share-btn:hover {
    transform: scale(1.15);
    background-color: rgba(59, 130, 246, 0.1);
}

.share-btn:active {
    transform: scale(0.95);
}

.share-btn.copy-success {
    color: #10b981 !important;
    transform: scale(1.2);
    animation: copyPulse 0.3s ease-out;
}

@keyframes copyPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1.2); }
}

/* 复制成功浮动提示 */
.copy-toast {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, 0);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.copy-toast.show {
    opacity: 1;
    transform: translate(-50%, -100%);
}

.copy-toast.hide {
    opacity: 0;
    transform: translate(-50%, -120%);
}

body.dark-mode .share-btn:hover {
    background-color: rgba(59, 130, 246, 0.2);
}

/* ========== 评分筛选样式 ========== */

.score-filter-select {
    padding: 4px 6px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: white;
    font-size: 11px;
    min-width: 70px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.score-filter-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.score-filter-input-num {
    width: 40px;
    padding: 4px 6px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    text-align: center;
    font-size: 11px;
}

.score-filter-input-num:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.score-filter-add-btn {
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    padding: 0 8px;
    white-space: nowrap;
}

.score-filter-add-btn:hover {
    background: #2563eb;
    transform: scale(1.05);
}

.score-filter-add-btn:active {
    transform: scale(0.95);
}

/* 条件标签 */
.score-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    font-size: 11px;
    color: #1e40af;
    transition: background 0.15s;
}

.score-filter-tag:hover {
    background: #dbeafe;
}

.score-filter-tag .tag-text {
    white-space: nowrap;
}

.score-filter-tag .tag-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-size: 12px;
    line-height: 1;
}

.score-filter-tag .tag-remove:hover {
    background: #fecaca;
    color: #dc2626;
}

/* 条件之间的逻辑按钮 */
.score-filter-logic-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s;
    margin: 0 4px;
}

.score-filter-logic-btn:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.score-filter-logic-btn.and {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

.score-filter-logic-btn.or {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #92400e;
}

/* 条件行 */
.score-filter-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

/* 夜间模式适配 */
body.dark-mode .score-filter-select,
body.dark-mode .score-filter-input-num {
    background: #374151;
    border-color: #4b5563;
    color: #e5e7eb;
}

body.dark-mode .score-filter-input {
    background: #1f2937;
    border-color: #374151;
}

body.dark-mode .score-filter-tag {
    background: #1e3a5f;
    border-color: #3b82f6;
    color: #93c5fd;
}

body.dark-mode .score-filter-tag:hover {
    background: #1e40af;
}

body.dark-mode .score-filter-logic-btn {
    background: #374151;
    border-color: #4b5563;
    color: #9ca3af;
}

body.dark-mode .score-filter-logic-btn.and {
    background: #064e3b;
    border-color: #10b981;
    color: #6ee7b7;
}

body.dark-mode .score-filter-logic-btn.or {
    background: #78350f;
    border-color: #f59e0b;
    color: #fcd34d;
}
