/* ============================================================
   入校码 v4 · 电子通行证（访客端 + 门卫端共用）
   布局（自上而下）：滚动时钟 -> 人/车左右双栏 -> 左照片 | 右入校码+二维码 -> 明细
   颜色语义：绿=可进 / 黄=未到时间 / 红=过期或拒绝 / 灰=已核销或无车辆
   高度策略：关键尺寸全部由 vh 派生（clamp），整卡尽量在一屏内显示，
             极端小屏仍可上下滚动，不会挤压变形。
   ============================================================ */

/* ---------- 0. 弹窗外壳：大幅压缩上下留白 ---------- */
.pc-modal .modal-content { border: none; border-radius: 14px; overflow: hidden; }
.pc-modal .modal-header { padding: 0.45rem 0.85rem !important; min-height: 0; }
.pc-modal .modal-title { font-size: 0.95rem; font-weight: 700; }
.pc-modal .modal-header .btn-close { transform: scale(0.82); margin: 0; }
.pc-modal .modal-body { padding: 0 !important; }
.pc-modal .modal-footer {
    padding: 0.45rem 0.8rem !important;
    border-top: 1px solid #eef2f7;
    background: #fff;
}
.pc-modal .modal-footer .btn {
    min-height: 42px !important;
    padding: 0.4rem 1rem !important;
    font-size: 0.95rem !important;
}

