/* ============================================
   免费 DR 查询站 — 响应式样式
   ============================================ */

/* ---- 基础重置 ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

/* ---- 容器 ---- */
.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 20px 16px;
}

/* ---- 页头 ---- */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px 0 20px;
}

.header h1 {
    font-size: 28px;
    color: #1a73e8;
    font-weight: 700;
    margin-bottom: 8px;
}

.header h1 .dr-label {
    background: #1a73e8;
    color: #fff;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 20px;
    vertical-align: middle;
    margin-left: 4px;
}

.header p {
    font-size: 14px;
    color: #666;
}

.header p .dr-home-link {
    color: inherit;
    text-decoration: none;
}

.header p .dr-home-link:hover {
    text-decoration: underline;
}

/* ---- 搜索框 ---- */
.search-box {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.search-input {
    flex: 1;
    height: 44px;
    border: 2px solid #d0d5dd;
    border-radius: 8px;
    padding: 0 14px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: #1a73e8;
}

.search-input.error {
    border-color: #e53935;
}

.search-btn {
    height: 44px;
    padding: 0 24px;
    background: #1a73e8;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.search-btn:hover {
    background: #1565c0;
}

.search-btn:disabled {
    background: #a0c4f0;
    cursor: not-allowed;
}

.search-hint {
    font-size: 13px;
    color: #999;
    margin-top: -16px;
    margin-bottom: 16px;
}

.search-hint.error-msg {
    color: #e53935;
}

/* ---- 结果卡片 ---- */
.result-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    display: none;
    animation: fadeIn 0.3s ease;
}

.result-card.show {
    display: block;
}

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

/* 域名标题 */
.result-domain {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: #999;
    margin-bottom: 20px;
}

.result-domain .url-link {
    color: #1a73e8;
    text-decoration: none;
    transition: color 0.2s;
}

.result-domain .url-link:hover {
    color: #1565c0;
    text-decoration: underline;
}

/* DR 值居中区域 */
.result-dr-center {
    text-align: center;
    margin-bottom: 18px;
}

