/* ==========================================================================
   澳洲鼎点 · 优惠券票面设计系统 (Coupon Ticket Design System)
   --------------------------------------------------------------------------
   用于：优惠大厅卡片 / 券详情 / 会员发布预览 / 电子券（打印+下载）/ 核销台。
   设计要点：
     · 齿纹撕口（serrated tear edge）—— 用 SVG 三角锯齿叠层实现，不依赖 mask，
       因此打印（Chrome print）与 html2canvas 截图都能 1:1 还原。
     · 两侧冲孔（punch holes）—— 票面经典元素。
     · 三套配色主题：折扣(绿) / 立减(金) / 赠品(紫)，由 .tk-theme-* 切换。
     · 金额一律 font-variant-numeric: tabular-nums，避免数字跳动。
   注意：刻意不使用 background-clip:text / mask / clip-path / filter:blur，
        以保证 PDF/PNG 导出与打印一致。
   ========================================================================== */

:root {
    /* 中性色板 */
    --tk-ink:        #0f172a;
    --tk-ink-2:      #334155;
    --tk-muted:      #64748b;
    --tk-line:       #e2e8f0;
    --tk-surface:    #ffffff;
    --tk-canvas:     #f1f5f9;

    /* 主题默认（折扣 · 品牌绿） */
    --tk-c1:         #047857;
    --tk-c2:         #10b981;
    --tk-c3:         #34d399;
    --tk-ink-on:     #ffffff;
}

/* ---------- 主题：折扣（绿） ---------- */
.tk-theme-percent {
    --tk-c1: #047857;
    --tk-c2: #10b981;
    --tk-c3: #34d399;
}

/* ---------- 主题：立减金额（金） ---------- */
.tk-theme-amount {
    --tk-c1: #b45309;
    --tk-c2: #f59e0b;
    --tk-c3: #fcd34d;
}

/* ---------- 主题：免费赠送（紫） ---------- */
.tk-theme-freebie {
    --tk-c1: #6d28d9;
    --tk-c2: #8b5cf6;
    --tk-c3: #c4b5fd;
}

/* ==========================================================================
   1. 票卡容器
   ========================================================================== */
.tk {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--tk-surface);
    border-radius: 20px;
    overflow: hidden;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, .04),
        0 12px 28px -12px rgba(15, 23, 42, .22);
    color: var(--tk-ink);
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: antialiased;
}

/* 顶部一条极细的高光，模拟烫金/覆膜边 */
.tk::after {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, var(--tk-c1), var(--tk-c3) 45%, var(--tk-c2) 70%, var(--tk-c1));
    opacity: .9;
    z-index: 3;
}

/* ==========================================================================
   2. 票头（彩色面）
   ========================================================================== */
.tk-head {
    position: relative;
    padding: 22px 20px 26px;
    background: linear-gradient(135deg, var(--tk-c1) 0%, var(--tk-c2) 62%, var(--tk-c3) 100%);
    color: var(--tk-ink-on);
    text-align: center;
    overflow: hidden;
}

/* 票头斜纹装饰（齿条纹质感） */
.tk-head::before {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        115deg,
        rgba(255, 255, 255, .10) 0 2px,
        rgba(255, 255, 255, 0)  2px 9px
    );
    pointer-events: none;
}

/* 右上角柔光 */
.tk-head::after {
    content: "";
    position: absolute;
    top: -60%;
    right: -25%;
    width: 78%;
    height: 190%;
    background: radial-gradient(closest-side, rgba(255, 255, 255, .30), rgba(255, 255, 255, 0));
    transform: rotate(-18deg);
    pointer-events: none;
}

.tk-head > * { position: relative; z-index: 1; }

/* LOGO */
.tk-logo {
    width: 58px;
    height: 58px;
    object-fit: cover;
    border-radius: 14px;
    background: #fff;
    padding: 3px;
    margin: 0 auto 10px;
    display: block;
    box-shadow: 0 6px 16px rgba(15, 23, 42, .22);
}

