/**
 * ==========================================
 * IP显微镜 (IP Microscope) - 核心样式表
 * 版本: v2.0.1 (SEO 深度优化版)
 * 声明: 本样式由专属定制，谢绝镜像与抄袭
 * ==========================================
 */

/* 1. 全局变量定义 (彻底改变代码结构特征) */
:root {
    --ipm-primary: #2563eb;       /* 科技主色调：极客蓝 */
    --ipm-primary-hover: #1d4ed8; /* 悬停深蓝 */
    --ipm-bg: #f8fafc;            /* 页面背景：石板灰白 */
    --ipm-card-bg: #ffffff;       /* 卡片背景 */
    --ipm-text-main: #0f172a;     /* 主标题颜色：深邃黑 */
    --ipm-text-muted: #64748b;    /* 描述文字颜色 */
    --ipm-border: #e2e8f0;        /* 柔和边框色 */
    --ipm-radius-sm: 8px;         /* 小圆角 */
    --ipm-radius-md: 12px;        /* 现代大圆角 */
    --ipm-shadow-sm: 0 2px 4px rgba(15, 23, 42, 0.04);
    --ipm-shadow-md: 0 8px 16px rgba(15, 23, 42, 0.06);
    --ipm-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 2. 基础重置与排版 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--ipm-bg);
    color: var(--ipm-text-main);
    min-height: 100vh;
    padding: 24px 20px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 860px; /* 稍微收窄，让阅读视线更集中 */
    margin: 0 auto;
}

/* 3. 卡片通用类 (提取公共代码，精简体积) */
.top-nav, header, .search-section, .loading, .ip-info, .instructions, .content-section {
    background: var(--ipm-card-bg);
    border-radius: var(--ipm-radius-md);
    box-shadow: var(--ipm-shadow-sm);
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    transition: var(--ipm-transition);
}

.top-nav:hover, .search-section:hover, .ip-info:hover {
    box-shadow: var(--ipm-shadow-md);
}

/* 4. 顶部导航栏 */
.top-nav {
    padding: 10px 20px;
}

.top-nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 12px;
}

.top-nav a {
    display: block;
    padding: 10px 24px;
    color: var(--ipm-text-muted);
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--ipm-radius-sm);
    transition: var(--ipm-transition);
}

.top-nav a:hover {
    background: #f1f5f9;
    color: var(--ipm-primary);
}

.top-nav a.active {
    background: #eff6ff;
    color: var(--ipm-primary);
    box-shadow: inset 0 -3px 0 var(--ipm-primary);
}

/* 5. 头部标题区 */
header {
    text-align: center;
    padding: 40px 20px;
}

header h1 {
    font-size: 2.2em;
    color: var(--ipm-text-main);
    margin-bottom: 10px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 1.05em;
    color: var(--ipm-text-muted);
}

/* 6. 核心搜索区 */
.search-section {
    padding: 30px;
}

.search-box {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

#ipInput {
    flex: 1;
    padding: 14px 18px;
    font-size: 16px;
    border: 2px solid var(--ipm-border);
    border-radius: var(--ipm-radius-sm);
    outline: none;
    background: #fafafa;
    color: var(--ipm-text-main);
    transition: var(--ipm-transition);
    font-family: monospace; /* IP输入框使用等宽字体更专业 */
}

#ipInput:focus {
    background: #fff;
    border-color: var(--ipm-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

#ipInput::placeholder {
    color: #94a3b8;
    font-family: -apple-system, sans-serif;
}

button {
    padding: 0 24px;
    font-size: 15px;
    font-weight: 600;
    background: var(--ipm-primary);
    color: white;
    border: none;
    border-radius: var(--ipm-radius-sm);
    cursor: pointer;
    transition: var(--ipm-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 52px; /* 统一高度 */
}

button:hover {
    background: var(--ipm-primary-hover);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(1px);
}

.quick-actions {
    display: flex;
    justify-content: center;
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--ipm-text-main);
    height: 44px;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

/* 7. 数据展示区 (IP信息网格) */
.ip-info {
    padding: 32px;
    animation: slideUp 0.4s ease-out;
}

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

.info-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px dashed var(--ipm-border);
}

.info-header h2 {
    font-size: 1.8em;
    font-weight: 700;
    font-family: monospace;
    color: var(--ipm-primary);
}

