/* ====================================
   payment_check.css - 收费结账 Modal 样式
   所有自定义选择器以 .pc- 为前缀（命名空间隔离，不与父框架/页面样式污染）
   在父页面（patients/page.blade.php）中加载
   ==================================== */

/* ---- 业务按钮 ---- */
.pc-btn-primary { background: #0d6efd; border: 1px solid #0d6efd; color: #fff; border-radius: 4px; }
.pc-btn-primary:hover { background: #0b5ed7; border-color: #0b5ed7; color: #fff; }
.pc-btn-primary-light { background: #e7f1ff; border: 1px solid #9ec5fe; color: #0d6efd; border-radius: 4px; }
.pc-header-icon { width: 22px; height: 20px; border-radius: 6px; background: #0d6efd; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 19px; }
.pc-section-title { font-weight: 700; font-size: 17px; border-left: 4px solid #0d6efd; padding-left: 8px; line-height: 1.2; }
.pc-icon-circle { width: 44px; height: 44px; min-width: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 22px; }
.pc-bg-yellow { background: #f6b900; }
.pc-bg-blue { background: #0d6efd; }
.pc-bg-green { background: #40b33f; }
.pc-bg-alipay { background: #1296db; }
.pc-bg-salmon { background: #f4706a; }
.pc-bg-dark2 { background: #343a40; }
.pc-shield-char { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -54%); font-size: 10px; font-weight: 700; color: #0d6efd; }

/* ---- 冻结容器：项目详情行 + 展开的明细表格 一起吸附顶部 ---- */
.pc-sticky-wrap {
    position: sticky;
    top: 0;
    z-index: 600;
    background: #f5f6f9;
    padding: 6px 0;
}

/* ---- 支付方式：固定 210px × 80px ---- */
.pc-pay-col { flex: 0 0 auto; width: 210px; height: 80px; }
.pc-pay-card {
    width: 100%;
    height: 100%;
    background: #fff;
    border: 1px solid #dfe3e8;
    border-radius: 8px;
    font-size: 16px;
    color: #333;
}
.pc-pay-card:hover { border-color: #0d6efd; }

/* ---- 金额输入框：与卡片同尺寸，输入框与确定按钮同一行 ---- */
.pc-pay-input {
    width: 100%;
    height: 100%;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    background: #0d6efd;
    border-radius: 10px;
    padding: 10px;
}
.pc-pay-input input {
    flex: 1 1 auto;
    min-width: 0;
    height: 60px;
    border: none;
    outline: none;
    background: #fff;
    border-radius: 8px 0 0 8px;
    padding: 0 14px;
    font-size: 15px;
    color: #333;
}
.pc-pay-input input::placeholder { color: #999; }
.pc-pay-input .pc-confirm-btn {
    flex: 0 0 auto;
    height: 60px;
    white-space: nowrap;
    border: none;
    background: #cfe2ff;
    color: #0a3a82;
    font-size: 16px;
    font-weight: 600;
    border-radius: 0 8px 8px 0;
    padding: 0 18px;
}
.pc-pay-input .pc-confirm-btn:hover { background: #b9d7ff; }
.pc-pay-input input::-webkit-outer-spin-button,
.pc-pay-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pc-pay-input input[type=number] { -moz-appearance: textfield; appearance: textfield; }

/* ---- 其他支付下拉多选 ---- */
.pc-other-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 1000;
    background: #fff;
    border: 1px solid #dfe3e8;
    border-radius: 6px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
    padding: 8px 14px;
    min-width: 150px;
}
.pc-other-dropdown label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    margin: 0;
    cursor: pointer;
    white-space: nowrap;
    font-size: 14px;
}
.pc-other-dropdown input[type=checkbox] { accent-color: #0d6efd; }

.pc-coupon-box { display: inline-flex; align-items: stretch; width: 380px; background: #fff; border: 3px solid #0d6efd; border-radius: 8px; padding: 2px; }
.pc-coupon-box .form-control { border: none; box-shadow: none; font-size: 14px; }
.pc-coupon-box .pc-verify-btn { background: #cfe2ff; color: #0a3a82; border: none; border-radius: 4px; width: 64px; }
.pc-coupon-box .pc-verify-btn:disabled { background: #e9ecef; color: #adb5bd; }

/* ---- 可用优惠券状态文本（coupon.md：无可用灰色、可用橘色，点击打开列表） ---- */
.pc-coupon-status { font-size: 14px; font-weight: 600; margin-left: 1rem !important; }
.pc-coupon-status.pc-coupon-none { color: #999; cursor: default; }
.pc-coupon-status.pc-coupon-ok { color: #ff8c00; cursor: pointer; }
.pc-coupon-status.pc-coupon-ok:hover { text-decoration: underline; }

/* ---- 可用优惠券列表弹窗（单选，按优惠力度倒序） ---- */
.pc-coupon-modal .modal-dialog { max-width: 620px; }
.pc-coupon-modal .modal-body { background: #fff; max-height: 55vh; overflow-y: auto; }
.pc-coupon-list { display: flex; flex-direction: column; gap: 10px; }
.pc-coupon-item {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid #dfe3e8;
    border-radius: 8px;
    padding: 12px 14px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.pc-coupon-item:hover { border-color: #ff8c00; }
.pc-coupon-item.pc-coupon-selected { border-color: #ff8c00; background: #fff7ec; }
.pc-coupon-item-main { flex: 1 1 auto; min-width: 0; }
.pc-coupon-name { font-size: 15px; font-weight: 700; color: #333; }
.pc-coupon-type {
    display: inline-block;
    margin-left: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #ff8c00;
    background: #fff3e0;
    border-radius: 3px;
    padding: 1px 6px;
    vertical-align: middle;
}
.pc-coupon-desc { font-size: 13px; color: #666; margin-top: 2px; }
.pc-coupon-valid { font-size: 12px; color: #999; margin-top: 2px; }
.pc-coupon-amount { flex: 0 0 auto; font-size: 20px; font-weight: 700; color: #ff8c00; white-space: nowrap; }
.pc-coupon-radio {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    border: 2px solid #ced4da;
    border-radius: 50%;
    position: relative;
}
.pc-coupon-item.pc-coupon-selected .pc-coupon-radio { border-color: #ff8c00; }
.pc-coupon-item.pc-coupon-selected .pc-coupon-radio::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff8c00;
}

/* ---- 项目明细表格 ---- */
.pc-detail-table { font-size: 13px; }
.pc-detail-table thead th { background: #f1f3f5; color: #333; font-weight: 600; white-space: nowrap; border-bottom: 2px solid #dee2e6; }
.pc-detail-table tbody td { vertical-align: middle; white-space: nowrap; }
.pc-detail-table .tooth-cell { max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.pc-detail-table tfoot td { background: #fafbfc; font-weight: 700; }
/* 欠费列：双击可编辑（收银结账时患者钱不够转为欠费，缴费列联动减少） */
.pc-detail-table td.pc-owed-editable { cursor: pointer; }
.pc-detail-table td.pc-owed-editable:hover { background: #fff7e6; box-shadow: inset 0 0 0 1px #ffd591; }
.pc-detail-table .pc-owed-input {
    width: 90px;
    padding: 1px 4px;
    font-size: 13px;
    text-align: right;
    border: 1px solid #ff8c00;
    border-radius: 3px;
    outline: none;
}
.pc-detail-panel { display: none; }
/* 展开：限制最大高度并内部滚动，防止明细多时超出固定高度 Modal 视口被截断 */
.pc-detail-panel.pc-open { display: block; animation: pc-slideFade 0.25s ease; max-height: 55vh; overflow-y: auto; }
@keyframes pc-slideFade {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: none; }
}
.pc-detail-toggle .bi { transition: transform 0.2s; display: inline-block; }
.pc-detail-toggle[aria-expanded="true"] .bi { transform: rotate(180deg); }

/* ---- 错误提示条：默认隐藏（!important 压过 Bootstrap d-flex 的 display:flex !important） ---- */
.pc-error { display: none !important; }
.pc-error.pc-error-show { display: flex !important; }

/* ---- 收费结账 Modal 尺寸：与原子窗口一致（近全屏，宽 1400px、高 100vh-32px） ---- */
/* 高特异性 + !important：压过 Bootstrap modal-dialog-centered+scrollable 组合的 height:100% 覆盖；
   min-height 双保险：即使 height 被覆盖，最小高度仍撑满 */
.pc-modal .modal-dialog.modal-dialog-centered.modal-dialog-scrollable {
    max-width: 1400px;
    width: calc(100vw - 40px);
    height: calc(100vh - 32px) !important;
    min-height: calc(100vh - 32px) !important;
    max-height: calc(100vh - 32px) !important;
    margin: 16px auto !important;
}
.pc-modal .modal-dialog.modal-dialog-scrollable .modal-body {
    overflow-y: auto;
    background: #f5f6f9;
}

/* ---- 预交金支付独立弹窗（fee.md：独立操作模式） ---- */
.pc-prepaid-modal .modal-dialog {
    max-width: 420px;
    /* 位于收费结账窗口顶部向下 1/3 处（结账窗口顶部=视口16px、高度=100vh-32px） */
    margin-top: calc((100vh - 32px) / 3 + 16px) !important;
}
.pc-prepaid-modal .modal-body { background: #fff; }
.pc-prepaid-balance-line {
    background: #e7f1ff;
    border: 1px solid #9ec5fe;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 15px;
    color: #0a3a82;
}
.pc-prepaid-modal input::-webkit-outer-spin-button,
.pc-prepaid-modal input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pc-prepaid-modal input[type=number] { -moz-appearance: textfield; appearance: textfield; }

/* ---- 收银小票打印预览弹窗：用常规尺寸（不套用收费窗口的近全屏尺寸） ---- */
.pc-modal.pc-receipt-modal .modal-dialog.modal-dialog-centered.modal-dialog-scrollable {
    width: 460px;
    max-width: calc(100vw - 40px);
    height: auto !important;
    min-height: 0 !important;
    max-height: calc(100vh - 80px) !important;
    margin: 40px auto !important;
}
.pc-receipt-modal .modal-body { background: #f2f3f5; }

/* ---- 收银小票预览区：灰底 + 居中的 80mm 小票 ---- */
/* 小票内容为后端渲染的视图（print/store_receipt/0.blade.php），经 iframe.srcdoc 注入，样式与父页面隔离 */
.pc-receipt-wrap {
    display: flex;
    justify-content: center;
    padding: 16px 8px;
    background: #f2f3f5;
}
.pc-receipt-frame {
    flex: none;
    display: block;
    width: 80mm;
    max-width: 100%;
    height: 320px;
    border: 0;
    background: #fff;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.12);
}

/* ---- 医保收费单按钮：白底蓝框蓝字（与"项目详情"按钮同尺寸，位于其左侧） ---- */
.pc-modal .pc-btn-chs {
    background: #fff;
    border: 1px solid #0d6efd;
    color: #0d6efd;
    font-weight: 600;
}
.pc-modal .pc-btn-chs:hover { background: #f0f6ff; border-color: #0b5ed7; color: #0b5ed7; }

/* ---- 医保收费单预览弹窗：近全屏（同收费结账窗口尺度），内容完整可见 ---- */
.pc-modal.pc-chs-modal .modal-dialog.modal-dialog-centered.modal-dialog-scrollable {
    width: calc(100vw - 40px);
    max-width: 1400px;
    height: calc(100vh - 64px) !important;
    min-height: calc(100vh - 64px) !important;
    max-height: calc(100vh - 64px) !important;
    margin: 32px auto !important;
}
/* modal-content 撑满对话框高度：否则弹窗高度由内容决定，而内容为 iframe（无固有高度）会被压成一条 */
.pc-modal.pc-chs-modal .modal-dialog.modal-dialog-scrollable .modal-content {
    height: 100%;
}
/* 收费单内容为后端渲染的视图（print/patient/chs_detail.blade.php），经 iframe 注入，样式与父页面隔离；
   iframe 撑满弹窗内容区，收费单自身滚动 */
.pc-modal.pc-chs-modal .modal-dialog.modal-dialog-scrollable .modal-body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
    background: #f0f2f5;
}
.pc-chs-frame {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    border: 0;
    background: #f0f2f5;
}