/* ---------- 顶层卡片 ---------- */
.pc-card { background: #fff; --pc-accent: #22c55e; }
.pc-body {
    padding: 0.55rem;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 0.42rem;
}

/* ============================================================
   1. 顶部滚动时钟（秒数每秒跳动 + 进度条，防截图）
   ============================================================ */
.pc-clock-hero {
    background: linear-gradient(160deg, #0b1220 0%, #122036 100%);
    border-radius: 13px;
    padding: 0.5rem 0.7rem 0.45rem;
    text-align: center;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.24);
}
.pc-clock-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.pc-clock-label { color: #7f97b8; font-size: 0.62rem; letter-spacing: 0.2rem; }
.pc-clock-date { color: #94a3b8; font-size: 0.66rem; letter-spacing: 0.03rem; }
.pc-clock-time {
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: clamp(1.7rem, 6.2vh, 2.6rem);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: 0.04rem;
    color: var(--pc-accent);
    text-shadow: 0 0 20px rgba(74, 222, 128, 0.35);
    margin-top: 0.05rem;
}
.pc-clock-time .tick { display: inline-block; }
.pc-clock-time .tick-anim { animation: pcTick 0.45s ease; }
@keyframes pcTick {
    0% { transform: translateY(-42%); opacity: 0.12; }
    100% { transform: translateY(0); opacity: 1; }
}
.pc-clock-bar {
    height: 5px;
    border-radius: 4px;
    background: rgba(148, 163, 184, 0.22);
    margin-top: 0.4rem;
    overflow: hidden;
}
.pc-clock-bar > span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--pc-accent);
    transition: width 1s linear;
}
.pc-clock-live { color: #93a4bd; font-size: 0.62rem; margin-top: 0.3rem; }
.pc-clock-live .dot {
    width: 6px; height: 6px; border-radius: 50%; background: #ef4444;
    display: inline-block; margin-right: 0.28rem; vertical-align: middle;
    animation: pcPulse 1.2s infinite;
}
@keyframes pcPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* 状态驱动的强调色 */
.pc-card.pc-state-valid { --pc-accent: #22c55e; }
.pc-card.pc-state-upcoming { --pc-accent: #f5b800; }
.pc-card.pc-state-expired,
.pc-card.pc-state-rejected { --pc-accent: #ef4444; }
.pc-card.pc-state-verified { --pc-accent: #94a3b8; }
/* 待审批 / 待车辆审批：蓝色（凭证已生成但尚未生效） */
.pc-card.pc-state-pending,
.pc-card.pc-state-pending_car { --pc-accent: #3b82f6; }
.pc-card.pc-state-pending .pc-clock-time,
.pc-card.pc-state-pending_car .pc-clock-time { text-shadow: 0 0 20px rgba(59, 130, 246, 0.4); }
.pc-card.pc-state-pending .pc-clock-live .dot,
.pc-card.pc-state-pending_car .pc-clock-live .dot { background: #3b82f6; }

/* ============================================================
   2. 人 / 车 左右双栏
   ============================================================ */
.pc-dual { display: flex; gap: 0.45rem; }
.pc-cell {
    flex: 1 1 0;
    min-width: 0;
    border-radius: 12px;
    border: 2px solid #cbd5e1;
    background: #f8fafc;
    padding: 0.32rem 0.4rem;
    text-align: center;
    transition: background 0.25s ease, border-color 0.25s ease;
}
.pc-cell .pc-cell-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    font-size: 0.66rem;
    color: #64748b;
    line-height: 1.2;
}
.pc-cell .pc-cell-icon { font-size: 0.9rem; line-height: 1; }
.pc-cell .pc-cell-state {
    font-size: clamp(0.9rem, 2.6vh, 1.02rem);
    font-weight: 800;
    margin-top: 0.1rem;
    line-height: 1.15;
}
.pc-cell .pc-cell-note { display: none; }  /* 与状态文案重复，隐藏以节省高度 */
.pc-cell .pc-cell-plate {
    display: inline-block;
    margin-top: 0.2rem;
    background: #1d5fd0;
    color: #fff;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-weight: 800;
    font-size: 0.84rem;
    letter-spacing: 0.08rem;
    padding: 0.08rem 0.42rem;
    border-radius: 6px;
    border: 2px solid #fff;
    box-shadow: 0 3px 10px rgba(29, 95, 208, 0.35);
}
.pc-cell .pc-cell-plate.is-denied {
    background: #c0392b;
    box-shadow: 0 3px 10px rgba(192, 57, 43, 0.32);
    text-decoration: line-through;
    opacity: 0.9;
}
.pc-cell.is-valid { background: #e9f9f0; border-color: #22c55e; }
.pc-cell.is-valid .pc-cell-state { color: #0f9b6c; }
.pc-cell.is-upcoming { background: #fff8e6; border-color: #f5b800; }
.pc-cell.is-upcoming .pc-cell-state { color: #b7791f; }
.pc-cell.is-expired,
.pc-cell.is-rejected { background: #fdecec; border-color: #ef4444; }
.pc-cell.is-expired .pc-cell-state,
.pc-cell.is-rejected .pc-cell-state { color: #c81e1e; }
.pc-cell.is-verified { background: #eef1f5; border-color: #94a3b8; }
.pc-cell.is-verified .pc-cell-state { color: #64748b; }
.pc-cell.is-none { background: #f1f5f9; border-color: #cbd5e1; }
.pc-cell.is-none .pc-cell-state { color: #8492a6; }
.pc-cell.is-pending,
.pc-cell.is-pending_car { background: #eef4ff; border-color: #3b82f6; }
.pc-cell.is-pending .pc-cell-state,
.pc-cell.is-pending_car .pc-cell-state { color: #1d4ed8; }
/* 待审批时给个轻微呼吸提示，强调「还没生效」 */
.pc-cell.is-pending { animation: pcPendingPulse 2s ease-in-out infinite; }
@keyframes pcPendingPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
    50% { box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.14); }
}

/* ============================================================
   3. 左：人像 | 右：姓名 + 入校码 + 二维码
   ============================================================ */
.pc-main { display: flex; gap: 0.5rem; align-items: stretch; }
.pc-photo-col {
    /* 照片占左侧约一半宽度，与上方「人员入校」标签等宽 */
    flex: 1 1 0;
    max-width: 260px;
    display: flex;
}
.pc-photo-wrap {
    position: relative;
    flex: 1 1 auto;
    width: 100%;
    aspect-ratio: 4 / 5;
    border-radius: 12px;
    overflow: hidden;
    background: #eef1f5;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18);
    cursor: zoom-in;
}
.pc-photo { width: 100%; height: 100%; object-fit: cover; display: block; }
.pc-photo-badge {
    position: absolute;
    right: 5px;
    bottom: 5px;
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    font-size: 0.58rem;
    padding: 0.1rem 0.36rem;
    border-radius: 20px;
}

.pc-code-col {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
}
.pc-person-name {
    font-size: clamp(0.98rem, 2.8vh, 1.16rem);
    font-weight: 800;
    color: #0f172a;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pc-person-sub {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* 身份证号整体放大，末 4 位（尾号）进一步强调，方便门卫核对 */
.pc-id-tail {
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: 1.18rem;
    font-weight: 800;
    letter-spacing: 0.06rem;
    color: #0f172a;
    margin-left: 0.1rem;
}

.pc-code-row {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;   /* 入校码数字置顶，二维码在其下方 */
    align-items: center;
    gap: 0.4rem;
}
.pc-code-box {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eef6ff 0%, #e0eeff 100%);
    border: 2px dashed #9cc4f5;
    border-radius: 11px;
    padding: 0.24rem 0.3rem;
    text-align: center;
}
.pc-code-label { font-size: 0.56rem; letter-spacing: 0.18rem; color: #5b7ba6; }
.pc-code-value {
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: clamp(1.0rem, 3.2vh, 1.5rem);
    font-weight: 800;
    letter-spacing: 0.12rem;
    color: #0b5ed7;
    line-height: 1.05;
    white-space: nowrap;      /* 码值不换行，超宽时由 JS 自动缩小字号 */
    align-self: stretch;      /* 撑满码框宽度，便于 JS 检测溢出 */
    text-align: center;
    overflow: hidden;
}
.pc-qr-box {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    padding: 0.24rem;
    cursor: zoom-in;
    -webkit-tap-highlight-color: transparent;
}
.pc-qr-box:active { transform: scale(0.97); }
.pc-qr { display: block; }
.pc-qr img,
.pc-qr canvas { display: block; }
.pc-qr-hint {
    position: absolute;
    right: 3px;
    bottom: 3px;
    background: rgba(15, 23, 42, 0.74);
    color: #fff;
    font-size: 0.54rem;
    line-height: 1;
    padding: 0.16rem 0.3rem;
    border-radius: 20px;
    pointer-events: none;
}

/* ============================================================
   4. 明细
   ============================================================ */
.pc-info {
    background: #fff;
    border: 1px solid #eef2f7;
    border-radius: 11px;
    padding: 0.05rem 0.7rem;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}
.pc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
    padding: 0.3rem 0;
    border-bottom: 1px dashed #e8edf3;
}
.pc-row:last-child { border-bottom: none; }
.pc-row .k { color: #8492a6; font-size: 0.76rem; white-space: nowrap; }
.pc-row .v {
    color: #1e293b;
    font-weight: 700;
    font-size: 0.82rem;
    text-align: right;
    word-break: break-all;
    line-height: 1.35;
}
.pc-tip {
    text-align: center;
    font-size: 0.66rem;
    color: #94a3b8;
    line-height: 1.4;
}

/* ============================================================
   5. 全屏查看（照片 / 二维码共用）
   ============================================================ */
.photo-lightbox,
.zoom-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2050;
    background: rgba(0, 0, 0, 0.93);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.photo-lightbox.show,
.zoom-lightbox.show { display: flex; }
.photo-lightbox img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 10px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
}
.photo-lightbox .lb-close,
.zoom-lightbox .lb-close {
    position: absolute;
    top: 12px;
    right: 16px;
    color: #fff;
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.88;
}
/* 二维码放大层 */
.zoom-lightbox { z-index: 2060; flex-direction: column; gap: 0.7rem; }
.lb-qr-holder {
    background: #fff;
    border-radius: 14px;
    padding: 12px;
    box-sizing: content-box;   /* 让内边距成为二维码四周的静默区，不压缩码面 */
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
}
.lb-qr-holder img,
.lb-qr-holder canvas { display: block; border-radius: 4px; }
.lb-code { text-align: center; color: #fff; }
.lb-code .n {
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: 0.42rem;
    color: #4ade80;
    line-height: 1.2;
}
.lb-code .t { font-size: 0.7rem; color: #94a3b8; margin-top: 0.2rem; }

/* ============================================================
   6. 窄屏 / 矮屏适配
   ============================================================ */
@media (max-width: 400px) {
    .pc-clock-label { letter-spacing: 0.12rem; }
    .pc-photo-badge { display: none; }
}
@media (max-width: 340px) {
    .pc-main { flex-direction: row; }
    .pc-photo-col { max-width: 150px; }
}
/* 矮屏（如 iPhone SE / 8）进一步压缩，保证一屏装下 */
@media (max-height: 700px) {
    .pc-body { gap: 0.36rem; padding: 0.5rem; }
    .pc-clock-live { display: none; }
    .pc-info { padding: 0.05rem 0.6rem; }
    .pc-row { padding: 0.24rem 0; }
}
@media (max-height: 620px) {
    .pc-tip { display: none; }
    .pc-clock-label,
    .pc-clock-date { font-size: 0.58rem; }
    .pc-code-label { display: none; }
}
