/* ===== 旅游景区安全须知 - 通用样式 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #1aad19;        /* 微信绿 - 景区友好 */
    --primary-dark: #0e8c12;
    --secondary: #4a90e2;       /* 蓝 - 管理/查看 */
    --warn: #ff6b35;
    --text: #2c3e50;
    --text-light: #6c7a89;
    --bg: #f7f9fc;
    --card: #ffffff;
    --border: #e1e8ed;
    --shadow: 0 4px 12px rgba(0,0,0,.05);
    --radius: 12px;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
                 "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 16px;
    padding-bottom: 96px;
}

/* ===== 顶部 ===== */
.top-bar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    padding: 32px 20px 36px;
    text-align: center;
    border-radius: 0 0 24px 24px;
    margin-bottom: 16px;
}
.top-bar h1 { font-size: 22px; margin-bottom: 4px; font-weight: 600; }
.top-bar p  { font-size: 14px; opacity: .9; }
.top-bar .logo {
    width: 56px; height: 56px; border-radius: 50%;
    background: rgba(255,255,255,.2); display: inline-flex;
    align-items: center; justify-content: center;
    font-size: 28px; margin-bottom: 12px;
}

/* ===== 卡片 ===== */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
}
.card-title {
    font-size: 17px; font-weight: 600;
    color: var(--text); margin-bottom: 14px;
    display: flex; align-items: center; gap: 8px;
}
.card-title::before {
    content: ""; width: 4px; height: 18px;
    background: var(--primary); border-radius: 2px;
}

/* ===== 安全须知条款 ===== */
.notice-list {
    list-style: none;
    counter-reset: notice;
    padding: 0;
}
.notice-list li {
    position: relative;
    padding: 10px 12px 10px 0;
    margin-bottom: 8px;
    border-bottom: 1px dashed var(--border);
    font-size: 14.5px;
    color: var(--text);
}
.notice-list li:last-child {
    border-bottom: none;
    margin-bottom: 0;
    font-weight: 500;
    color: var(--primary-dark);
}
.notice-list p { font-size: 14.5px; }
.notice-list .intro { font-weight: 500; color: var(--text); padding: 8px 0; }