.ip-type {
    padding: 4px 12px;
    background: #dbeafe;
    color: var(--ipm-primary);
    border-radius: 20px; /* 胶囊形状 */
    font-size: 0.85em;
    font-weight: 700;
    text-transform: uppercase;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.info-item {
    padding: 16px 20px;
    background: #f8fafc;
    border: 1px solid var(--ipm-border);
    border-radius: var(--ipm-radius-sm);
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: var(--ipm-transition);
}

.info-item:hover {
    border-color: #cbd5e1;
    background: #fff;
}

.info-label {
    font-size: 0.85em;
    color: var(--ipm-text-muted);
    font-weight: 600;
}

.info-value {
    font-size: 1.05em;
    color: var(--ipm-text-main);
    font-weight: 600;
    word-break: break-all;
}

/* 8. 状态提示 (加载与错误) */
.loading {
    padding: 40px;
    text-align: center;
}

.spinner {
    width: 44px;
    height: 44px;
    margin: 0 auto 16px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--ipm-primary);
    border-radius: 50%;
    animation: ipm-spin 0.8s cubic-bezier(0.6, 0.2, 0.4, 0.8) infinite;
}

@keyframes ipm-spin {
    to { transform: rotate(360deg); }
}

.error {
    background: #fef2f2;
    border-left: 4px solid #ef4444;
    color: #b91c1c;
    padding: 16px 20px;
    border-radius: var(--ipm-radius-sm);
    margin-bottom: 24px;
    font-weight: 500;
}

/* 9. SEO文本内容区 & 关于页排版 */
.content-section, .instructions {
    padding: 32px;
}

.seo-content {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid var(--ipm-bg);
}

.seo-section, .about-section, .policy-section {
    margin-bottom: 36px;
}

.content-section h2, .instructions h3, .seo-section h3 {
    color: var(--ipm-text-main);
    font-size: 1.4em;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.seo-section dt {
    font-weight: 700;
    color: var(--ipm-text-main);
    margin: 20px 0 8px 0;
    font-size: 1.05em;
}

.seo-section dd, .content-section p, .instructions ul {
    color: var(--ipm-text-muted);
    margin-bottom: 12px;
}

.content-section ul, .instructions ul {
    padding-left: 20px;
}

.content-section li, .instructions li {
    margin-bottom: 8px;
    color: var(--ipm-text-main);
}

.content-section a {
    color: var(--ipm-primary);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px dotted var(--ipm-primary);
}

.content-section a:hover {
    color: var(--ipm-primary-hover);
    border-bottom-style: solid;
}

/* 10. 网格功能区 (关于我们页面) */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin: 24px 0;
}

.feature-item {
    padding: 24px;
    background: #f8fafc;
    border: 1px solid var(--ipm-border);
    border-radius: var(--ipm-radius-md);
    text-align: center;
    transition: var(--ipm-transition);
}

.feature-item:hover {
    background: #fff;
    transform: translateY(-4px);
    box-shadow: var(--ipm-shadow-md);
    border-color: #cbd5e1;
}

.feature-icon {
    font-size: 2.5em;
    margin-bottom: 16px;
}

.feature-item h3 {
    color: var(--ipm-text-main);
    font-size: 1.2em;
    margin-bottom: 10px;
}

/* 11. 通知与免责声明模块 */
.api-notice, .policy-notice, .disclaimer {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    padding: 16px 20px;
    border-radius: 0 var(--ipm-radius-sm) var(--ipm-radius-sm) 0;
    color: #92400e;
    margin: 20px 0;
    font-size: 0.95em;
}

.changelog-item {
    padding: 20px;
    background: #f8fafc;
    border-radius: var(--ipm-radius-sm);
    border-left: 4px solid var(--ipm-primary);
    margin-bottom: 20px;
}

/* 12. 页脚与返回链接 */
.back-link {
    text-align: center;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--ipm-border);
}

.back-link a {
    display: inline-block;
    padding: 12px 28px;
    background: #f1f5f9;
    color: var(--ipm-text-main);
    border-radius: 30px;
    border-bottom: none;
}

.back-link a:hover {
    background: #e2e8f0;
}

footer {
    text-align: center;
    padding: 24px 0;
    color: #94a3b8;
    font-size: 0.9em;
}

footer a {
    color: var(--ipm-text-muted);
    text-decoration: none;
    margin: 0 4px;
}

footer a:hover {
    color: var(--ipm-primary);
    text-decoration: underline;
}

/* 13. 极致响应式适配 */
@media (max-width: 768px) {
    body { padding: 16px 12px; }
    header { padding: 30px 16px; }
    header h1 { font-size: 1.8em; }
    
    .search-section, .ip-info, .content-section {
        padding: 20px;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    #ipInput { font-size: 15px; }
    button { height: 48px; }
    
    .info-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .top-nav a { padding: 8px 16px; }
}

@media (max-width: 480px) {
    .info-grid { grid-template-columns: 1fr; }
    .top-nav ul { flex-wrap: wrap; gap: 8px; }
    header h1 { font-size: 1.5em; }
}