/**
 * OneTruth（万触）侦探主题组件库
 * V1.2 版本 - 包含侦探主题元素和动画效果
 */

/* ==================== 颜色系统 ==================== */
:root {
    /* 侦探主题色 */
    --detective-black: #1a1a2e;
    --detective-gray: #2d2d44;
    --evidence-blue: #165DFF;
    --evidence-blue-light: #4d8dff;
    --badge-orange: #FF7D00;
    --seal-red: #ff4757;
    
    /* 资产缩写统一颜色 */
    --otp-color: #52c41a;  /* OTP 成长积分 - 绿色 */
    --ott-color: #165DFF;  /* OTT 参与币 - 蓝色 */
    --otd-color: #722ED1;  /* OTD 治理币 - 紫色 */
    
    /* 动画时长 */
    --animation-fast: 100ms;
    --animation-normal: 300ms;
    --animation-slow: 500ms;
    --animation-extra-slow: 1000ms;
}

/* ==================== 侦探图标动画 ==================== */

/* 放大镜扫描动画 */
@keyframes magnifierScan {
    0% { transform: translateX(-100%) rotate(0deg); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translateX(100%) rotate(15deg); opacity: 0; }
}

.magnifier-scan {
    position: relative;
    overflow: hidden;
}

.magnifier-scan::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(22, 93, 255, 0.1) 50%,
        transparent 100%
    );
    animation: magnifierScan 1.5s ease-in-out;
}

/* 放大镜旋转加载 */
@keyframes magnifierSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.magnifier-spin {
    animation: magnifierSpin 1s linear infinite;
}

/* 指纹确认动画 */
@keyframes fingerprintConfirm {
    0% { transform: scale(1); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 0; }
}

.fingerprint-confirm {
    animation: fingerprintConfirm var(--animation-normal) ease-out;
}

/* 印章盖下动画 */
@keyframes stampDown {
    0% { transform: translateY(-20px) rotate(-10deg); opacity: 0; }
    60% { transform: translateY(5px) rotate(5deg); }
    80% { transform: translateY(-3px) rotate(-2deg); }
    100% { transform: translateY(0) rotate(0deg); opacity: 1; }
}

.stamp-down {
    animation: stampDown var(--animation-slow) ease-out;
}

/* 锁图标动画 */
@keyframes lockOpen {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(30deg); }
}

@keyframes lockClose {
    0% { transform: rotate(30deg); }
    100% { transform: rotate(0deg); }
}

.lock-open {
    animation: lockOpen var(--animation-normal) ease-out;
}

.lock-close {
    animation: lockClose var(--animation-normal) ease-out;
}

/* ==================== 页面加载动画 ==================== */

/* 卡片滑入动画 */
@keyframes slideInLeft {
    0% { transform: translateX(-30px); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

@keyframes slideInRight {
    0% { transform: translateX(30px); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

.card-slide-in {
    animation: slideInLeft var(--animation-slow) ease-out;
}

/* 卡片从下向上滑入 */
@keyframes slideInUp {
    0% { transform: translateY(30px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.slide-up {
    animation: slideInUp var(--animation-slow) ease-out;
}

/* 卷轴展开动画 */
@keyframes scrollUnfold {
    0% { transform: scaleX(0); opacity: 0; }
    100% { transform: scaleX(1); opacity: 1; }
}

.scroll-unfold {
    animation: scrollUnfold var(--animation-slow) ease-out;
}

/* 洗牌动画 */
@keyframes shuffle {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-10px); }
    75% { transform: translateY(10px); }
}

.card-shuffle {
    animation: shuffle 0.3s ease-in-out;
}

/* ==================== 按钮交互效果 ==================== */

/* 按钮指纹确认 */
.btn-fingerprint {
    position: relative;
    overflow: hidden;
}

.btn-fingerprint::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, rgba(22, 93, 255, 0.3) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    opacity: 0;
    pointer-events: none;
}

.btn-fingerprint:active::after {
    animation: fingerprintConfirm var(--animation-normal) ease-out;
}

/* 按钮高亮边框 */
.btn-evidence-border {
    transition: all var(--animation-normal) ease;
}

.btn-evidence-border:active {
    box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.3);
    transform: scale(0.98);
}

/* ==================== 状态标签 ==================== */

/* 高影响标签 */
.high-impact-badge {
    background: linear-gradient(135deg, #FF7D00, #FFA500);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(255, 125, 0, 0.3);
}

/* 保护态标签 */
.protection-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.protection-badge.l1 {
    background: rgba(22, 93, 255, 0.1);
    color: #165DFF;
}

.protection-badge.l2 {
    background: rgba(255, 125, 0, 0.1);
    color: #FF7D00;
}

.protection-badge.l3 {
    background: rgba(255, 71, 87, 0.1);
    color: #ff4757;
}

/* ==================== 骨架屏 ==================== */

.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 0%,
        #e0e0e0 50%,
        #f0f0f0 100%
    );
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s ease-in-out infinite;
}

@keyframes skeletonLoading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 侦探主题骨架屏 */
.detective-skeleton {
    position: relative;
    background: #f5f5f5;
    overflow: hidden;
}

.detective-skeleton::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(22, 93, 255, 0.1) 50%,
        transparent 100%
    );
    animation: magnifierScan 1.5s ease-in-out infinite;
}

