/* =========================================================================
   PWA Install — modern, brand-aligned styling
   Brand colors: --pwa-blue #07639d, --pwa-gold #E8BA00
   ========================================================================= */

:root {
    --pwa-blue: #07639d;
    --pwa-blue-dark: #054b78;
    --pwa-blue-soft: #e8f1f9;
    --pwa-gold: #E8BA00;
    --pwa-gold-soft: #fff6d6;
    --pwa-ink: #0f2c44;
    --pwa-ink-soft: #4a5b6e;
    --pwa-line: #d6e6f5;
}

/* ---------- Install Button ---------- */
.pwa-install-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .2px;
    line-height: 1;
    border-radius: 999px;
    border: 0;
    color: #fff;
    background: linear-gradient(135deg, var(--pwa-blue) 0%, #0a85cf 100%);
    box-shadow: 0 6px 16px rgba(7, 99, 157, .25);
    cursor: pointer;
    text-decoration: none;
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease, filter .18s ease;
    position: relative;
    overflow: hidden;
}

.pwa-install-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, .18) 50%, transparent 100%);
    transform: translateX(-100%);
    transition: transform .6s ease;
}

.pwa-install-btn:hover {
    box-shadow: 0 10px 22px rgba(7, 99, 157, .32);
    transform: translateY(-1px);
    filter: brightness(1.04);
    color: #fff;
}

.pwa-install-btn:hover::before {
    transform: translateX(100%);
}

.pwa-install-btn:focus-visible {
    outline: 3px solid rgba(232, 186, 0, .55);
    outline-offset: 2px;
}

.pwa-install-btn i {
    font-size: 14px;
}

.pwa-install-btn[hidden] {
    display: none !important;
}

/* Gold variant */
.pwa-install-btn--gold {
    background: linear-gradient(135deg, var(--pwa-gold) 0%, #f0cd40 100%);
    box-shadow: 0 6px 16px rgba(232, 186, 0, .3);
    color: #2b1f00;
}

.pwa-install-btn--gold:hover {
    box-shadow: 0 10px 22px rgba(232, 186, 0, .38);
    color: #2b1f00;
}

/* Footer use */
.footer-legal .pwa-install-btn {
    margin-inline-start: 8px;
    padding: 8px 14px;
}

.pwa-install-sep {
    display: none;
    margin: 0 4px;
    color: inherit;
    opacity: .6;
}

.pwa-install-sep:has(+ .pwa-install-btn:not([hidden])) {
    display: inline;
}

/* ---------- Install Banner (dashboard) ----------
   Visible by default; toggled via [hidden] attribute by the dashboard
   inline script. The blade template renders the banner with `hidden`
   initially, so it stays hidden until JS opts it in. */
.pwa-install-banner {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 18px 22px;
    margin: 0 0 20px 0;
    border-radius: 18px;
    background: linear-gradient(120deg, var(--pwa-blue-soft) 0%, #ffffff 65%, var(--pwa-gold-soft) 130%);
    border: 1px solid var(--pwa-line);
    box-shadow: 0 8px 24px rgba(7, 99, 157, .07);
    position: relative;
    overflow: hidden;
    animation: pwaBannerIn .35s ease both;
}

.pwa-install-banner::after {
    content: "";
    position: absolute;
    right: -60px;
    top: -60px;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(232, 186, 0, .14) 0%, transparent 65%);
    pointer-events: none;
}

[dir="rtl"] .pwa-install-banner::after {
    right: auto;
    left: -60px;
}

@keyframes pwaBannerIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pwa-install-banner__icon {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--pwa-blue), #0a85cf);
    color: #fff;
    font-size: 22px;
    box-shadow: 0 6px 14px rgba(7, 99, 157, .28);
    position: relative;
}

.pwa-install-banner__icon::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 18px;
    border: 2px dashed rgba(232, 186, 0, .55);
    opacity: .65;
    pointer-events: none;
}

.pwa-install-banner__body {
    flex: 1 1 auto;
    min-width: 0;
}

.pwa-install-banner__title {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 800;
    color: var(--pwa-ink);
    letter-spacing: .1px;
}

.pwa-install-banner__desc {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--pwa-ink-soft);
}

.pwa-install-banner__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.pwa-install-banner[hidden] {
    display: none !important;
}

.pwa-install-banner .pwa-install-btn {
    display: inline-flex;
}

.pwa-install-banner__dismiss {
    background: transparent;
    border: 1px solid transparent;
    color: var(--pwa-ink-soft);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 999px;
    transition: background .18s ease, color .18s ease, border-color .18s ease;
}

.pwa-install-banner__dismiss:hover {
    color: var(--pwa-ink);
    background: rgba(7, 99, 157, .06);
    border-color: rgba(7, 99, 157, .12);
}

@media (max-width: 768px) {
    .pwa-install-banner {
        padding: 16px;
        gap: 12px;
    }

    .pwa-install-banner__title {
        font-size: 15px;
    }

    .pwa-install-banner__desc {
        font-size: 12.5px;
    }
}

