/* ========== 授权查询页面样式 ========== */

/* 全局变量 */
:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --border-color: #e2e8f0;
    --input-bg: #ffffff;
    --input-border: #cbd5e1;
    --accent-color: #4f46e5;
    --accent-hover: #4338ca;
    --accent-light: #e0e7ff;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --bg-gradient-start: #e0e7ff;
    --bg-gradient-end: #818cf8;
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #64748b;
    --border-color: #334155;
    --input-bg: #1e293b;
    --input-border: #475569;
    --accent-color: #6366f1;
    --accent-hover: #818cf8;
    --accent-light: rgba(99, 102, 241, 0.2);
    --bg-gradient-start: #0f172a;
    --bg-gradient-end: #1e293b;
}

/* 基础样式 */
* { box-sizing: border-box; margin: 0; padding: 0; transition: background-color 0.3s, border-color 0.3s, color 0.3s; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg-primary); color: var(--text-primary); line-height: 1.6; min-height: 100vh; display: flex; align-items: center; justify-content: center; position: relative; overflow-x: hidden; }
.bg-decoration { position: absolute; top: 0; left: 0; width: 100%; height: 50vh; background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-primary) 100%); z-index: -1; }

/* 主容器 */
.container { width: 100%; max-width: 480px; padding: 20px; }
.query-card { background: var(--bg-secondary); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 40px; position: relative; overflow: hidden; border: 1px solid var(--border-color); animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
.header { text-align: center; margin-bottom: 30px; }
.logo-icon { font-size: 48px; color: var(--accent-color); margin-bottom: 15px; display: inline-block; }
h1 { font-size: 24px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.subtitle { color: var(--text-secondary); font-size: 14px; }

/* 查询类型选项卡 */
.query-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
    padding: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: calc(var(--radius-md) - 2px);
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.tab-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    opacity: 0;
    transition: opacity 0.3s;
}

.tab-btn:hover {
    color: var(--text-primary);
    transform: translateY(-1px);
}

.tab-btn:hover::before {
    opacity: 1;
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--accent-color), #6366f1);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3), 0 2px 4px rgba(79, 70, 229, 0.2);
    transform: translateY(-2px);
}

.tab-btn.active::before {
    opacity: 0;
}

.tab-btn.active:hover {
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4), 0 2px 4px rgba(79, 70, 229, 0.2);
}

.tab-btn i {
    font-size: 16px;
    transition: transform 0.3s;
}

.tab-btn.active i {
    transform: scale(1.1);
}

/* 表单 */
.input-group { margin-bottom: 20px; position: relative; }
.input-group label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 500; color: var(--text-secondary); }
.input-wrapper { position: relative; }
.input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-tertiary); font-size: 16px; transition: color 0.3s; }
.query-input { width: 100%; padding: 12px 12px 12px 42px; font-size: 15px; border: 2px solid var(--input-border); border-radius: var(--radius-md); background: var(--input-bg); color: var(--text-primary); outline: none; transition: all 0.3s; }
.query-input:focus { border-color: var(--accent-color); box-shadow: 0 0 0 3px var(--accent-light); }
.query-input:focus + .input-icon { color: var(--accent-color); }

/* 按钮 */
.btn { width: 100%; padding: 14px; border: none; border-radius: var(--radius-md); font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-primary { background: var(--accent-color); color: white; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3); }
.btn-primary:active { transform: translateY(0); }
.btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

/* 结果展示 */
.result-box { margin-top: 25px; padding: 20px; border-radius: var(--radius-md); background: var(--bg-tertiary); border: 1px solid var(--border-color); display: none; animation: fadeIn 0.4s ease; }
.result-header { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px solid var(--border-color); }
.status-icon { font-size: 24px; }
.status-title { font-weight: 600; font-size: 16px; }
.result-details { font-size: 14px; color: var(--text-secondary); }
.result-text { font-family: 'Consolas', 'Monaco', monospace; font-size: 13px; line-height: 1.8; color: var(--text-primary); white-space: pre-wrap; word-break: break-all; padding: 15px; background: var(--bg-secondary); border-radius: var(--radius-md); border: 1px solid var(--border-color); margin-top: 10px; }
.result-item { display: flex; justify-content: space-between; margin-bottom: 8px; }
.result-label { color: var(--text-tertiary); }
.result-value { font-weight: 500; color: var(--text-primary); }
.status-success { background: rgba(16, 185, 129, 0.1); border-color: rgba(16, 185, 129, 0.2); }
.status-success .status-icon, .status-success .status-title { color: var(--success-color); }
.status-error { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.2); }
.status-error .status-icon, .status-error .status-title { color: var(--error-color); }

/* 无代理警告样式 */
.status-warning {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.1));
    border: 2px solid rgba(239, 68, 68, 0.3);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.status-warning::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.status-warning .status-icon,
.status-warning .status-title {
    color: #dc2626;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.status-warning .result-details {
    color: #991b1b;
    font-weight: 500;
}

/* 深色模式下的无代理警告 */
[data-theme="dark"] .status-warning {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.15));
    border-color: rgba(239, 68, 68, 0.4);
}

[data-theme="dark"] .status-warning .status-icon,
[data-theme="dark"] .status-warning .status-title {
    color: #f87171;
}

[data-theme="dark"] .status-warning .result-details {
    color: #fca5a5;
}

