/* style.css - 科技感指纹详情 & 比对系统 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Orbitron:wght@500;700;900&family=Fira+Code:wght@400;500&display=swap');

:root {
    --bg-color: #040712;
    --card-bg: rgba(11, 17, 34, 0.85);
    --card-border: rgba(0, 210, 255, 0.25);
    --text-primary: #ffffff;
    --text-secondary: #a1b0cb;
    --accent-cyan: #00e5ff;
    --accent-green: #00ff88;
    --accent-red: #ff3b30;
    --glow-cyan: 0 0 12px rgba(0, 229, 255, 0.6);
    --glow-green: 0 0 15px rgba(0, 255, 136, 0.7);
    --glow-red: 0 0 15px rgba(255, 59, 48, 0.7);
    --border-radius: 12px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-title: 'Orbitron', sans-serif;
    --font-mono: 'Fira Code', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(0, 210, 255, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(0, 255, 136, 0.05) 0px, transparent 50%),
        linear-gradient(rgba(18, 24, 48, 0.2) 1px, transparent 1px),
        linear-gradient(90deg, rgba(18, 24, 48, 0.2) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 40px 40px, 40px 40px;
    color: var(--text-primary);
    min-height: 100vh;
    padding: 30px 20px;
    overflow-x: hidden;
}

header {
    text-align: center;
    margin-bottom: 35px;
    position: relative;
}

header h1 {
    font-family: var(--font-title);
    font-size: 2.2em;
    font-weight: 700;
    letter-spacing: 2px;
    color: #fff;
    text-shadow: 0 0 15px rgba(0, 210, 255, 0.6);
    text-transform: uppercase;
}

header h1::after {
    content: '';
    display: block;
    width: 150px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
    margin: 10px auto 0;
    box-shadow: var(--glow-cyan);
}

/* 导航栏 (Tab Switchers) */
.nav-tabs {
    display: flex;
    justify-content: center;
    gap: 15px;
    max-width: 900px;
    margin: 0 auto 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 10px;
}

.tab-btn {
    font-family: var(--font-title);
    background: transparent;
    border: 1px solid rgba(0, 210, 255, 0.2);
    color: var(--text-secondary);
    padding: 10px 24px;
    font-size: 0.95em;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 1px;
}

.tab-btn:hover {
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
    background: rgba(0, 210, 255, 0.05);
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.15);
}

.tab-btn.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(0, 210, 255, 0.2) 0%, rgba(0, 255, 136, 0.05) 100%);
    border-color: var(--accent-cyan);
    box-shadow: var(--glow-cyan);
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

/* 主容器 */
#fingerprint-container,
#comparison-container {
    max-width: 900px;
    margin: 0 auto;
}

/* 隐藏不激活的标签页 */
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 卡片样式 (Glassmorphism + Neon Border) */
.fp-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    margin-bottom: 25px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.fp-card:hover {
    border-color: rgba(0, 210, 255, 0.35);
    box-shadow: 0 8px 32px 0 rgba(0, 210, 255, 0.05), inset 0 0 15px rgba(0, 210, 255, 0.02);
}

.fp-card-header {
    background: linear-gradient(90deg, rgba(13, 27, 56, 0.8) 0%, rgba(20, 45, 90, 0.3) 100%);
    border-bottom: 1px solid rgba(0, 210, 255, 0.15);
    color: #fff;
    padding: 14px 20px;
    font-family: var(--font-title);
    font-size: 1.1em;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fp-card-body {
    padding: 20px;
}

/* 键值对项目 */
.fp-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.95em;
    align-items: center;
}
.fp-item:last-child {
    border-bottom: none;
}

.fp-key {
    font-weight: 500;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    margin-right: 20px;
    flex-shrink: 0;
    font-size: 0.9em;
}

.fp-value {
    color: var(--text-primary);
    word-break: break-all;
    text-align: right;
    font-family: var(--font-mono);
    font-size: 0.9em;
}

/* 嵌套对象样式 */
.fp-nested-object {
    margin-top: 10px;
    width: 100%;
    padding-left: 15px;
    border-left: 2px solid rgba(0, 210, 255, 0.3);
    background: rgba(255, 255, 255, 0.01);
    border-radius: 0 4px 4px 0;
}

