/* ============================================================
   IP地址查询网站 - 样式表
   配色：蓝色主调，浅色背景，卡片式布局
   ============================================================ */

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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --header-gradient: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #3b82f6 100%);
    --hero-gradient: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    --bg: #f0f2f5;
    --card-bg: #ffffff;
    --text: #1f2937;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-hover: 0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --radius: 8px;
    --radius-lg: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-dark);
}

/* ============================================================
   顶部导航
   ============================================================ */
.site-header {
    background: var(--header-gradient);
    color: #fff;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.logo:hover {
    color: #fff;
    opacity: 0.9;
}

.logo-icon {
    font-size: 24px;
}

.top-nav {
    display: flex;
    gap: 24px;
}

.top-nav a {
    color: rgba(255,255,255,0.9);
    font-size: 14px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s;
}

.top-nav a:hover {
    color: #fff;
    background: rgba(255,255,255,0.15);
}

/* ============================================================
   搜索区域 (Hero)
   ============================================================ */
.hero {
    background: var(--hero-gradient);
    padding: 48px 0 40px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.hero-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.hero-subtitle {
    font-size: 15px;
    color: var(--text-light);
    margin-bottom: 24px;
}

.search-form {
    max-width: 640px;
    margin: 0 auto;
}

.search-box {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.search-box:focus-within {
    border-color: var(--primary);
}

.search-icon {
    padding: 0 16px;
    font-size: 20px;
    color: var(--text-light);
}

.search-box input {
    flex: 1;
    border: none;
    outline: none;
    padding: 14px 0;
    font-size: 15px;
    color: var(--text);
    background: transparent;
}

.search-box input::placeholder {
    color: #9ca3af;
}

.btn-search {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 14px 32px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-search:hover {
    background: var(--primary-dark);
}

.my-ip {
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.my-ip .ip-link {
    font-weight: 600;
    font-size: 15px;
}

.btn-myip {
    display: inline-block;
    padding: 4px 14px;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-myip:hover {
    background: var(--primary);
    color: #fff;
}

/* ============================================================
   主内容区
   ============================================================ */
.main-content {
    padding: 32px 20px;
}

/* 卡片 */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-title {
    background: #f8fafc;
    padding: 14px 24px;
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-icon {
    font-size: 20px;
}

.more-link {
    margin-left: auto;
    font-size: 13px;
    font-weight: 500;
}

.domain-tag {
    margin-left: auto;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-light);
    background: var(--primary-light);
    padding: 2px 10px;
    border-radius: 12px;
}

/* ============================================================
   详情页
   ============================================================ */
.detail-section {
    margin-bottom: 24px;
}

.result-summary {
    background: #fff;
    padding: 16px 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    font-size: 15px;
    line-height: 2;
}

.result-label {
    color: var(--text-light);
}

.result-ip {
    font-weight: 700;
    font-size: 16px;
}

.result-sep {
    color: var(--border);
    margin: 0 8px;
}

.result-location {
    color: var(--primary-dark);
    font-weight: 600;
}

.detail-card {
    margin-bottom: 16px;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
}

.detail-table th,
.detail-table td {
    padding: 12px 24px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 15px;
}

.detail-table th {
    width: 140px;
    background: #f9fafb;
    color: var(--text-light);
    font-weight: 600;
    white-space: nowrap;
}

.detail-table td.ip-cell {
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    font-weight: 600;
    color: var(--primary-dark);
    font-size: 16px;
}

.resolved-from {
    color: var(--text-light);
    font-size: 13px;
    margin-left: 8px;
}

.location-text {
    font-weight: 500;
    color: var(--text);
}

/* 归属地描述 */
.location-desc-card {
    padding-bottom: 20px;
}

.location-desc-card h3 {
    padding: 16px 24px 8px;
    font-size: 16px;
    color: var(--text);
}

.location-line {
    padding: 0 24px 12px;
    line-height: 2;
    font-size: 15px;
}

.seo-text {
    padding: 0 24px;
    color: var(--text-light);
    font-size: 13px;
    line-height: 1.8;
}

/* ============================================================
   记录表格
   ============================================================ */
.records-table {
    width: 100%;
    border-collapse: collapse;
}

.records-table th {
    background: #f8fafc;
    padding: 10px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.records-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.records-table tr:last-child td {
    border-bottom: none;
}

.records-table tr:hover td {
    background: #f9fafb;
}

.records-table .empty {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

.ip-link {
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    font-weight: 600;
}

/* 徽章 */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.badge-blue {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.badge-green {
    background: #d1fae5;
    color: #065f46;
}

/* ============================================================
   最热门记录 - 网格布局
   ============================================================ */
.popular-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    padding: 20px;
}

.popular-item {
    display: block;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    transition: all 0.2s;
}

.popular-item:hover {
    background: #fff;
    border-color: var(--primary);
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.popular-ip {
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    font-weight: 700;
    font-size: 15px;
    color: var(--primary-dark);
    margin-bottom: 6px;
}

.popular-location {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 8px;
    line-height: 1.4;
}

.popular-stats {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-light);
}

.popular-stats .stat {
    background: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

/* ============================================================
   最近查询IP列表
   ============================================================ */
.ip-list {
    padding: 20px 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ip-tag {
    display: inline-block;
    padding: 4px 12px;
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 16px;
    font-size: 13px;
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    color: var(--text);
    transition: all 0.2s;
}

.ip-tag:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ============================================================
   分页
   ============================================================ */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 24px 0 12px;
    flex-wrap: wrap;
}

.page-btn {
    display: inline-block;
    min-width: 38px;
    height: 38px;
    line-height: 38px;
    text-align: center;
    padding: 0 10px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text);
    transition: all 0.2s;
}

.page-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 600;
}

.page-info {
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 24px;
}

/* ============================================================
   关于区域
   ============================================================ */
.about-section {
    margin-top: 32px;
}

.about-content {
    padding: 20px 24px;
    font-size: 14px;
    line-height: 1.8;
    color: #4b5563;
}

.about-content p {
    margin-bottom: 12px;
}

.about-content ol {
    padding-left: 24px;
    margin-bottom: 12px;
}

.about-content ol li {
    margin-bottom: 6px;
}

/* ============================================================
   错误卡片
   ============================================================ */
.error-card {
    padding: 32px;
    text-align: center;
}

.error-card h3 {
    font-size: 20px;
    color: #dc2626;
    margin-bottom: 12px;
}

.error-card p {
    color: var(--text-light);
    margin-bottom: 8px;
}

.btn-back {
    display: inline-block;
    margin-top: 16px;
    padding: 8px 24px;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius);
    font-weight: 500;
    transition: background 0.2s;
}

.btn-back:hover {
    background: var(--primary-dark);
}

/* ============================================================
   最近查询卡片
   ============================================================ */
.recent-queries-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    overflow: hidden;
}

.recent-queries-card .section-title {
    background: #f8fafc;
    padding: 14px 24px;
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-icon {
    font-size: 20px;
}

/* ============================================================
   页脚
   ============================================================ */
.site-footer {
    background: #1f2937;
    color: #9ca3af;
    padding: 24px 0;
    text-align: center;
    font-size: 14px;
    margin-top: 40px;
}

.site-footer a {
    color: #d1d5db;
}

.site-footer a:hover {
    color: #fff;
}

.site-footer p {
    margin-bottom: 6px;
}

.site-footer .copyright {
    font-size: 13px;
    color: #6b7280;
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 768px) {
    .container {
        padding: 0 12px;
    }

    .site-header .container {
        flex-direction: column;
        height: auto;
        padding: 12px;
        gap: 8px;
    }

    .top-nav {
        gap: 12px;
    }

    .hero {
        padding: 32px 0 28px;
    }

    .hero-title {
        font-size: 22px;
    }

    .search-box {
        flex-direction: column;
        border-radius: var(--radius);
    }

    .search-box input {
        width: 100%;
        padding: 12px 16px;
    }

    .search-icon {
        display: none;
    }

    .btn-search {
        width: 100%;
        padding: 12px;
    }

    .my-ip {
        flex-direction: column;
        gap: 8px;
    }

    .detail-table th {
        width: 100px;
    }

    .detail-table th,
    .detail-table td {
        padding: 10px 12px;
        font-size: 14px;
    }

    .records-table {
        display: block;
        overflow-x: auto;
    }

    .records-table th,
    .records-table td {
        font-size: 13px;
        padding: 8px 10px;
    }

    .popular-grid {
        grid-template-columns: 1fr;
    }

    .card-title {
        font-size: 15px;
        padding: 12px 16px;
    }

    .about-content,
    .ip-list,
    .popular-grid {
        padding: 16px;
    }
}
