/* ============================================
   公网IP检测工具 - ip-test.css
   风格对齐 nat-test.css / ipv6-test.css
   ============================================ */

/* ——— 页面容器 ——— */
.ip-test-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 20px 60px;
    opacity: 0;
    transition: opacity .3s ease;
}
.ip-test-page.loaded { opacity: 1; }

/* ——— 页面标题 ——— */
.ip-test-page .page-header {
    text-align: center;
    margin-bottom: 32px;
}
.ip-test-page .page-header .header-icon {
    width: 56px;
    height: 56px;
    color: #2196f3;
    margin-bottom: 12px;
}
.ip-test-page .page-header h1 {
    font-size: 28px;
    font-weight: 800;
    color: #1a1a2e;
    margin: 0 0 8px;
}
.ip-test-page .page-header p {
    font-size: 15px;
    color: #666;
    margin: 0;
}

/* ——— 检测卡片 ——— */
.ip-test-page .test-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
    border: 1px solid #e8e8e8;
    padding: 32px;
    margin-bottom: 24px;
}

/* ——— 状态区域 ——— */
.ip-test-page .test-status {
    text-align: center;
    padding: 24px 0;
}
.ip-test-page .test-status .status-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    color: #2196f3;
}
.ip-test-page .test-status .status-icon.loading { color: #2196f3; }
.ip-test-page .test-status .status-icon.error { color: #f44336; }
.ip-test-page .test-status h3 {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin: 0 0 6px;
}
.ip-test-page .test-status p {
    font-size: 14px;
    color: #888;
    margin: 0;
}

/* skeleton 加载占位 */
.ip-test-page .skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 6px;
}
@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.ip-test-page .skeleton-line {
    height: 20px;
    margin-bottom: 12px;
}
.ip-test-page .skeleton-line.short { width: 60%; }
.ip-test-page .skeleton-line.medium { width: 80%; }

/* ——— 结果区域 ——— */
.ip-test-page .result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}
.ip-test-page .ip-card {
    background: #f8f9fa;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    padding: 24px;
    transition: border-color .2s;
}
.ip-test-page .ip-card.ipv4-card:hover { border-color: #2196f3; }
.ip-test-page .ip-card.ipv6-card:hover { border-color: #4caf50; }
.ip-test-page .ip-card.no-ip {
    opacity: .6;
    border-style: dashed;
}

.ip-test-page .ip-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.ip-test-page .ip-card-header .ip-version-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
}
.ip-test-page .ipv4-badge { background: #e3f2fd; color: #1565c0; }
.ip-test-page .ipv6-badge { background: #e8f5e9; color: #2e7d32; }
.ip-test-page .ip-card-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    margin: 0;
}
.ip-test-page .ip-card-header .copy-btn {
    margin-left: auto;
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all .2s;
}
.ip-test-page .ip-card-header .copy-btn:hover {
    background: #f0f0f0;
    border-color: #bbb;
    color: #333;
}
.ip-test-page .ip-card-header .copy-btn.copied {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #2e7d32;
}

.ip-test-page .ip-address {
    font-size: 20px;
    font-weight: 700;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    color: #1a1a2e;
    padding: 12px 0;
    word-break: break-all;
    line-height: 1.4;
}
.ip-test-page .ip-card.no-ip .ip-address {
    font-size: 15px;
    font-weight: 500;
    color: #999;
}

/* ——— 归属信息详情 ——— */
.ip-test-page .ip-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid #e8e8e8;
}
.ip-test-page .detail-row {
    display: flex;
    align-items: center;
    font-size: 13px;
    gap: 10px;
}
.ip-test-page .detail-row .detail-label {
    color: #888;
    min-width: 56px;
    flex-shrink: 0;
}
.ip-test-page .detail-row .detail-value {
    color: #333;
    font-weight: 600;
    flex: 1;
    word-break: break-all;
}

/* ——— 提示卡片区 ——— */
.ip-test-page .tips-section {
    margin-top: 24px;
}
.ip-test-page .tip-card {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #92400e;
    line-height: 1.7;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.ip-test-page .tip-card .tip-icon {
    flex-shrink: 0;
    font-size: 18px;
    line-height: 1.4;
}
.ip-test-page .tip-card.tip-info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}
.ip-test-page .tip-card.tip-warn {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

/* ——— 操作按钮栏 ——— */
.ip-test-page .action-bar {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}
.ip-test-page .btn-primary {
    background: linear-gradient(135deg, #2196f3, #1976d2);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all .2s;
    box-shadow: 0 2px 8px rgba(33,150,243,.25);
}
.ip-test-page .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(33,150,243,.35);
}
.ip-test-page .btn-primary:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
}
.ip-test-page .btn-secondary {
    background: #fff;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all .2s;
}
.ip-test-page .btn-secondary:hover {
    background: #f5f5f5;
    border-color: #bbb;
}

/* ——— 不一致提示 ——— */
.ip-test-page .mismatch-banner {
    background: linear-gradient(135deg, #fef3c7, #fffbeb);
    border: 1px solid #f59e0b;
    border-radius: 10px;
    padding: 14px 20px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #92400e;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.ip-test-page .mismatch-banner .mismatch-icon {
    flex-shrink: 0;
    font-size: 20px;
}

/* ——— WebRTC 泄露模块 ——— */
.ip-test-page .webrtc-section {
    margin-top: 24px;
}
.ip-test-page .collapsible-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: #f8f9fa;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    width: 100%;
    transition: background .2s, border-radius .2s;
}
.ip-test-page .collapsible-header:hover { background: #f0f0f0; }
.ip-test-page .collapsible-header.open {
    border-radius: 10px 10px 0 0;
    border-bottom-color: transparent;
}
.ip-test-page .collapsible-header .chevron {
    margin-left: auto;
    transition: transform .25s ease;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
.ip-test-page .collapsible-header.open .chevron { transform: rotate(180deg); }
.ip-test-page .collapsible-body {
    overflow: hidden;
    border: 1px solid #e8e8e8;
    border-top: none;
    border-radius: 0 0 10px 10px;
    padding: 0 20px;
    max-height: 0;
    opacity: 0;
    transition: max-height .3s ease, opacity .2s ease, padding .3s ease;
}
.ip-test-page .collapsible-body.open {
    max-height: 500px;
    opacity: 1;
    padding: 16px 20px;
}
.ip-test-page .webrtc-ip-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.ip-test-page .webrtc-ip-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    font-family: 'SF Mono', monospace;
}
.ip-test-page .webrtc-ip-list li:last-child { border-bottom: none; }
.ip-test-page .webrtc-type-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    font-family: system-ui, sans-serif;
}
.ip-test-page .badge-local { background: #fef3c7; color: #92400e; }
.ip-test-page .badge-public { background: #dbeafe; color: #1e40af; }
.ip-test-page .badge-relay { background: #fce7f3; color: #9d174d; }

/* ——— 结果卡片图片（Canvas） ——— */
.ip-test-page .card-image-section {
    margin-top: 20px;
    text-align: center;
}
.ip-test-page .card-image-section canvas {
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,.1);
    max-width: 100%;
    height: auto;
}

/* ——— 开发者API折叠区 ——— */
.ip-test-page .api-doc-section {
    margin-top: 24px;
}
.ip-test-page .api-code-block {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    overflow-x: auto;
    line-height: 1.6;
    white-space: pre;
    margin-top: 12px;
}

/* ——— 连接类型徽章 ——— */
.ip-test-page .conn-type-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
}
.ip-test-page .conn-dual { background: #d1fae5; color: #065f46; }
.ip-test-page .conn-v4 { background: #dbeafe; color: #1e40af; }
.ip-test-page .conn-v6 { background: #e8f5e9; color: #2e7d32; }

/* ——— 提示卡片SVG图标 ——— */
.ip-test-page .tip-icon {
    flex-shrink: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
}
.ip-test-page .tip-info .tip-icon {
    background: #dbeafe;
    color: #2563eb;
}
.ip-test-page .tip-warn .tip-icon {
    background: #fef3c7;
    color: #d97706;
}

/* ——— Toast 通知 ——— */
.ip-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    z-index: 10000;
    opacity: 0;
    transition: all .3s ease;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(0,0,0,.15);
}
.ip-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.ip-toast.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}
.ip-toast.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}
.ip-toast.info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* ——— SEO信息区 ——— */
.ip-test-page .info-section {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
    border: 1px solid #e8e8e8;
    padding: 32px;
    margin-top: 24px;
}
.ip-test-page .info-section h2 {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e8e8e8;
}
.ip-test-page .info-section h3 {
    font-size: 17px;
    font-weight: 700;
    color: #333;
    margin: 24px 0 10px;
}
.ip-test-page .info-section p {
    font-size: 15px;
    color: #555;
    line-height: 1.8;
    margin: 0 0 12px;
}
.ip-test-page .info-section ul,
.ip-test-page .info-section ol {
    padding-left: 20px;
    margin: 8px 0 16px;
}
.ip-test-page .info-section li {
    font-size: 14px;
    color: #555;
    line-height: 1.8;
    margin-bottom: 4px;
}

/* ——— 站内导流链接 ——— */
.ip-test-page .related-tools {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 20px;
}
.ip-test-page .related-tool-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: #f8f9fa;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    font-weight: 600;
    transition: all .2s;
}
.ip-test-page .related-tool-link:hover {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #1565c0;
}
.ip-test-page .related-tool-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #999;
}
.ip-test-page .related-tool-link:hover svg { color: #2196f3; }

/* ——— 移动端适配 ——— */
@media (max-width: 640px) {
    .ip-test-page {
        padding: 20px 16px 40px;
    }
    .ip-test-page .page-header h1 {
        font-size: 22px;
    }
    .ip-test-page .test-card {
        padding: 20px 16px;
    }
    .ip-test-page .result-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    .ip-test-page .ip-address {
        font-size: 16px;
    }
    .ip-test-page .ip-card {
        padding: 18px;
    }
    .ip-test-page .action-bar {
        flex-direction: column;
    }
    .ip-test-page .action-bar button {
        width: 100%;
        justify-content: center;
    }
    .ip-test-page .info-section {
        padding: 24px 16px;
    }
    .ip-test-page .info-section h2 {
        font-size: 19px;
    }
    .ip-test-page .related-tools {
        grid-template-columns: 1fr;
    }
}

/* ——— d-none 工具类 ——— */
.d-none { display: none !important; }
