:root {
    --primary: #4f46e5;
    --primary-600: #4338ca;
    --primary-light: #7c3aed;
    --violet: #7c3aed;
    --cyan: #06b6d4;
    --gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --bg: #fbfcfe;
    --card: #ffffff;
    --border: #e8ecf2;
    --border-light: #f1f5f9;
    --text: #0b1220;
    --text-secondary: #5b6577;
    --text-hint: #98a2b3;
    --shadow-sm: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
    --shadow-md: 0 14px 38px rgba(16,24,40,.09);
    --shadow-lg: 0 30px 70px rgba(16,24,40,.12);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 22px;
    --ease: cubic-bezier(.22,.61,.36,1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(620px 420px at 12% 8%, rgba(79,70,229,.10), transparent 60%),
        radial-gradient(560px 400px at 88% 18%, rgba(124,58,237,.10), transparent 60%),
        radial-gradient(720px 520px at 50% 108%, rgba(6,182,212,.06), transparent 62%);
}

/* 顶部导航 */
.query-navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255,255,255,.72);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.back-link {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--primary-light);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.back-link svg { width: 18px; height: 18px; }

.nav-title { font-size: 16px; font-weight: 700; color: var(--text); }
.nav-spacer { width: 40px; }

/* 查询区域 */
.query-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 32px 20px;
    text-align: center;
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.query-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, rgba(79,70,229,0.1) 0%, rgba(79,70,229,0.1) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-light);
}

.query-icon svg { width: 32px; height: 32px; }

.query-title { font-size: 22px; font-weight: 800; color: var(--primary); margin-bottom: 6px; }
.query-subtitle { font-size: 13px; color: var(--text-secondary); margin-bottom: 20px; }

.query-tabs {
    display: flex;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 16px;
    gap: 4px;
}

.query-tab {
    flex: 1;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.query-tab:hover {
    color: var(--text);
    background: var(--bg);
}

.query-tab.active {
    background: var(--gradient);
    color: #fff;
    font-weight: 600;
}

.query-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
}

.query-input {
    flex: 1;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 15px;
    color: var(--text);
    background: var(--card);
    transition: all 0.2s;
    font-family: inherit;
    min-width: 0;
}

.query-input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}

.query-input::placeholder { color: var(--text-hint); font-size: 14px; }

.query-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.query-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79,70,229,0.25); }
.query-btn:active { transform: translateY(0); }
.query-btn svg { width: 18px; height: 18px; }

/* 最近查询 */
.recent-section { text-align: left; }

.recent-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-left: 4px;
    padding-right: 4px;
}

.recent-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.clear-cache-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-hint);
    cursor: pointer;
    transition: all 0.2s;
}

.clear-cache-btn:hover {
    border-color: var(--error);
    color: var(--error);
    background: rgba(239,68,68,0.05);
}

.clear-cache-btn svg {
    width: 14px;
    height: 14px;
}

.recent-list { display: flex; flex-direction: column; gap: 10px; }

.recent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--card);
    border-radius: 12px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
}

.recent-item:hover {
    border-color: var(--primary-light);
    box-shadow: 0 2px 8px rgba(79,70,229,0.08);
}

.recent-icon {
    width: 36px;
    height: 36px;
    background: rgba(79,70,229,0.08);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-light);
    flex-shrink: 0;
}

.recent-icon svg { width: 18px; height: 18px; }

.recent-info { flex: 1; min-width: 0; text-align: left; }
.recent-code {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    font-family: monospace;
    letter-spacing: 0.5px;
}
.recent-domain {
    font-size: 12px;
    color: var(--text-hint);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.recent-status {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

.recent-arrow {
    color: var(--text-hint);
    flex-shrink: 0;
}
.recent-arrow svg { width: 16px; height: 16px; }

/* 结果区域 */
.result-container {
    max-width: 560px;
    margin: 0 auto;
    padding: 16px;
    animation: fadeIn 0.3s ease;
    flex: 1;
    width: 100%;
}

.result-header { margin-bottom: 16px; }

.back-query-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.back-query-btn:hover {
    border-color: var(--primary-light);
    color: var(--primary);
}

.back-query-btn svg { width: 16px; height: 16px; }

/* 结果卡片 */
.result-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.result-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.status-header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: -20px -20px 20px;
    padding: 18px 20px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: linear-gradient(135deg, rgba(79,70,229,0.08) 0%, rgba(124,58,237,0.08) 100%);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}

.status-header::after {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--gradient);
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    animation: pulse 2s infinite;
    box-shadow: 0 0 0 4px rgba(79,70,229,0.12);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    font-size: 18px;
    font-weight: 800;
    flex: 1;
}

