/* =====================================================================
   pwa-install.css — شريط وورقة تثبيت التطبيق (S540 — pwa-install.js)
   ---------------------------------------------------------------------
   توكنز base.css/dark.css فقط (‏--bg-main · --text-main · --primary…) والخصائص
   المنطقية للاتجاهين، وأهداف لمس ≥ 44px. الشريط مثبّت أسفل الشاشة فوق
   تراكم يخصّه (--z-sticky=100 يعلو المحتوى ودون المودالات) وأُزاح عن
   الحافة السفلية على الشاشات الضيقة كي لا يغطّي الزرّ العائم
   (bottom:24px + لوحته) ولا صفوف الإجراءات السفلية.
   ===================================================================== */

/* ---- الشريط اللصيق ---- */
.pwi-banner {
    position: fixed;
    inset-inline: 16px;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    z-index: var(--z-sticky, 100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 14px;
    border: 1px solid var(--border-main);
    background: var(--bg-main);
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
}

.pwi-banner.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.pwi-banner-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.55;
}

.pwi-banner-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.pwi-btn-install {
    min-height: 44px;
    padding: 8px 16px;
    border: 0;
    border-radius: 10px;
    background: var(--primary);
    color: var(--on-primary);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.pwi-btn-install:hover {
    background: var(--primary-hover);
}

.pwi-btn-close {
    min-inline-size: 44px;
    min-block-size: 44px;
    border: 0;
    border-radius: 10px;
    background: none;
    color: var(--text-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.pwi-btn-close:hover {
    background: var(--light-primary);
}

/* على الشاشات الضيّقة: الشريط يلتفّ على سطرين في أسفل الشاشة، ولسان
   الألوان الملتصق بالحافة يرتفع فوقه ما دام ظاهراً (القاعدة أدناه). */
@media (max-width: 768px) {
    .pwi-banner {
        inset-inline: 10px;
        bottom: calc(24px + env(safe-area-inset-bottom, 0px));
        flex-wrap: wrap;
    }

    .pwi-banner-text {
        flex: 1 1 100%;
    }
}

/* ---- ورقة التثبيت ---- */
.pwi-sheet {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal, 1000);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(15, 23, 42, .45);
    opacity: 0;
    transition: opacity .2s ease;
}

.pwi-sheet.is-open {
    opacity: 1;
}

/* زرّ التخصيص العائم (--z-tool-fab فوق كل الأوراق عمداً) يغطّي نصّ الورقة
   على الجوال — يُخفى ما دامت ورقة التثبيت مفتوحة. */
body:has(.pwi-sheet.is-open) .color-fab {
    visibility: hidden;
}

/* لسان الألوان ملتصق بأسفل الحافة (bottom 16–20px) فيتقاطع مع الشريط
   الممتدّ أسفل الشاشة — يرتفع فوقه ما دام الشريط ظاهراً (سطر واحد على
   الواسع ≈64px، وسطران على الجوال ≈115px). */
body:has(.pwi-banner.is-open) .color-fab:not([hidden]) {
    bottom: calc(100px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 768px) {
    body:has(.pwi-banner.is-open) .color-fab:not([hidden]) {
        bottom: calc(160px + env(safe-area-inset-bottom, 0px));
    }
}

.pwi-sheet-card {
    width: 100%;
    max-width: 440px;
    max-height: 86vh;
    overflow-y: auto;
    background: var(--bg-main);
    border-radius: 18px 18px 0 0;
    box-shadow: var(--shadow-lg);
    transform: translateY(24px);
    transition: transform .2s ease;
}

.pwi-sheet.is-open .pwi-sheet-card {
    transform: translateY(0);
}

.pwi-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 18px 10px;
    border-block-end: 1px solid var(--border-main);
}

.pwi-sheet-head h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 800;
    color: var(--text-main);
}

.pwi-sheet-close {
    min-inline-size: 44px;
    min-block-size: 44px;
    border: 0;
    border-radius: 10px;
    background: none;
    color: var(--text-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.pwi-sheet-close:hover {
    background: var(--light-primary);
}

.pwi-sheet-body {
    padding: 14px 18px calc(18px + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pwi-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    counter-reset: pwi-step;
}

.pwi-steps li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border-main);
    border-radius: 12px;
    background: var(--light-primary);
    counter-increment: pwi-step;
    position: relative;
    color: var(--text-main);
    font-size: 14px;
    font-weight: 600;
}

.pwi-steps li svg {
    flex-shrink: 0;
    color: var(--primary);
}

.pwi-steps li::before {
    content: counter(pwi-step);
    position: absolute;
    inset-inline-start: -11px;
    inset-block-start: -9px;
    inline-size: 22px;
    block-size: 22px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--on-primary);
    font-size: 12px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pwi-sheet-install {
    min-height: 48px;
    border: 0;
    border-radius: 12px;
    background: var(--primary);
    color: var(--on-primary);
    font: inherit;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
}

.pwi-sheet-install:hover {
    background: var(--primary-hover);
}

.pwi-hint {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
    text-align: center;
}

/* على الواسع: بطاقة وسطية لا ورقة سفلية */
@media (min-width: 640px) {
    .pwi-sheet {
        align-items: center;
        padding: 20px;
    }

    .pwi-sheet-card {
        border-radius: 16px;
    }
}