.tk-business {
    font-size: .82rem;
    letter-spacing: .04em;
    opacity: .95;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.tk-title {
    font-weight: 700;
    font-size: 1.08rem;
    line-height: 1.35;
    margin: 4px 0 12px;
    text-shadow: 0 1px 2px rgba(15, 23, 42, .18);
}

/* 券面大额 */
.tk-value {
    font-size: 3.1rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.02em;
    text-shadow: 0 2px 10px rgba(15, 23, 42, .25);
}

.tk-value-sm { font-size: 2.2rem; }

.tk-sub {
    font-size: .86rem;
    opacity: .96;
    margin-top: 6px;
}

/* 类型小标签（票面右上角） */
.tk-ribbon {
    position: absolute;
    top: 12px;
    right: -34px;
    transform: rotate(38deg);
    background: rgba(255, 255, 255, .22);
    color: #fff;
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .14em;
    padding: 4px 40px;
    border-top: 1px solid rgba(255, 255, 255, .38);
    border-bottom: 1px solid rgba(255, 255, 255, .38);
    z-index: 2;
}

/* ==========================================================================
   3. 齿纹撕口 + 冲孔
   ========================================================================== */
/* 虚线撕口条 */
.tk-perf {
    position: relative;
    height: 22px;
    background: var(--tk-surface);
    z-index: 2;
}

.tk-perf::before {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    top: 50%;
    border-top: 2px dashed rgba(100, 116, 139, .42);
}

/* 齿纹：白色三角锯齿压在票头底边，视觉上"撕"出锯齿 */
.tk-serration {
    position: absolute;
    left: 0;
    right: 0;
    top: -11px;
    height: 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='12' viewBox='0 0 24 12'%3E%3Cpath d='M0 12 L6 0 L12 12 Z' fill='%23ffffff'/%3E%3Cpath d='M12 12 L18 0 L24 12 Z' fill='%23ffffff'/%3E%3C/svg%3E");
    background-size: 24px 12px;
    background-repeat: repeat-x;
    pointer-events: none;
    z-index: 2;
}

/* 冲孔（左右各一） */
.tk-punch {
    position: absolute;
    top: 50%;
    width: 22px;
    height: 22px;
    margin-top: -11px;
    border-radius: 50%;
    background: var(--tk-surface);
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .07);
    z-index: 3;
}
.tk-punch-l { left: -11px; }
.tk-punch-r { right: -11px; }

/* 冲孔在彩头上呈现为"缺口"效果时用的深色描边版 */
.tk-punch-hollow {
    background: transparent;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .55);
}

/* ==========================================================================
   4. 票身（白色信息区）
   ========================================================================== */
.tk-body {
    padding: 4px 20px 18px;
    text-align: center;
}

.tk-meta {
    font-size: .8rem;
    color: var(--tk-muted);
    line-height: 1.85;
}

.tk-meta b { color: var(--tk-ink-2); font-weight: 600; }

/* 条码 */
.tk-barcode {
    width: 100%;
    max-width: 300px;
    height: auto;
    margin: 2px auto 4px;
    display: block;
}

/* 9 位券号 */
.tk-code {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: .42em;
    text-indent: .42em;
    color: var(--tk-ink);
}