@media (max-width: 575px) {
    .pwa-install-banner {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .pwa-install-banner__icon {
        margin: 0 auto;
    }

    .pwa-install-banner__actions {
        justify-content: center;
    }

    .pwa-install-banner .pwa-install-btn {
        flex: 1 1 auto;
    }
}

/* ---------- Stat cards specific to PWA section ---------- */
.pwa-stats-card {
    position: relative;
    border-radius: 16px;
    padding: 18px 16px;
    background: #fff;
    border: 1px solid var(--pwa-line);
    box-shadow: 0 4px 12px rgba(7, 99, 157, .05);
    text-align: center;
    transition: transform .2s ease, box-shadow .2s ease;
}

.pwa-stats-help {
    position: absolute;
    top: 8px;
    inset-inline-end: 8px;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    color: var(--pwa-blue);
    background: var(--pwa-blue-soft);
    border: 1px solid var(--pwa-line);
    cursor: pointer;
    user-select: none;
    transition: background .15s ease, color .15s ease;
}
.pwa-stats-help:hover,
.pwa-stats-help:focus,
.pwa-stats-help:focus-visible {
    color: #fff;
    background: var(--pwa-blue);
    outline: none;
}

/* Custom hover/tap tooltip — same pattern as .sd-badge-tooltip.
   Anchored to the help icon's right edge (logical: end), arrow on top.
   Visible on :hover (desktop) and :focus (mobile tap focuses the
   tabindex=0 span; tapping outside removes focus and hides it). */
.pwa-stats-help-tip {
    position: absolute;
    top: calc(100% + 10px);
    inset-inline-end: -6px;
    background: #111827;
    color: #fff;
    padding: 10px 14px;
    border-radius: 10px;
    width: max-content;
    min-width: 180px;
    max-width: 240px;
    text-align: start;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
    white-space: normal;
}
.pwa-stats-help-tip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    inset-inline-end: 12px;
    border: 6px solid transparent;
    border-bottom-color: #111827;
}
.pwa-stats-help-tip strong {
    display: block;
    font-family: 'Rubik', sans-serif;
    font-weight: 600;
    font-size: 13px;
    line-height: 1.3;
    margin-bottom: 4px;
    color: #E8BA00;
}
.pwa-stats-help-tip > span {
    display: block;
    font-family: 'Rubik', sans-serif;
    font-weight: 300;
    font-size: 12px;
    line-height: 1.45;
    color: rgba(255, 255, 255, .9);
}
.pwa-stats-help:hover .pwa-stats-help-tip,
.pwa-stats-help:focus .pwa-stats-help-tip,
.pwa-stats-help:focus-within .pwa-stats-help-tip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.pwa-stats-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(7, 99, 157, .08);
}

.pwa-stats-card__icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    border-radius: 12px;
    color: #fff;
    font-size: 18px;
    background: linear-gradient(135deg, var(--pwa-blue), #0a85cf);
    box-shadow: 0 4px 10px rgba(7, 99, 157, .22);
}

.pwa-stats-card__icon--gold {
    background: linear-gradient(135deg, var(--pwa-gold), #f0cd40);
    color: #2b1f00;
    box-shadow: 0 4px 10px rgba(232, 186, 0, .28);
}

.pwa-stats-card__value {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    color: var(--pwa-ink);
    line-height: 1.1;
}

.pwa-stats-card__label {
    margin: 4px 0 0;
    font-size: 12.5px;
    color: var(--pwa-ink-soft);
    letter-spacing: .1px;
}

/* ---------- PWA admin tables ---------- */
.pwa-admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13.5px;
}

.pwa-admin-table thead th {
    background: linear-gradient(180deg, #fbfdff 0%, #f3f8fc 100%);
    color: var(--pwa-ink);
    font-weight: 700;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: .4px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--pwa-line);
    white-space: nowrap;
}

.pwa-admin-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid #eef3f8;
    color: var(--pwa-ink);
    vertical-align: middle;
}

.pwa-admin-table tbody tr:hover td {
    background: rgba(7, 99, 157, .025);
}

/* Status pills inside admin table */
.pwa-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .2px;
    background: #eef3f8;
    color: var(--pwa-ink);
    text-transform: capitalize;
}

.pwa-status-pill::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: .65;
}

.pwa-status-pill--available {
    background: #e6f0fa;
    color: #0a85cf;
}

.pwa-status-pill--shown {
    background: #fff6d6;
    color: #8a6d00;
}

.pwa-status-pill--clicked {
    background: #e6e1ff;
    color: #4b3fa6;
}

.pwa-status-pill--accepted {
    background: #d9f5e3;
    color: #1e8a4d;
}

.pwa-status-pill--dismissed {
    background: #fde2e2;
    color: #b3261e;
}

.pwa-status-pill--installed {
    background: #cdebd6;
    color: #166c3a;
}

/* Compact key/value list (browser, device) */
.pwa-kv-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.pwa-kv-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 4px;
    border-bottom: 1px solid #eef3f8;
    font-size: 13.5px;
    color: var(--pwa-ink);
}

.pwa-kv-list li:last-child {
    border-bottom: 0;
}

.pwa-kv-list li strong {
    color: var(--pwa-blue);
    font-weight: 800;
}