.dr-badge {
    display: inline-block;
    background: linear-gradient(135deg, #f8f9fb 0%, #f0f2f5 100%);
    border: 2px solid #e8eaed;
    border-radius: 20px;
    padding: 24px 48px;
    margin-bottom: 8px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

/* 不同分数段的徽章边框颜色 */
.result-card .dr-low  ~ .dr-badge,
.dr-badge:has(.dr-low) { border-color: #c8e6c9; background: linear-gradient(135deg, #f1f8f1 0%, #e8f5e9 100%); }
.result-card .dr-mid  ~ .dr-badge,
.dr-badge:has(.dr-mid) { border-color: #bbdefb; background: linear-gradient(135deg, #f1f6fd 0%, #e3f2fd 100%); }
.result-card .dr-high ~ .dr-badge,
.dr-badge:has(.dr-high) { border-color: #ffcdd2; background: linear-gradient(135deg, #fef5f5 0%, #ffebee 100%); }

.dr-badge .dr-number {
    font-size: 64px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -2px;
}

/* DR值颜色分级 — 中国 convention：高分=红(强) */
.dr-low    { color: #4caf50; }  /* 0-30: 新站/普通 */
.dr-mid    { color: #1a73e8; }  /* 30-70: 中等/行业站 */
.dr-high   { color: #e53935; }  /* 70+: 大型品牌站 */

.dr-subtitle {
    font-size: 12px;
    color: #aaa;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* 查询时间 */
.result-time {
    text-align: center;
    font-size: 13px;
    color: #999;
}

/* 缓存提示 */
.cache-note {
    text-align: center;
    font-size: 13px;
    color: #888;
    line-height: 1.8;
}

.cache-note strong {
    color: #555;
}

.cache-note .force-refresh {
    color: #1a73e8;
    text-decoration: none;
    cursor: pointer;
}

.cache-note .force-refresh:hover {
    text-decoration: underline;
}

/* ---- 最近查询列表 ---- */
.recent-section {
    margin-top: 30px;
}

.recent-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #1a73e8;
}

.recent-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.domain-tag {
    display: inline-block;
    padding: 6px 14px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 13px;
    color: #1a73e8;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s;
}

.domain-tag:hover {
    background: #f0f5ff;
    border-color: #1a73e8;
}

/* ---- 页脚 ---- */
.footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px 0;
    font-size: 13px;
    color: #999;
}

.footer a {
    color: #1a73e8;
    text-decoration: none;
}

/* ---- Loading ---- */
.loading-spinner {
    display: none;
    text-align: center;
    padding: 20px;
}

.loading-spinner.show {
    display: block;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e0e0e0;
    border-top-color: #1a73e8;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 10px;
}

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

.loading-text {
    font-size: 14px;
    color: #666;
}

/* ---- 移动端适配 ---- */
@media (max-width: 480px) {
    .container {
        padding: 12px 12px;
    }

    .header {
        padding: 20px 0 12px;
    }

    .header h1 {
        font-size: 22px;
    }

    .search-box {
        gap: 6px;
    }

    .search-btn {
        height: 42px;
        padding: 0 16px;
        font-size: 14px;
    }

    .search-input {
        height: 42px;
        font-size: 14px;
        min-width: 0;
    }

    .dr-badge .dr-number {
        font-size: 48px;
    }
}

/* ============================================
   管理后台样式
   ============================================ */

/* ---- 登录页 ---- */
.login-container {
    max-width: 360px;
    margin: 80px auto;
    padding: 30px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.login-container h2 {
    text-align: center;
    font-size: 20px;
    color: #1a73e8;
    margin-bottom: 24px;
}

.login-form .form-group {
    margin-bottom: 16px;
}

.login-form label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 6px;
}

.login-form input[type="password"] {
    width: 100%;
    height: 40px;
    border: 2px solid #d0d5dd;
    border-radius: 8px;
    padding: 0 12px;
    font-size: 14px;
    outline: none;
}

.login-form input[type="password"]:focus {
    border-color: #1a73e8;
}

.login-btn {
    width: 100%;
    height: 40px;
    background: #1a73e8;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.login-btn:hover {
    background: #1565c0;
}

.login-error {
    color: #e53935;
    font-size: 13px;
    text-align: center;
    margin-top: 12px;
}

/* ---- 管理面板 ---- */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #1a73e8;
    color: #fff;
    border-radius: 12px 12px 0 0;
}

.admin-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.admin-header .logout-btn {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

.admin-header .logout-btn:hover {
    background: rgba(255,255,255,0.3);
}

.admin-stats {
    display: flex;
    gap: 12px;
    margin: 16px 0;
}

.stat-card {
    flex: 1;
    background: #fff;
    border-radius: 8px;
    padding: 14px;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.stat-card .stat-label {
    font-size: 12px;
    color: #999;
}

.stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #1a73e8;
}

.admin-table-wrap {
    background: #fff;
    border-radius: 0 0 12px 12px;
    overflow-x: auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.admin-table th {
    background: #f5f8ff;
    padding: 10px 12px;
    text-align: left;
    color: #333;
    font-weight: 600;
    white-space: nowrap;
}

.admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    color: #555;
}

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

.admin-table tr:hover td {
    background: #f5f8ff;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 16px;
    padding-bottom: 16px;
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    text-decoration: none;
}

.pagination a {
    background: #fff;
    color: #1a73e8;
    border: 1px solid #d0d5dd;
}

.pagination a:hover {
    background: #f5f8ff;
}

/* 删除操作提示 */
.delete-msg {
    background: #e8f5e9;
    border: 1px solid #81c784;
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #2e7d32;
}

/* 删除按钮 */
.delete-form {
    display: inline;
    margin: 0;
}

.btn-delete {
    display: inline-block;
    padding: 4px 12px;
    font-size: 12px;
    color: #fff;
    background: #e53935;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    line-height: 1.4;
}

.btn-delete:hover {
    background: #c62828;
}

.btn-delete:active {
    background: #b71c1c;
}

/* 移动端表格响应 */
@media (max-width: 640px) {
    .admin-table {
        font-size: 12px;
    }
    .admin-table th,
    .admin-table td {
        padding: 6px 8px;
    }
    .btn-delete {
        padding: 3px 8px;
        font-size: 11px;
    }
}

.pagination .current {
    background: #1a73e8;
    color: #fff;
    border: 1px solid #1a73e8;
}

/* ---- 管理后台移动端 ---- */
@media (max-width: 480px) {
    .login-container {
        margin: 40px 16px;
        padding: 20px;
    }

    .admin-stats {
        flex-direction: column;
    }

    .admin-table {
        font-size: 12px;
    }

    .admin-table th,
    .admin-table td {
        padding: 8px 6px;
    }
}