/* 状态章 */
.tk-stamp {
    display: inline-block;
    margin-top: 12px;
    padding: 5px 16px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .04em;
    color: #fff;
    background: #1d4ed8;
}
.tk-stamp-redeemed { background: var(--tk-c1); }
.tk-stamp-void     { background: #94a3b8; }

.tk-foot {
    text-align: center;
    color: #94a3b8;
    font-size: .7rem;
    padding: 0 16px 16px;
    line-height: 1.6;
}

/* 虚线分隔的小节 */
.tk-divider {
    height: 1px;
    background: repeating-linear-gradient(90deg, var(--tk-line) 0 6px, transparent 6px 12px);
    margin: 12px 0;
}

/* ==========================================================================
   5. 迷你票面（列表 / 卡片用）
   ========================================================================== */
.tk-mini {
    position: relative;
    min-width: 92px;
    padding: 12px 10px;
    border-radius: 14px;
    background: linear-gradient(150deg, var(--tk-c1), var(--tk-c2));
    color: #fff;
    text-align: center;
    overflow: hidden;
    flex-shrink: 0;
}

.tk-mini::before {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(115deg, rgba(255,255,255,.12) 0 2px, transparent 2px 8px);
}

.tk-mini > * { position: relative; z-index: 1; }

.tk-mini .n {
    font-size: 1.45rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.01em;
}

.tk-mini .s { font-size: .66rem; opacity: .94; margin-top: 3px; }

/* 迷你票右侧齿纹 */
.tk-mini-notch {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 8px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='16' viewBox='0 0 8 16'%3E%3Cpath d='M8 0 L0 4 L8 8 Z' fill='%23ffffff'/%3E%3Cpath d='M8 8 L0 12 L8 16 Z' fill='%23ffffff'/%3E%3C/svg%3E");
    background-size: 8px 16px;
    background-repeat: repeat-y;
    opacity: .9;
}

/* ==========================================================================
   6. 横向票面（大图 / 详情头）
   ========================================================================== */
.tk-row { display: flex; align-items: stretch; }

.tk-row .tk-head {
    flex: 1 1 46%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 26px 22px 30px;
}

.tk-row .tk-perf {
    flex: 0 0 22px;
    width: 22px;
    height: auto;
    background: var(--tk-surface);
}

/* 竖向撕口：把水平锯齿旋转成竖直 */
.tk-row .tk-serration {
    top: 0;
    bottom: 0;
    left: -11px;
    right: auto;
    width: 12px;
    height: auto;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='24' viewBox='0 0 12 24'%3E%3Cpath d='M12 0 L0 6 L12 12 Z' fill='%23ffffff'/%3E%3Cpath d='M12 12 L0 18 L12 24 Z' fill='%23ffffff'/%3E%3C/svg%3E");
    background-size: 12px 24px;
    background-repeat: repeat-y;
}

.tk-row .tk-body {
    flex: 1 1 54%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 22px 22px 18px;
    text-align: left;
}

@media (max-width: 640px) {
    .tk-row { flex-direction: column; }
    .tk-row .tk-perf { flex: 0 0 22px; width: 100%; height: 22px; }
    .tk-row .tk-serration {
        top: -11px; left: 0; right: 0; bottom: auto;
        width: auto; height: 12px;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='12' viewBox='0 0 24 12'%3E%3Cpath d='M0 12 L6 0 L12 12 Z' fill='%23ffffff'/%3E%3Cpath d='M12 12 L18 0 L24 12 Z' fill='%23ffffff'/%3E%3C/svg%3E");
        background-size: 24px 12px;
        background-repeat: repeat-x;
    }
    .tk-row .tk-body { text-align: center; }
}

/* ==========================================================================
   7. 状态 / 库存 标签
   ========================================================================== */
.tk-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .72rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    background: #ecfdf5;
    color: #047857;
    white-space: nowrap;
}
.tk-pill-out { background: #f1f5f9; color: #94a3b8; }
.tk-pill-blue { background: #eff6ff; color: #1d4ed8; }
.tk-pill-warn { background: #fff7ed; color: #c2410c; }
.tk-pill-mute { background: #f8fafc; color: #64748b; }

/* ==========================================================================
   8. 工具条（打印 / 下载）
   ========================================================================== */
.tk-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 18px;
}

.tk-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    cursor: pointer;
    font-size: .86rem;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 999px;
    color: #fff;
    background: linear-gradient(135deg, var(--tk-c1), var(--tk-c2));
    box-shadow: 0 6px 16px -6px rgba(15, 23, 42, .45);
    transition: transform .12s ease, box-shadow .12s ease, opacity .12s;
}
.tk-btn:hover { transform: translateY(-1px); }
.tk-btn:active { transform: translateY(0); }
.tk-btn[disabled] { opacity: .55; cursor: progress; transform: none; }

.tk-btn-ghost {
    background: #fff;
    color: var(--tk-ink-2);
    border: 1px solid var(--tk-line);
    box-shadow: 0 4px 12px -6px rgba(15, 23, 42, .3);
}

/* ==========================================================================
   9. 打印样式
   ========================================================================== */
@media print {
    .tk {
        box-shadow: none;
        border: 1px solid #d8dee9;
        break-inside: avoid;
    }
    .tk-head { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .tk-head::before,
    .tk-head::after { display: none; }
    .tk-no-print { display: none !important; }
}