/* 底部链接 */
.footer-links { margin-top: 25px; text-align: center; display: flex; justify-content: center; gap: 20px; }
.link { color: var(--text-secondary); text-decoration: none; font-size: 14px; transition: color 0.2s; }
.link:hover { color: var(--accent-color); }

/* 工具栏 */
.toolbar { position: absolute; top: 20px; right: 20px; display: flex; gap: 10px; z-index: 10; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--bg-secondary); border: 1px solid var(--border-color); color: var(--text-secondary); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; box-shadow: var(--shadow-sm); }
.icon-btn:hover { color: var(--accent-color); border-color: var(--accent-color); transform: rotate(15deg); }

/* 加载动画 */
.page-loader { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 9999; transition: opacity 0.5s ease, visibility 0.5s ease; }
.page-loader.hidden { opacity: 0; visibility: hidden; }
.loader-spinner { width: 50px; height: 50px; border: 3px solid rgba(255, 255, 255, 0.3); border-radius: 50%; border-top-color: white; animation: spin 1s ease-in-out infinite; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ========== 移动端适配 ========== */

/* 平板设备 */
@media (max-width: 768px) {
    body {
        padding: 0;
        align-items: flex-start;
    }
    .container {
        max-width: 100%;
        padding: 15px;
        min-height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .query-card {
        padding: 35px 25px;
        border-radius: var(--radius-md);
        width: 100%;
        max-width: 420px;
    }
    .toolbar {
        top: 15px;
        right: 15px;
    }
}

/* 手机设备 */
@media (max-width: 480px) {
    body {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
    html {
        height: -webkit-fill-available;
    }
    .bg-decoration {
        height: 40vh;
    }
    .container {
        padding: 12px;
        align-items: flex-start;
        padding-top: 60px;
    }
    .query-card {
        padding: 28px 18px;
        border-radius: 12px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    }
    .header {
        margin-bottom: 24px;
    }
    .logo-icon {
        font-size: 42px;
        margin-bottom: 12px;
    }
    h1 {
        font-size: 20px;
        margin-bottom: 6px;
    }
    .subtitle {
        font-size: 13px;
    }
    .query-tabs {
        gap: 8px;
        padding: 3px;
        margin-bottom: 20px;
    }
    .tab-btn {
        padding: 8px 12px;
        font-size: 13px;
        gap: 4px;
    }
    .tab-btn i {
        font-size: 14px;
    }
    .input-group {
        margin-bottom: 16px;
    }
    .input-group label {
        font-size: 13px;
        margin-bottom: 6px;
    }
    .query-input {
        padding: 12px 12px 12px 40px;
        font-size: 16px; /* 防止iOS缩放 */
        border-radius: 8px;
    }
    .input-icon {
        left: 12px;
        font-size: 15px;
    }
    .btn {
        padding: 13px;
        font-size: 15px;
        border-radius: 8px;
    }
    .result-box {
        margin-top: 20px;
        padding: 16px;
        border-radius: 8px;
    }
    .result-header {
        gap: 10px;
        margin-bottom: 12px;
        padding-bottom: 12px;
    }
    .status-icon {
        font-size: 22px;
    }
    .status-title {
        font-size: 15px;
    }
    .result-details {
        font-size: 13px;
    }
    .result-text {
        font-size: 12px;
        padding: 12px;
        line-height: 1.7;
        border-radius: 6px;
    }
    .footer-links {
        margin-top: 20px;
        gap: 16px;
    }
    .link {
        font-size: 13px;
    }
    .toolbar {
        top: 12px;
        right: 12px;
    }
    .icon-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
}

/* 超小屏幕手机 */
@media (max-width: 360px) {
    .container {
        padding: 10px;
        padding-top: 55px;
    }
    .query-card {
        padding: 24px 15px;
    }
    .logo-icon {
        font-size: 38px;
    }
    h1 {
        font-size: 18px;
    }
    .subtitle {
        font-size: 12px;
    }
    .query-input {
        padding: 11px 11px 11px 38px;
    }
    .btn {
        padding: 12px;
        font-size: 14px;
    }
    .result-text {
        font-size: 11px;
        padding: 10px;
    }
}

/* 横屏模式优化 */
@media (max-height: 500px) and (orientation: landscape) {
    .container {
        padding-top: 15px;
        align-items: flex-start;
    }
    .query-card {
        padding: 20px;
    }
    .header {
        margin-bottom: 15px;
    }
    .logo-icon {
        font-size: 32px;
        margin-bottom: 8px;
    }
    h1 {
        font-size: 18px;
        margin-bottom: 4px;
    }
    .input-group {
        margin-bottom: 12px;
    }
    .result-box {
        margin-top: 15px;
        padding: 12px;
    }
    .footer-links {
        margin-top: 15px;
    }
}

/* 安全区域适配（刘海屏等） */
@supports (padding: max(0px)) {
    .container {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
    .toolbar {
        right: max(12px, env(safe-area-inset-right));
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        transform: none;
        box-shadow: none;
    }
    .btn:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
    .icon-btn:hover {
        transform: none;
    }
    .icon-btn:active {
        transform: scale(0.95);
    }
    .link:hover {
        color: var(--text-secondary);
    }
    .link:active {
        color: var(--accent-color);
    }
}

