/* Thông báo nổi ở góc màn hình (xem Content/js/popup-notices.js).
   Máy tính: góc trái phía dưới, trượt vào từ bên trái. Điện thoại: thẻ nằm phía trên, rộng hết chiều ngang, trượt xuống từ trên.
   Hiệu ứng: nảy khi vào, viền chạy màu, ánh sáng quét ngang, vòng sáng nhấp nháy quanh hình, thanh đếm ngược và chấm báo vị trí. */
.pn-card {
    /* phông cố định: tránh chuyển sang Arial Black (thiếu dấu tiếng Việt) khi dùng chữ quá đậm */
    font-family: "Roboto", "Segoe UI", Tahoma, Arial, sans-serif;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    position: fixed;
    left: 14px;
    bottom: 16px;
    z-index: 1040;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 320px;
    max-width: calc(100vw - 28px);
    box-sizing: border-box;
    padding: 10px 12px 10px 10px;
    overflow: hidden;
    border: 2px solid transparent;
    border-radius: 14px;
    /* nền trắng + viền chuyển màu chạy vòng */
    background:
        linear-gradient(#ffffff, #ffffff) padding-box,
        linear-gradient(90deg, #f97316, #ef4444, #f59e0b, #22c55e, #f97316) border-box;
    background-size: 100% 100%, 300% 100%;
    box-shadow: 0 10px 30px rgba(249, 115, 22, 0.28), 0 4px 12px rgba(15, 23, 42, 0.15);
    opacity: 0;
    transform: translateX(-130%);
    will-change: transform, opacity;
}

.pn-card.pn-multi {
    padding-bottom: 24px;
}

.pn-card.pn-show {
    animation: pnIn .65s cubic-bezier(.2, .9, .3, 1) forwards, pnBorder 3.5s linear infinite;
}

.pn-card.pn-leave {
    animation: pnOut .45s ease-in forwards, pnBorder 3.5s linear infinite;
}

/* ánh sáng quét ngang qua thẻ */
.pn-card::after {
    content: "";
    position: absolute;
    top: 0;
    left: -70%;
    width: 40%;
    height: 100%;
    background: linear-gradient(100deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0));
    transform: skewX(-20deg);
    animation: pnShine 3.4s ease-in-out 1s infinite;
    pointer-events: none;
}

.pn-body {
    display: flex;
    align-items: center;
    align-self: stretch;
    gap: 12px;
    flex: 1;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

a.pn-body:hover,
a.pn-body:focus {
    color: inherit;
    text-decoration: none;
}

.pn-imgwrap {
    position: relative;
    flex: none;
    width: 64px;
    height: 64px;
    border: 1px solid #fed7aa;
    border-radius: 12px;
    background: #ffffff;
    overflow: hidden;
}

/* hình sản phẩm: hiện trọn hình (không cắt xén), nền trắng */
.pn-img {
    display: block;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    padding: 3px;
    object-fit: contain;
    transform-origin: 50% 80%;
    animation: pnWiggle 4.2s ease-in-out 1.4s infinite;
}

.pn-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}

/* có dòng giá thì mô tả chỉ một dòng cho thẻ gọn */
.pn-has-meta .pn-desc {
    -webkit-line-clamp: 1;
}

.pn-title {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    color: #111827;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pn-desc {
    font-size: 11.5px;
    line-height: 1.35;
    color: #6b7280;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pn-close {
    font-family: inherit;
    position: relative;
    z-index: 2;
    flex: none;
    width: 24px;
    height: 24px;
    padding: 0;
    margin: -3px -4px 0 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #6b7280;
    font-size: 21px;
    line-height: 1;
    cursor: pointer;
}

.pn-close:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* chấm báo vị trí */
.pn-dots {
    position: absolute;
    right: 12px;
    bottom: 7px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.pn-dot {
    width: 6px;
    height: 6px;
    border-radius: 3px;
    background: #e5e7eb;
    transition: width .25s ease, background .25s ease;
}

.pn-dot.on {
    width: 14px;
    background: #f97316;
}

/* thanh đếm ngược; hết thanh thì chuyển thông báo kế */
.pn-bar {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #f97316, #ef4444);
    transform-origin: left center;
    animation-name: pnBar;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

.pn-card:hover .pn-bar,
.pn-card.pn-paused .pn-bar {
    animation-play-state: paused;
}

@keyframes pnIn {
    0% { transform: translateX(-130%) rotate(-5deg); opacity: 0; }
    55% { transform: translateX(10px) rotate(1.5deg); opacity: 1; }
    78% { transform: translateX(-4px) rotate(-.6deg); }
    100% { transform: translateX(0) rotate(0); opacity: 1; }
}

@keyframes pnOut {
    0% { transform: translateX(0); opacity: 1; }
    100% { transform: translateX(-130%) rotate(-4deg); opacity: 0; }
}

@keyframes pnInTop {
    0% { transform: translateY(-150%) scale(.96); opacity: 0; }
    60% { transform: translateY(8px) scale(1.01); opacity: 1; }
    80% { transform: translateY(-3px); }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes pnOutTop {
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(-150%); opacity: 0; }
}

@keyframes pnBorder {
    0% { background-position: 0 0, 0 0; }
    100% { background-position: 0 0, 300% 0; }
}

@keyframes pnShine {
    0%, 55% { left: -70%; }
    100% { left: 140%; }
}

@keyframes pnWiggle {
    0%, 88%, 100% { transform: rotate(0) scale(1); }
    90% { transform: rotate(-8deg) scale(1.06); }
    93% { transform: rotate(7deg) scale(1.06); }
    96% { transform: rotate(-4deg) scale(1.03); }
}

@keyframes pnBar {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

@media (max-width: 767px) {
    .pn-card {
        left: 10px;
        right: 10px;
        top: 64px;
        bottom: auto;
        width: auto;
        max-width: none;
        transform: translateY(-150%);
    }
    .pn-card.pn-show {
        animation: pnInTop .6s cubic-bezier(.2, .9, .3, 1) forwards, pnBorder 3.5s linear infinite;
    }
    .pn-card.pn-leave {
        animation: pnOutTop .4s ease-in forwards, pnBorder 3.5s linear infinite;
    }
    /* ngón tay chạm: nút đóng to hơn */
    .pn-close {
        width: 36px;
        height: 36px;
        margin: -6px -8px 0 0;
        font-size: 26px;
    }
}

/* Người dùng tắt chuyển động: bỏ hiệu ứng, chỉ hiện / ẩn */
@media (prefers-reduced-motion: reduce) {
    .pn-card,
    .pn-card::after,
    .pn-imgwrap,
    .pn-img,
    .pn-bar {
        animation: none !important;
    }
    .pn-card.pn-show {
        opacity: 1;
        transform: none;
    }
    .pn-card.pn-leave {
        opacity: 0;
    }
}

/* Giá + nhãn KM: cùng màu / kiểu với thẻ sản phẩm ở trang chủ */
.pn-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px 8px;
    margin-top: 2px;
}

.pn-price {
    color: #ea580c;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}

.pn-old {
    color: #94a3b8;
    font-size: 11px;
    font-weight: 400;
}

.pn-lock {
    color: #1a5740;
    font-size: 11px;
    font-weight: 600;
}

.pn-km {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 6px;
    border-radius: 4px;
    background: #ffffff;
    color: #111827;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
