/* Popup "Cài ứng dụng" (PWA) — partial _InstallAppModal, load trong _HomeLayout. */

body.iapp-locked { overflow: hidden; }

.home-page .iapp-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000; /* trên nút feedback nổi (9990–9999) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(25, 28, 30, .55);
    animation: iapp-fade .2s ease-out;
}

/* [hidden] cùng độ ưu tiên với display:flex ở trên — phải khai báo riêng, không thì popup hiện sẵn. */
.home-page .iapp-backdrop[hidden],
.home-page .iapp-modal [hidden] { display: none !important; }

.home-page .iapp-modal {
    position: relative;
    width: min(440px, 100%);
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    padding: 28px 24px 20px;
    border-radius: var(--radius-lg);
    background: var(--surface-lowest);
    box-shadow: 0 20px 50px rgba(0, 32, 102, .18);
    text-align: center;
    color: var(--on-surface);
    animation: iapp-pop .25s cubic-bezier(.2, .9, .3, 1.2);
}

.home-page .iapp-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 9999px;
    background: var(--surface-container);
    color: var(--on-surface-variant);
    cursor: pointer;
}
.home-page .iapp-close .material-symbols-outlined { font-size: 20px; }

.home-page .iapp-hero {
    position: relative;
    width: 96px;
    height: 96px;
    margin: 4px auto 14px;
}
.home-page .iapp-hero-icon {
    width: 96px;
    height: 96px;
    border-radius: 22px;
    box-shadow: 0 8px 24px rgba(0, 32, 102, .18);
}
.home-page .iapp-hero-mascot {
    position: absolute;
    right: -34px;
    bottom: -10px;
    width: 56px;
    height: auto;
}

.home-page .iapp-modal h3 {
    margin: 0 0 6px;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
}

.home-page .iapp-desc {
    margin: 0 0 16px;
    font-size: .9rem;
    line-height: 1.5;
    color: var(--on-surface-variant);
}

.home-page .iapp-benefits {
    list-style: none;
    margin: 0 0 18px;
    padding: 12px 14px;
    border-radius: var(--radius);
    background: var(--surface);
    text-align: left;
}
.home-page .iapp-benefits li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
    font-size: .875rem;
}
.home-page .iapp-benefits .material-symbols-outlined {
    font-size: 20px;
    color: var(--secondary);
    flex-shrink: 0;
}

.home-page .iapp-install-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-bottom: 18px;
    padding: 13px 16px;
    border: none;
    border-radius: 9999px;
    background: var(--primary);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}
.home-page .iapp-install-btn:hover { filter: brightness(1.1); }

.home-page .iapp-installed {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 18px;
    padding: 12px;
    border-radius: var(--radius);
    background: #e7f7ee;
    color: #146c3a;
    font-weight: 600;
    font-size: .9rem;
}

.home-page .iapp-guide { text-align: left; }

.home-page .iapp-guide-title {
    margin-bottom: 8px;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--on-surface-variant);
}

.home-page .iapp-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    border-radius: 9999px;
    background: var(--surface-container);
}
.home-page .iapp-tab {
    flex: 1;
    padding: 7px 6px;
    border: none;
    border-radius: 9999px;
    background: transparent;
    color: var(--on-surface-variant);
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.home-page .iapp-tab.is-active {
    background: var(--surface-lowest);
    color: var(--primary);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

.home-page .iapp-steps {
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
    counter-reset: iapp-step;
}
.home-page .iapp-steps li {
    position: relative;
    padding: 6px 0 6px 36px;
    font-size: .875rem;
    line-height: 1.55;
    counter-increment: iapp-step;
}
.home-page .iapp-steps li::before {
    content: counter(iapp-step);
    position: absolute;
    left: 0;
    top: 5px;
    width: 24px;
    height: 24px;
    border-radius: 9999px;
    background: var(--primary);
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
    line-height: 24px;
    text-align: center;
}

.home-page .iapp-kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin: 0 2px;
    border: 1px solid var(--outline-variant);
    border-radius: 6px;
    background: var(--surface);
    color: var(--primary);
    font-size: 16px;
    vertical-align: middle;
}

.home-page .iapp-footer {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 18px;
}
.home-page .iapp-later,
.home-page .iapp-never {
    padding: 8px 16px;
    border: none;
    border-radius: 9999px;
    background: transparent;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
}
.home-page .iapp-later { background: var(--surface-container); color: var(--on-surface); }
.home-page .iapp-never { color: var(--on-surface-variant); }
.home-page .iapp-never:hover { text-decoration: underline; }

/* Mobile: trượt lên từ dưới như bottom sheet cho dễ bấm. */
@media (max-width: 575px) {
    .home-page .iapp-backdrop { align-items: flex-end; padding: 0; }
    .home-page .iapp-modal {
        width: 100%;
        max-height: 92vh;
        max-height: 92dvh;
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        animation: iapp-sheet .28s ease-out;
    }
}

@keyframes iapp-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes iapp-pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }
@keyframes iapp-sheet { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* Mục "Cài ứng dụng" trên menu avatar bị ẩn khi đang chạy trong app đã cài. */
.home-page .hp-account-item[hidden] { display: none; }
