/* Không dùng var(): CssMin của bộ nén production xoá mọi khai báo var() có giá trị dự phòng. */
.pwa-card {
    position: fixed;
    right: 12px;
    left: 12px;
    /* pwa.js ghi đè `bottom` khi có thanh cố định ở đáy (toolbar, nút mua, nút thanh toán). */
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 1015;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    max-width: 420px;
    margin: 0 auto;
    padding: 14px 44px 14px 14px;
    border: 1px solid #e7ebf0;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18);
    color: #111c2d;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.28s ease, transform 0.28s ease;
}

.pwa-card[hidden],
.pwa-guide[hidden] {
    display: none;
}

.pwa-card.is-visible {
    opacity: 1;
    transform: none;
}

.pwa-card-logo {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border: 1px solid #eceef2;
    border-radius: 12px;
}

.pwa-card-body {
    flex: 1 1 auto;
    min-width: 0;
}

.pwa-card-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
}

.pwa-card-desc {
    margin-top: 2px;
    font-size: 13px;
    line-height: 1.45;
    color: #5b6472;
}

.pwa-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 10px;
}

.pwa-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.pwa-btn-primary {
    background: #de0204;
    color: #fff;
}

.pwa-btn-primary:hover,
.pwa-btn-primary:active {
    background: #c20103;
}

.pwa-btn-ghost {
    color: #5b6472;
}

.pwa-btn-ghost:hover,
.pwa-btn-ghost:active {
    background: #f4f5f7;
}

.pwa-btn-outline {
    width: 100%;
    border-color: #e1e4ea;
    color: #111c2d;
}

.pwa-btn-outline:hover,
.pwa-btn-outline:active {
    background: #f4f5f7;
}

.pwa-close {
    position: absolute;
    top: 4px;
    right: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #8a93a3;
    font-size: 18px;
    cursor: pointer;
}

.pwa-close:hover,
.pwa-close:active {
    background: #f4f5f7;
    color: #111c2d;
}

.pwa-btn:focus-visible,
.pwa-close:focus-visible,
.pwa-back:focus-visible {
    outline: 2px solid #111c2d;
    outline-offset: 2px;
}

.pwa-guide {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1065;
}

.pwa-guide-backdrop {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(17, 28, 45, 0.45);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.pwa-guide-panel {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    max-width: 480px;
    max-height: 88vh;
    margin: 0 auto;
    padding: 20px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 20px 20px 0 0;
    background: #fff;
    color: #111c2d;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.pwa-guide-panel:focus {
    outline: none;
}

.pwa-guide.is-visible .pwa-guide-backdrop {
    opacity: 1;
}

.pwa-guide.is-visible .pwa-guide-panel {
    transform: none;
}

.pwa-guide-head {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-right: 40px;
}

.pwa-guide-head img {
    border: 1px solid #eceef2;
    border-radius: 10px;
}

.pwa-guide-head .pwa-close {
    top: 50%;
    right: -4px;
    transform: translateY(-50%);
}

.pwa-guide-title {
    font-size: 17px;
    font-weight: 600;
}

.pwa-guide [data-pwa-for] {
    display: none;
}

.pwa-guide[data-pwa-context="ios"] [data-pwa-for~="ios"],
.pwa-guide[data-pwa-context="ios26"] [data-pwa-for~="ios26"],
.pwa-guide[data-pwa-context="ipad"] [data-pwa-for~="ipad"],
.pwa-guide[data-pwa-context="ios-other"] [data-pwa-for~="ios-other"],
.pwa-guide[data-pwa-context="android"] [data-pwa-for~="android"],
.pwa-guide[data-pwa-context="inapp"] [data-pwa-for~="inapp"] {
    display: block;
}

.pwa-steps {
    margin: 0 0 12px;
    padding: 0;
    list-style: none;
}

.pwa-steps li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    font-size: 14px;
    line-height: 1.5;
}

.pwa-steps li + li {
    border-top: 1px solid #f0f1f4;
}

.pwa-step-icon {
    flex: 0 0 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fdebeb;
    color: #de0204;
    font-size: 17px;
}

/* Cùng màu xanh hệ thống của Safari để khách nhận ra đúng biểu tượng trên thanh công cụ. */
.pwa-step-icon-share {
    background: #e8f1ff;
    color: #007aff;
}

.pwa-note {
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #f4f5f7;
    font-size: 13px;
    line-height: 1.5;
    color: #5b6472;
}

.pwa-note-warn {
    background: #fff6e5;
    color: #7a5200;
}

.pwa-copy {
    margin-bottom: 12px;
}

.pwa-copy-hint {
    margin: 0 0 8px;
    font-size: 13px;
    color: #5b6472;
}

.pwa-copy-url {
    width: 100%;
    margin-top: 8px;
    padding: 10px 12px;
    border: 1px solid #e1e4ea;
    border-radius: 10px;
    font-size: 14px;
    color: #111c2d;
    -webkit-user-select: all;
    user-select: all;
}

.pwa-copy-status {
    min-height: 1em;
    margin: 6px 0 0;
    font-size: 13px;
    color: #2e7d32;
}

.pwa-copy-status.is-error {
    color: #b42318;
}

.pwa-guide-done {
    width: 100%;
}

body.pwa-guide-open {
    overflow: hidden;
}

.menu-footer-pwa:not(.d-none) + .menu-footer {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

/* Nút quay lại chỉ chèn ở chế độ standalone trên iOS, nơi không có nút quay lại của hệ thống. */
.pwa-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-right: 8px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: #f4f5f7;
    color: #111c2d;
    font-size: 18px;
    cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
    .pwa-card,
    .pwa-guide-backdrop,
    .pwa-guide-panel {
        transition: none;
    }

    .pwa-card {
        transform: none;
    }
}