/* 对比面板 (Summary Dashboard) */
.comparison-dashboard {
    display: grid;
    grid-template-columns: 1.2fr 2fr;
    gap: 20px;
    margin-bottom: 25px;
}

@media (max-width: 768px) {
    .comparison-dashboard {
        grid-template-columns: 1fr;
    }
}

.dashboard-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* 圆形进度环 (SVG Match Rate Meter) */
.match-meter-container {
    position: relative;
    width: 140px;
    height: 140px;
}

.match-meter-svg {
    transform: rotate(-90deg);
    width: 140px;
    height: 140px;
}

.meter-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.05);
    stroke-width: 10;
}

.meter-fill {
    fill: none;
    stroke: var(--accent-cyan);
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 377;
    stroke-dashoffset: 377;
    transition: stroke-dashoffset 1s ease-out;
}

.meter-value-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.meter-percentage {
    font-family: var(--font-title);
    font-size: 2.2em;
    font-weight: 900;
    color: var(--accent-green);
    text-shadow: var(--glow-green);
}

.meter-label {
    font-size: 0.75em;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 1px;
    margin-top: 2px;
}

/* 指标统计面板 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    width: 100%;
    height: 100%;
}

.stat-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: all 0.3s ease;
}

.stat-box:hover {
    background: rgba(0, 210, 255, 0.02);
    border-color: rgba(0, 210, 255, 0.15);
}

.stat-label {
    font-size: 0.8em;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.stat-num {
    font-family: var(--font-title);
    font-size: 1.6em;
    font-weight: 700;
    color: #fff;
}

.stat-num.match-count {
    color: var(--accent-green);
    text-shadow: 0 0 8px rgba(0, 255, 136, 0.3);
}

.stat-num.mismatch-count {
    color: var(--accent-red);
    text-shadow: 0 0 8px rgba(255, 77, 77, 0.3);
}

/* 过滤控制器 (Filter Switch) */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 12px 20px;
    margin-bottom: 20px;
}

.filter-title {
    font-size: 0.9em;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 电子开关 (Cyber Toggle) */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .3s;
    border-radius: 34px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-secondary);
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: rgba(0, 210, 255, 0.2);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 8px rgba(0, 210, 255, 0.2);
}

input:checked + .slider:before {
    transform: translateX(26px);
    background-color: var(--accent-cyan);
    box-shadow: var(--glow-cyan);
}

/* 对比表格/网格 */
.diff-grid-header {
    display: grid;
    grid-template-columns: 1fr 1.1fr 1.1fr 0.4fr;
    padding: 10px 15px;
    font-size: 0.8em;
    text-transform: uppercase;
    font-family: var(--font-title);
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    letter-spacing: 0.5px;
}

.diff-row {
    display: grid;
    grid-template-columns: 1fr 1.1fr 1.1fr 0.4fr;
    padding: 14px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    align-items: center;
    font-size: 0.9em;
    transition: background 0.2s ease;
}

.diff-row:last-child {
    border-bottom: none;
}

.diff-row:hover {
    background: rgba(255, 255, 255, 0.01);
}

/* 不一致行高亮 */
.diff-row.mismatch {
    background: rgba(255, 77, 77, 0.02);
}
.diff-row.mismatch:hover {
    background: rgba(255, 77, 77, 0.04);
}

.diff-path {
    font-family: var(--font-mono);
    color: var(--accent-cyan);
    font-size: 0.88em;
    font-weight: 600;
    word-break: break-all;
    padding-right: 15px;
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.25);
}

.diff-val {
    font-family: var(--font-mono);
    font-size: 0.85em;
    word-break: break-all;
    color: var(--text-secondary);
    padding-right: 15px;
}

.diff-val.expected {
    color: #38bdf8;
    text-shadow: 0 0 6px rgba(56, 189, 248, 0.2);
}

.diff-val.actual {
    color: #ffffff;
}

/* 泄漏/不一致项的极度亮眼高亮 */
.diff-row.mismatch .diff-path {
    color: #ff3366; /* 靓丽的霓虹粉红 */
    text-shadow: 0 0 10px rgba(255, 51, 102, 0.45);
}