/* ==================== 弹窗样式 ==================== */

/* 侦探边框弹窗 */
.detective-modal {
    border: 3px solid var(--evidence-blue);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(22, 93, 255, 0.2);
}

/* 卷轴边框弹窗 */
.scroll-modal {
    border-left: 4px solid var(--evidence-blue);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* ==================== 资产展示 ==================== */

/* 侦探账本样式 */
.detective-ledger {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 16px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* 余额数字渐变高亮 */
.balance-highlight {
    background: linear-gradient(90deg, var(--otp-color), var(--ott-color), var(--otd-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ==================== 证据展示 ==================== */

/* 证据袋图标 */
.evidence-bag {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--evidence-blue), var(--evidence-blue-light));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 12px rgba(22, 93, 255, 0.3);
}

/* 证据快照弹窗 */
.evidence-snapshot {
    max-width: 90vw;
    max-height: 80vh;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.evidence-snapshot-header {
    background: var(--evidence-blue);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.evidence-timestamp {
    font-size: 12px;
    opacity: 0.8;
}

.evidence-hash {
    font-family: monospace;
    font-size: 11px;
    color: #666;
    word-break: break-all;
}

/* ==================== 进度条 ==================== */

/* 侦探主题进度条 */
.detective-progress {
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.detective-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--evidence-blue), var(--evidence-blue-light));
    border-radius: 4px;
    transition: width var(--animation-slow) ease;
}

/* 扫描线进度条 */
.scan-line-progress {
    position: relative;
    overflow: hidden;
}

.scan-line-progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--evidence-blue), transparent);
    animation: scanLineMove 1s linear infinite;
}

@keyframes scanLineMove {
    0% { transform: translateY(0); }
    100% { transform: translateY(32px); }
}

/* ==================== 时间轴 ==================== */

/* 侦探时间轴 */
.detective-timeline {
    position: relative;
    padding-left: 32px;
}

.detective-timeline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 8px;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, var(--evidence-blue), #ddd);
}

.detective-timeline-item {
    position: relative;
    padding-bottom: 24px;
}

.detective-timeline-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -26px;
    width: 16px;
    height: 16px;
    background: white;
    border: 3px solid var(--evidence-blue);
    border-radius: 50%;
    z-index: 1;
}

.detective-timeline-item.active::before {
    background: var(--evidence-blue);
    box-shadow: 0 0 0 4px rgba(22, 93, 255, 0.2);
}

.detective-timeline-item.warning::before {
    border-color: var(--badge-orange);
}

.detective-timeline-item.error::before {
    border-color: var(--seal-red);
}

/* ==================== 徽章和等级 ==================== */

/* 侦探徽章 */
.detective-badge {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(255, 215, 0, 0.4);
    border: 3px solid white;
    position: relative;
}

.detective-badge::after {
    content: '';
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: var(--seal-red);
    border-radius: 50%;
    border: 2px solid white;
}

/* 等级提升动画 */
@keyframes badgeUpgrade {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); box-shadow: 0 0 32px rgba(255, 215, 0, 0.6); }
    100% { transform: scale(1); }
}

.badge-upgrade {
    animation: badgeUpgrade var(--animation-slow) ease-out;
}

/* ==================== 加载状态 ==================== */

/* 侦探加载 */
.detective-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.detective-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--evidence-blue);
    border-top-color: transparent;
    border-radius: 50%;
    animation: magnifierSpin 0.8s linear infinite;
}

/* 迷路插画占位 */
.lost-placeholder {
    background: linear-gradient(135deg, #f5f5f5, #e0e0e0);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    color: #666;
}

/* ==================== 工具类 ==================== */

/* 文本渐变 */
.text-gradient-blue {
    background: linear-gradient(90deg, var(--evidence-blue), var(--evidence-blue-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 卡片阴影层次 */
.card-shadow-level-1 { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.card-shadow-level-2 { box-shadow: 0 4px 20px rgba(0,0,0,0.08); }
.card-shadow-level-3 { box-shadow: 0 8px 32px rgba(0,0,0,0.12); }

/* 边框动画 */
.border-pulse {
    animation: borderPulse 2s ease-in-out infinite;
}

@keyframes borderPulse {
    0%, 100% { border-color: var(--evidence-blue); }
    50% { border-color: var(--evidence-blue-light); }
}

/* 气泡弹出动画 */
@keyframes bubblePop {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.bubble-pop {
    animation: bubblePop var(--animation-normal) ease-out;
}

/* 拍照闪光动画 */
@keyframes cameraFlash {
    0% { opacity: 0; }
    10% { opacity: 1; }
    100% { opacity: 0; }
}

.camera-flash {
    animation: cameraFlash var(--animation-fast) ease-out;
}

/* 响应式断点 */
@media (max-width: 640px) {
    .detective-timeline {
        padding-left: 24px;
    }
    
    .detective-timeline::before {
        left: 6px;
    }
    
    .detective-timeline-item::before {
        left: -20px;
        width: 12px;
        height: 12px;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --detective-black: #12121f;
        --detective-gray: #1e1e2f;
    }
    
    .detective-ledger {
        background: linear-gradient(135deg, #2d2d44, #1a1a2e);
        border-color: #3d3d5c;
    }
    
    .evidence-hash {
        color: #999;
    }
}