.status-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* 进度时间线 */
.timeline {
    position: relative;
    padding-left: 30px;
    margin-bottom: 4px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: linear-gradient(to bottom, var(--primary) 0%, var(--violet) 100%);
    opacity: 0.25;
}

.timeline-step {
    position: relative;
    padding-bottom: 20px;
}

.timeline-step:last-child { padding-bottom: 0; }

.step-marker {
    position: absolute;
    left: -28px;
    top: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.step-marker.completed {
    background: var(--success);
    color: #fff;
}

.step-marker.current {
    background: var(--primary-light);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(79,70,229,0.15);
}

.step-marker.pending {
    background: var(--border);
    color: var(--text-hint);
}

.step-marker.rejected {
    background: var(--error);
    color: #fff;
}

.step-marker svg { width: 12px; height: 12px; }

.step-content { padding-top: 1px; }
.step-name { font-size: 14px; font-weight: 600; color: var(--text); }
.step-time { font-size: 12px; color: var(--text-hint); margin-top: 2px; }

/* 信息卡片 */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.info-item {
    text-align: left;
    padding: 12px 14px;
    background: var(--border-light);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    transition: border-color 0.2s, background 0.2s;
}

.info-item:hover {
    border-color: rgba(79,70,229,0.18);
    background: rgba(79,70,229,0.04);
}

.info-label {
    font-size: 11px;
    color: var(--text-hint);
    margin-bottom: 4px;
    font-weight: 500;
}
.info-value {
    font-size: 14px;
    color: var(--text);
    font-weight: 600;
    word-break: break-all;
}
.info-value.highlight {
    color: var(--primary);
    font-family: monospace;
    font-size: 15px;
    letter-spacing: 0.5px;
}
.info-value.beian {
    color: var(--success);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 1px;
}
.info-value.fail {
    color: var(--error);
    font-size: 14px;
    line-height: 1.5;
}

/* 证书查看 */
.cert-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary-light);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.cert-link:hover { text-decoration: underline; }

/* 失败/成功提示 */
.alert-box {
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    text-align: left;
}

.alert-box.success {
    background: rgba(16,185,129,0.06);
    border: 1px solid rgba(16,185,129,0.2);
}

.alert-box.error {
    background: rgba(239,68,68,0.06);
    border: 1px solid rgba(239,68,68,0.2);
}

.alert-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 6px;
}

.alert-box.success .alert-title { color: var(--success); }
.alert-box.error .alert-title { color: var(--error); }

.alert-text { font-size: 14px; color: var(--text); line-height: 1.6; }

/* 加载 */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.95);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.loading-overlay.active { display: flex; }

.spinner {
    width: 40px;
    height: 40px;
    color: var(--primary);
    animation: rotate 1s linear infinite;
}

.loading-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 12px;
    font-weight: 500;
}

@keyframes rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* 移动端 */
@media (max-width: 480px) {
    .query-container { padding: 24px 16px; }
    .query-icon { width: 56px; height: 56px; }
    .query-icon svg { width: 28px; height: 28px; }
    .query-title { font-size: 20px; }
    .query-subtitle { font-size: 13px; margin-bottom: 24px; }

    .query-input-group { flex-direction: column; gap: 10px; }
    .query-input { padding: 14px 16px; font-size: 16px; }
    .query-btn { justify-content: center; padding: 14px; }

    .query-tabs { margin-bottom: 14px; }
    .query-tab { padding: 9px 10px; font-size: 12px; }

    .recent-header { flex-wrap: wrap; gap: 8px; }
    .recent-title { font-size: 13px; }
    .clear-cache-btn { padding: 5px 10px; font-size: 11px; }
    .clear-cache-btn svg { width: 12px; height: 12px; }

    .recent-item { padding: 12px 14px; }
    .recent-icon { width: 32px; height: 32px; }
    .recent-code { font-size: 13px; }

    .result-container { padding: 12px; }
    .result-card { padding: 16px; border-radius: 12px; }
    .status-text { font-size: 16px; }

    .info-grid { grid-template-columns: 1fr; gap: 14px; }
    .timeline { padding-left: 26px; }
    .step-marker { left: -26px; width: 18px; height: 18px; }
}

@media (max-width: 374px) {
    .query-title { font-size: 18px; }
    .recent-status { display: none; }
    .recent-arrow { display: none; }
}

/* 底部 */
.query-footer {
    padding: 20px 16px;
    background: transparent;
    text-align: center;
    margin-top: auto;
}

.query-footer .footer-copy {
    font-size: 12px;
    color: var(--text-hint);
    margin-bottom: 4px;
}

.query-footer .footer-beian {
    font-size: 11px;
}

.query-footer .footer-beian a {
    color: var(--text-hint);
    text-decoration: none;
}

.query-footer .footer-beian a:hover {
    color: var(--primary-light);
}