/* ===== 按钮 ===== */
.btn-row {
    display: flex; gap: 12px; flex-wrap: wrap;
    margin-top: 8px;
}
.btn {
    flex: 1 1 0;
    min-width: 140px;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 500;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all .2s;
    display: inline-flex;
    align-items: center; justify-content: center; gap: 6px;
    text-decoration: none;
    color: #fff;
}
.btn-primary  { background: var(--primary); }
.btn-primary:hover, .btn-primary:active { background: var(--primary-dark); }
.btn-secondary { background: var(--secondary); }
.btn-secondary:hover, .btn-secondary:active { background: #357abd; }
.btn-warn  { background: var(--warn); }
.btn-warn:hover, .btn-warn:active { background: #e64e17; }
.btn-ghost {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-ghost:hover { background: #f5f7fa; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ===== 表单 ===== */
.field { margin-bottom: 16px; }
.field label {
    display: block; font-size: 14px;
    color: var(--text); margin-bottom: 6px;
    font-weight: 500;
}
.field label .req { color: var(--warn); margin-left: 2px; }
.field input[type=text],
.field input[type=tel],
.field input[type=date],
.field input[type=password],
.field input[type=email],
.field input[type=number],
.field input[type=search],
.field select,
.field textarea {
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color .15s;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
}
.field select {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236c7a89' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}
.field input:focus, .field textarea:focus {
    outline: none;
    border-color: var(--primary);
}
.field .hint {
    font-size: 12px; color: var(--text-light); margin-top: 4px;
}

/* ===== 手写签名 ===== */
.signature-pad {
    border: 2px dashed var(--border);
    border-radius: 10px;
    background: #fafbfc;
    position: relative;
    overflow: hidden;
    height: 200px;
    touch-action: none;
}
.signature-pad canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}
.signature-pad .placeholder {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: #b0bec5; font-size: 14px;
    pointer-events: none;
}
.signature-pad .placeholder.hidden { display: none; }
.signature-actions {
    display: flex; justify-content: flex-end; margin-top: 6px;
}

/* ===== 通用提示 / Toast ===== */
.tip-box {
    background: #f0f7eb;
    color: var(--primary-dark);
    border-left: 4px solid var(--primary);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13.5px;
    margin-bottom: 16px;
}
.warn-box {
    background: #fff3e0;
    color: #c44b00;
    border-left: 4px solid var(--warn);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13.5px;
    margin-bottom: 16px;
}

#toast {
    position: fixed; left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,.78);
    color: #fff; padding: 12px 20px;
    border-radius: 8px; font-size: 14px;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}
#toast.show { opacity: 1; }

/* ===== 记录列表 ===== */
.record-list { display: flex; flex-direction: column; gap: 12px; }
.record-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    background: #fff;
}
.record-card .meta {
    display: flex; flex-wrap: wrap;
    gap: 4px 14px;
    font-size: 13px; color: var(--text-light);
    margin-bottom: 8px;
}
.record-card .meta b { color: var(--text); }
.record-card .sig {
    margin-top: 8px;
    border-top: 1px dashed var(--border);
    padding-top: 8px;
}
.record-card .sig img {
    max-width: 200px; max-height: 80px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    display: block;
}
.empty {
    text-align: center;
    padding: 40px 16px;
    color: var(--text-light);
    font-size: 14px;
}
.empty::before {
    content: "📭";
    display: block;
    font-size: 36px;
    margin-bottom: 8px;
}

/* ===== 管理后台表格 ===== */
.toolbar {
    display: flex; gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    align-items: center;
}
.toolbar input[type=text] {
    flex: 1 1 200px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
}
.stat-bar {
    display: flex; gap: 12px;
    margin-bottom: 14px; flex-wrap: wrap;
}
.stat {
    flex: 1 1 120px;
    background: #fff;
    border-radius: 8px;
    padding: 14px;
    border: 1px solid var(--border);
}
.stat .num { font-size: 22px; font-weight: 600; color: var(--primary-dark); }
.stat .label { font-size: 12.5px; color: var(--text-light); margin-top: 4px; }

.table-wrap { overflow-x: auto; }
table {
    width: 100%; border-collapse: collapse;
    font-size: 13.5px;
    background: #fff;
}
table th, table td {
    padding: 10px 8px; text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
table th {
    background: #f5f7fa;
    font-weight: 600; color: var(--text);
    position: sticky; top: 0;
}
table tr:hover { background: #f9fbfc; }
table .sig-mini {
    width: 80px; height: 30px;
    object-fit: contain;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: #fff;
}

/* ===== 二维码区 ===== */
.qr-card {
    text-align: center;
}
.qr-card img {
    width: 220px; height: auto;
    border-radius: 8px;
    border: 4px solid #fff;
    box-shadow: var(--shadow);
    margin: 8px 0;
}

/* ===== 响应式 ===== */
@media (max-width: 480px) {
    .container { padding: 12px; }
    .top-bar { padding: 24px 16px 28px; }
    .top-bar h1 { font-size: 19px; }
    .btn { font-size: 15px; padding: 12px 14px; }
}

/* ===== 模态框：成功页 ===== */
.modal-mask {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
    opacity: 0; pointer-events: none;
    transition: opacity .25s;
}
.modal-mask.show { opacity: 1; pointer-events: auto; }
.modal {
    background: #fff;
    border-radius: 16px;
    padding: 28px 24px 22px;
    width: 90%; max-width: 360px;
    text-align: center;
    animation: pop .35s ease;
}
@keyframes pop {
    from { transform: scale(.85); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
.modal .icon {
    font-size: 56px; margin-bottom: 12px;
}
.modal h3 { font-size: 18px; margin-bottom: 8px; }
.modal p { font-size: 14px; color: var(--text-light); margin-bottom: 18px; }


/* ===== 手写签名触发器（全屏弹窗触发） ===== */
.sig-trigger {
    width: 100%;
    height: 180px;
    border: 2px dashed #d4dde6;
    border-radius: var(--radius);
    background: #fafcff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    overflow: hidden;
    position: relative;
}
.sig-trigger:active { background: #eef5ff; }
.sig-trigger.has-sig { border-style: solid; border-color: var(--primary); }
.sig-trigger img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.sig-trigger .sig-placeholder {
    color: #8a99ad;
    font-size: 15px;
    text-align: center;
    pointer-events: none;
}
.sig-trigger .sig-placeholder .icon { font-size: 32px; display:block; margin-bottom:6px; }

.sig-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-light);
}
.sig-actions .btn-link {
    color: var(--secondary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    font-size: 13px;
}
.sig-actions .btn-link:disabled {
    color: #b0b8c2; cursor: not-allowed;
}


/* ===== 全屏签名弹窗 ===== */
.sig-modal {
    position: fixed;
    inset: 0;
    background: #fafbfc;
    z-index: 99999;
    display: none;
    flex-direction: column;
    /* 安全区适配 */
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.sig-modal.show { display: flex; }
.sig-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.sig-modal-header .title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}
.sig-modal-header button {
    border: none;
    background: transparent;
    font-size: 16px;
    padding: 6px 4px;
    cursor: pointer;
    min-width: 60px;
    color: var(--text);
}
.sig-modal-header .btn-confirm {
    color: var(--primary);
    font-weight: 600;
    text-align: right;
}
.sig-modal-header .btn-confirm:disabled {
    color: #b0b8c2;
}
.sig-modal-canvas-wrap {
    flex: 1;
    margin: 8px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0,0,0,.06);
    position: relative;
    overflow: hidden;
    /* 内部 canvas 禁止页面滚动 */
    touch-action: none;
}
.sig-modal-canvas-wrap canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;       /* 关键：禁止浏览器默认滚动行为 */
    user-select: none;
    -webkit-user-select: none;
}
.sig-modal-canvas-wrap .hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #c0c8d2;
    font-size: 18px;
    pointer-events: none;
    text-align: center;
}
.sig-modal-canvas-wrap .hint.hidden { display: none; }
.sig-modal-canvas-wrap .signature-line {
    position: absolute;
    left: 24px;
    right: 24px;
    bottom: 32px;
    border-bottom: 2px dashed #e1e8ed;
    pointer-events: none;
}
.sig-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.sig-modal-footer button {
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 14px;
    color: #555;
    cursor: pointer;
}
.sig-modal-footer .btn-clear:active { background: #f5f5f5; }


/* ===== 人脸照片上传 ===== */
.photo-trigger {
    position: relative;
    width: 100%;
    height: 220px;
    border: 2px dashed #d4dde6;
    border-radius: var(--radius);
    background: #fafcff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: border-color .2s, background .2s;
}
.photo-trigger.has-photo {
    border-style: solid;
    border-color: var(--primary);
    background: #fff;
}
.photo-trigger input[type=file] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}
.photo-trigger img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    z-index: 1;
}
.photo-trigger .placeholder {
    text-align: center;
    color: #8a99ad;
    font-size: 14px;
    pointer-events: none;
    padding: 0 20px;
}
.photo-trigger .placeholder .icon {
    font-size: 36px;
    display: block;
    margin-bottom: 8px;
}
.photo-trigger.has-photo .placeholder { display: none; }
.photo-trigger .retake {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,.55);
    color: #fff;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    z-index: 3;
    pointer-events: none;
}


/* ===== 表单必填星号 ===== */
.req { color: var(--warn); margin-left: 2px; }

/* ===== 适配小屏 ===== */
@media (max-width: 360px) {
    .sig-modal-header .title { font-size: 15px; }
    .photo-trigger { height: 180px; }
}

