/* 移动端优先，简洁紧凑 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f5f6f8;
    color: #333;
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
}

.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px;
}

/* 页头 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.header h1 {
    font-size: 20px;
    font-weight: 600;
}

.link-config {
    font-size: 22px;
    color: #555;
    text-decoration: none;
    padding: 4px 8px;
}

/* 搜索栏：输入框 + 扫码 + 查询 一行排列 */
.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.search-bar input[type="text"] {
    flex: 1;
    min-width: 0;
    height: 44px;
    padding: 0 12px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    font-size: 16px;
    background: #fff;
}

.search-bar input[type="text"]:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.btn-icon,
.btn-primary,
.btn-secondary,
.btn-text {
    height: 44px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-icon {
    width: 44px;
    background: #eef2ff;
    font-size: 20px;
    line-height: 1;
}

.btn-icon:active {
    background: #dbe3ff;
}

.btn-primary {
    padding: 0 18px;
    background: #2563eb;
    color: #fff;
}

.btn-primary:active {
    background: #1d4ed8;
}

.btn-primary:disabled {
    background: #9bb8f5;
    cursor: not-allowed;
}

.btn-secondary {
    padding: 0 16px;
    background: #e5e7eb;
    color: #374151;
}

.btn-secondary:active {
    background: #d1d5db;
}

.btn-text {
    height: auto;
    padding: 6px 12px;
    background: transparent;
    color: #2563eb;
}

/* 查询结果 */
.result {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
}

.result-empty {
    text-align: center;
    color: #888;
    padding: 24px;
}

.result-row {
    display: flex;
    margin-bottom: 8px;
    font-size: 14px;
}

.result-row:last-child {
    margin-bottom: 0;
}

.result-row .label {
    color: #888;
    width: 80px;
    flex-shrink: 0;
}

.result-row .value {
    word-break: break-all;
    font-family: "SFMono-Regular", Consolas, monospace;
}

.result-row .value.code {
    background: #f3f4f6;
    padding: 8px 10px;
    border-radius: 6px;
    color: #1f2937;
}

.copy-btn {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 16px;
    background: #16a34a;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    width: 100%;
}

.copy-btn:active {
    background: #15803d;
}

.tip {
    margin-top: 12px;
    padding: 10px;
    background: #fef9c3;
    border-radius: 6px;
    font-size: 13px;
    color: #854d0e;
}

.hint {
    text-align: center;
    color: #9ca3af;
    font-size: 12px;
    margin-top: 32px;
}

/* 扫码弹层 */
.scanner {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.scanner-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #000;
    color: #fff;
}

.camera-select {
    flex: 1;
    height: 36px;
    padding: 0 8px;
    border: 1px solid #444;
    border-radius: 6px;
    background: #1f1f1f;
    color: #fff;
    font-size: 14px;
}

.qr-reader {
    flex: 1;
    overflow: hidden;
    width: 100%;
    /* html5-qrcode 内部会插入 video 和 canvas，需要确定的高度 */
    min-height: 320px;
    position: relative;
    background: #000;
}

/* 强制让 html5-qrcode 渲染的元素充满容器 */
.qr-reader > div,
.qr-reader > section,
.qr-reader video,
.qr-reader canvas {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.qr-reader-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
}

/* 配置页表单 */
.form {
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    border: 1px solid #e5e7eb;
}

.field {
    display: block;
    margin-bottom: 14px;
}

.field span {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: #555;
}

.field input[type="text"] {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    font-size: 15px;
    font-family: "SFMono-Regular", Consolas, monospace;
}

.field input[type="text"]:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
}

.actions .btn-primary,
.actions .btn-secondary {
    flex: 1;
    min-width: 100px;
}

.status {
    margin-top: 16px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    color: #555;
}

.status > div {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.status strong {
    color: #2563eb;
    font-weight: 600;
}

.msg {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
}

.msg-success {
    background: #dcfce7;
    color: #166534;
}

.msg-error {
    background: #fee2e2;
    color: #991b1b;
}

.msg-info {
    background: #dbeafe;
    color: #1e40af;
}