.diff-row.mismatch .diff-val.actual {
    color: #ff4d4d; /* 鲜红色 */
    text-shadow: 0 0 8px rgba(255, 77, 77, 0.4);
    font-weight: 600;
}

.diff-status {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 状态标徽 */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 0.75em;
    font-weight: 700;
}

.badge-success {
    background: rgba(0, 255, 136, 0.15);
    color: var(--accent-green);
    border: 1px solid var(--accent-green);
    box-shadow: 0 0 5px rgba(0, 255, 136, 0.2);
}

.badge-danger {
    background: rgba(255, 77, 77, 0.15);
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
    box-shadow: 0 0 5px rgba(255, 77, 77, 0.2);
}

/* 对比状态文本或勾叉 */
.badge-success::before {
    content: "✓";
}
.badge-danger::before {
    content: "✗";
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 80px 20px;
    font-family: var(--font-title);
    letter-spacing: 1px;
    color: var(--accent-cyan);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(0, 210, 255, 0.1);
    border-top: 3px solid var(--accent-cyan);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
    margin: 0 auto 25px;
    box-shadow: var(--glow-cyan);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    color: var(--accent-red);
    text-align: center;
    padding: 30px;
    border: 1px dashed var(--accent-red);
    border-radius: 8px;
    background: rgba(255, 77, 77, 0.05);
    font-family: var(--font-mono);
}

/* 响应式调整 (移动端自适应布局) */
@media (max-width: 768px) {
    /* 统计面板改为垂直排列 */
    .comparison-dashboard {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* 隐藏表头，移动端采用自描述的垂直堆叠布局 */
    .diff-grid-header {
        display: none;
    }
    
    /* 每一行比对项目转换为张贴的卡片 */
    .diff-row {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        position: relative;
        gap: 10px;
    }
    
    /* 不一致高亮背景 */
    .diff-row.mismatch {
        background: rgba(255, 77, 77, 0.03);
    }
    
    /* 状态图标绝对定位在右上角 */
    .diff-row .diff-status {
        position: absolute;
        top: 16px;
        right: 16px;
    }
    
    /* 路径名字，右侧空出位置防重叠 */
    .diff-path {
        font-size: 0.9em;
        font-weight: 600;
        padding-right: 40px;
        color: var(--accent-cyan);
        word-break: break-all;
    }
    
    /* 设定目标值与当前收集值显示 */
    .diff-val {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        font-size: 0.85em;
        text-align: right;
        padding-right: 0;
        word-break: break-all;
        border-top: 1px dashed rgba(255, 255, 255, 0.04);
        padding-top: 8px;
    }
    
    /* 添加伪元素标签做标记 */
    .diff-val.expected::before {
        content: "改机目标:";
        color: var(--text-secondary);
        font-family: var(--font-sans);
        margin-right: 12px;
        font-weight: 500;
        flex-shrink: 0;
        text-align: left;
    }
    
    .diff-val.actual::before {
        content: "当前环境:";
        color: var(--text-secondary);
        font-family: var(--font-sans);
        margin-right: 12px;
        font-weight: 500;
        flex-shrink: 0;
        text-align: left;
    }
}

/* ==================== 行为检测样式 ==================== */
.biometric-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 229, 255, 0.12) 0%, rgba(4, 7, 18, 0.9) 100%);
    border: 2px solid var(--accent-cyan);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.3), inset 0 0 15px rgba(0, 229, 255, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-family: var(--font-title);
    font-size: 0.9em;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.biometric-btn:hover {
    box-shadow: 0 0 25px rgba(0, 229, 255, 0.6), inset 0 0 20px rgba(0, 229, 255, 0.3);
    border-color: #00f0ff;
    transform: translate(-50%, -50%) scale(1.05);
}

.fingerprint-icon-glow {
    width: 48px;
    height: 48px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300e5ff' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12a10 10 0 0 1 13-9.5'%3E%3C/path%3E%3Cpath d='M8 12a4 4 0 0 1 7.2-2.4'%3E%3C/path%3E%3Cpath d='M12 12a1 1 0 0 1 1-1'%3E%3C/path%3E%3Cpath d='M12 16v.01'%3E%3C/path%3E%3Cpath d='M16 16v.01'%3E%3C/path%3E%3Cpath d='M20 12a8 8 0 0 0-8-8'%3E%3C/path%3E%3Cpath d='M20 16a8 8 0 0 1-8 8'%3E%3C/path%3E%3Cpath d='M4 16a8 8 0 0 1 8-8'%3E%3C/path%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: drop-shadow(0 0 8px rgba(0, 229, 255, 0.6));
    animation: pulseGlow 2s infinite ease-in-out;
}

@keyframes pulseGlow {
    0%, 100% { filter: drop-shadow(0 0 4px rgba(0, 229, 255, 0.4)); opacity: 0.8; }
    50% { filter: drop-shadow(0 0 12px rgba(0, 229, 255, 0.8)); opacity: 1; }
}

.btn-sub {
    font-size: 0.65em;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    margin-top: 4px;
    font-weight: normal;
    text-transform: none;
}

.cyber-textarea {
    transition: all 0.3s ease;
}
.cyber-textarea:focus {
    border-color: var(--accent-cyan) !important;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.2), inset 0 0 5px rgba(0, 229, 255, 0.05);
}

