/* 防伪二维码验证系统 - 公共样式 */

:root {
    --primary: #0a7c48;
    --primary-dark: #075e37;
    --primary-light: #e8f5ef;
    --danger: #d93025;
    --danger-light: #fdecea;
    --warning: #b26a00;
    --warning-light: #fff4e5;
    --text: #1f2329;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --bg: #f2f4f7;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
}

.page {
    max-width: 560px;
    margin: 0 auto;
    padding: 16px 14px 32px;
}

/* 顶部品牌区 */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, #12a05f 100%);
    color: #fff;
    border-radius: 16px;
    padding: 20px 18px;
    box-shadow: 0 6px 18px rgba(10, 124, 72, .22);
}

.hero h1 {
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: .5px;
}

.hero p {
    margin: 0;
    font-size: 13px;
    opacity: .92;
}

.hero .badge {
    display: inline-block;
    margin-bottom: 8px;
    padding: 2px 10px;
    font-size: 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .22);
}

/* 卡片 */
.card {
    margin-top: 14px;
    background: #fff;
    border-radius: 16px;
    padding: 18px 16px;
    box-shadow: 0 2px 10px rgba(16, 24, 40, .06);
}

.card-title {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-title::before {
    content: "";
    width: 4px;
    height: 15px;
    border-radius: 2px;
    background: var(--primary);
}

.field {
    margin-bottom: 12px;
}

.field label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.input {
    width: 100%;
    padding: 12px 14px;
    font-size: 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    background: #fff;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}

.input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(10, 124, 72, .12);
}

.hint {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.btn-row {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.btn {
    flex: 1;
    padding: 13px 10px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    color: #fff;
    background: var(--primary);
    transition: background .15s, opacity .15s;
}

.btn:active {
    opacity: .85;
}

.btn[disabled] {
    opacity: .55;
    cursor: not-allowed;
}

.btn-secondary {
    background: #fff;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-ghost {
    background: #f4f5f7;
    color: var(--text-muted);
}

/* 扫码区 */
.scanner {
    margin-top: 12px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 10px;
    display: none;
}

.scanner.active {
    display: block;
}

#reader {
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    background: #000;
}

/* 结果区 */
.result {
    margin-top: 16px;
    border-radius: 16px;
    overflow: hidden;
    display: none;
    background: #fff;
    box-shadow: 0 6px 22px rgba(16, 24, 40, .12);
    animation: resultIn .28s ease-out;
}

.result.show {
    display: block;
}

@keyframes resultIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 顶部结果横幅：按结果级别使用不同渐变 */
.result-banner {
    padding: 24px 18px 20px;
    text-align: center;
    color: #fff;
}

.result.success .result-banner {
    background: linear-gradient(135deg, #07713f 0%, #17b26a 100%);
}

.result.danger .result-banner {
    background: linear-gradient(135deg, #b32318 0%, #ea5a45 100%);
}

.result.warning .result-banner {
    background: linear-gradient(135deg, #a86200 0%, #e2962c 100%);
}

/* 状态图标圆环 */
.status-icon {
    width: 62px;
    height: 62px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .18);
    border: 2px solid rgba(255, 255, 255, .8);
    font-size: 32px;
    font-weight: 700;
    line-height: 58px;
    animation: iconPop .45s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes iconPop {
    0% {
        transform: scale(.4);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.result-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: .5px;
}

.result-subtitle {
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.6;
    opacity: .93;
}

.result-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* 结果信息列表 */
.info-list {
    padding: 4px 16px 0;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 12px 0;
    font-size: 15px;
}

.info-item + .info-item {
    border-top: 1px dashed var(--border);
}

.info-item .k {
    color: var(--text-muted);
    flex: none;
}

.info-item .v {
    font-weight: 600;
    word-break: break-all;
    text-align: right;
}

.result-foot {
    padding: 12px 16px 16px;
    font-size: 12px;
    color: #9aa1ab;
    text-align: center;
}

.kv {
    background: rgba(255, 255, 255, .75);
    border-radius: 10px;
    padding: 10px 12px;
}

.kv-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    font-size: 14px;
}

.kv-row + .kv-row {
    border-top: 1px solid rgba(0, 0, 0, .05);
}

.kv-row .k {
    color: var(--text-muted);
    flex: none;
}

.kv-row .v {
    font-weight: 600;
    word-break: break-all;
    text-align: right;
}

.empty-v {
    color: #9aa1ab;
    font-weight: 400;
}

/* 提示条 */
.tip {
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-muted);
    background: #fff;
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: 0 2px 10px rgba(16, 24, 40, .05);
}

.tip-title {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.footer {
    margin-top: 18px;
    text-align: center;
    font-size: 12px;
    color: #9aa1ab;
}

/* 加载遮罩 */
.mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .35);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99;
}

.mask.show {
    display: flex;
}

.mask-box {
    background: #fff;
    border-radius: 12px;
    padding: 18px 24px;
    font-size: 14px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--primary-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