.rhythm-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 60px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 8px 12px;
    overflow-x: auto;
    overflow-y: hidden;
}

.rhythm-bar {
    width: 14px;
    background: linear-gradient(to top, rgba(0, 229, 255, 0.2), var(--accent-cyan));
    border-radius: 2px 2px 0 0;
    transition: height 0.2s ease, background 0.3s ease;
    animation: barGrow 0.3s ease-out;
    flex-shrink: 0;
    position: relative;
}

.rhythm-bar:hover::after {
    content: attr(data-time);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #040712;
    color: #fff;
    font-size: 0.7em;
    padding: 2px 4px;
    border-radius: 3px;
    border: 1px solid var(--accent-cyan);
    white-space: nowrap;
    z-index: 10;
}

@keyframes barGrow {
    from { height: 0; }
}

.security-console {
    background: #02040a;
    font-family: var(--font-mono);
    font-size: 0.85em;
    height: 180px;
    overflow-y: auto;
    padding: 15px;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    line-height: 1.6;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.8);
}

.console-line {
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    padding: 3px 0;
    word-break: break-all;
}

.console-line:last-child {
    border-bottom: none;
}

.console-line.info {
    color: var(--text-secondary);
}

.console-line.success {
    color: var(--accent-green);
    text-shadow: 0 0 4px rgba(0, 255, 136, 0.2);
}

.console-line.warning {
    color: #ff9f0a;
    text-shadow: 0 0 4px rgba(255, 159, 10, 0.2);
}

.console-line.danger {
    color: var(--accent-red);
    text-shadow: 0 0 6px rgba(255, 59, 48, 0.4);
    font-weight: 600;
}

.security-console::-webkit-scrollbar,
.rhythm-chart::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.security-console::-webkit-scrollbar-track,
.rhythm-chart::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.security-console::-webkit-scrollbar-thumb,
.rhythm-chart::-webkit-scrollbar-thumb {
    background: rgba(0, 229, 255, 0.2);
    border-radius: 3px;
}

.security-console::-webkit-scrollbar-thumb:hover,
.rhythm-chart::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 229, 255, 0.4);
}

/* ==================== 行为检测自适应与触控响应 ==================== */
.behavior-grid-2-1 {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.behavior-grid-1-1 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

#sandbox-canvas {
    touch-action: none; /* 阻止移动端触摸滑动页面冲突，以正常获取手势轨迹 */
}

.cyber-textarea {
    width: 100%;
    height: 90px;
    resize: none;
    background: rgba(5, 8, 22, 0.6);
    border: 1px solid var(--card-border);
    color: #fff;
    padding: 10px;
    border-radius: 6px;
    font-family: var(--font-sans);
    font-size: 0.9em;
    outline: none;
    transition: border-color 0.3s;
}

/* 移动端媒体查询覆写 */
@media (max-width: 768px) {
    .behavior-grid-2-1,
    .behavior-grid-1-1 {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}