/* =====================================================
   NEXT — PWA STYLES (Pinterest-style)
   ===================================================== */

/* =====================================================
   PWA INSTALL BANNER — Bottom Sheet Style
   ===================================================== */

.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;

    display: flex;
    justify-content: center;
    pointer-events: none;

    padding: 0;
    transform: translateY(100%);
    transition: transform 500ms cubic-bezier(0.16, 1, 0.3, 1);
}

.pwa-install-banner.visible {
    transform: translateY(0);
    pointer-events: auto;
}


/* =====================================================
   INNER — البطاقة الفعلية
   ===================================================== */

.pwa-install-content {
    position: relative;

    width: min(100%, 480px);
    margin: 0 16px;

    display: flex;
    align-items: flex-start;
    gap: 16px;

    padding: 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom, 20px));

    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: saturate(180%) blur(30px);
    -webkit-backdrop-filter: saturate(180%) blur(30px);

    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    border: 1px solid rgba(229, 231, 235, 0.6);
    border-bottom: 0;

    box-shadow:
        0 -8px 32px -8px rgba(17, 24, 39, 0.12),
        0 -2px 8px -2px rgba(17, 24, 39, 0.06);
}


/* =====================================================
   PWA ICON — مع تأثير Gradient
   ===================================================== */

.pwa-install-icon {
    position: relative;
    width: 56px;
    height: 56px;
    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    background: linear-gradient(135deg, #2563EB 0%, #3B82F6 50%, #1D4ED8 100%);
    background-size: 200% 200%;
    animation: gradientMove 4s ease infinite;

    border-radius: 14px;
    color: #FFFFFF;

    box-shadow:
        0 8px 20px -6px rgba(37, 99, 235, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

@keyframes gradientMove {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

.pwa-install-icon::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 16px;
    background: inherit;
    opacity: 0.3;
    filter: blur(8px);
    z-index: -1;
}

.pwa-install-icon-update {
    background: linear-gradient(135deg, #16A34A 0%, #22C55E 100%);
    box-shadow:
        0 8px 20px -6px rgba(22, 163, 74, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
}


/* =====================================================
   PWA TEXT
   ===================================================== */

.pwa-install-text {
    flex: 1;
    min-width: 0;
    padding-top: 2px;
}

.pwa-install-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--next-ink, #111827);
    line-height: 1.4;
    margin-bottom: 4px;
    letter-spacing: -0.015em;
}

.pwa-install-subtitle {
    font-size: 13px;
    font-weight: 500;
    color: var(--next-muted, #6B7280);
    line-height: 1.55;
}


/* =====================================================
   PWA ACTIONS
   ===================================================== */

.pwa-install-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
    padding-top: 2px;
}

.pwa-install-button {
    height: 40px;
    padding: 0 20px;
    border-radius: 12px;

    background: linear-gradient(135deg, #2563EB 0%, #3B82F6 100%);
    border: 0;
    color: #FFFFFF;

    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;

    box-shadow:
        0 6px 16px -4px rgba(37, 99, 235, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);

    transition:
        transform 200ms cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.pwa-install-button:hover {
    transform: translateY(-2px);
    box-shadow:
        0 12px 24px -6px rgba(37, 99, 235, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.pwa-install-button:active {
    transform: translateY(0) scale(0.98);
}

.pwa-install-dismiss {
    height: 36px;
    padding: 0 12px;

    background: transparent;
    border: 0;
    border-radius: 10px;

    color: #9CA3AF;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;

    transition:
        background 180ms cubic-bezier(0.4, 0, 0.2, 1),
        color 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

.pwa-install-dismiss:hover {
    background: #F3F4F6;
    color: var(--next-ink, #111827);
}


/* =====================================================
   RESPONSIVE — Mobile
   ===================================================== */

@media (max-width: 520px) {
    .pwa-install-content {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        padding: 18px;
        border-radius: 20px 20px 0 0;
    }

    .pwa-install-header {
        display: flex;
        align-items: center;
        gap: 14px;
    }

    .pwa-install-icon {
        width: 48px;
        height: 48px;
        border-radius: 12px;
    }

    .pwa-install-title {
        font-size: 14.5px;
    }

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

    .pwa-install-actions {
        flex-direction: row-reverse;
        justify-content: flex-end;
        padding-top: 0;
    }

    .pwa-install-button {
        flex: 1;
        height: 44px;
    }

    .pwa-install-dismiss {
        height: 44px;
    }
}


/* =====================================================
   SAFE AREA
   ===================================================== */

@supports (padding: max(0px)) {
    .pwa-install-content {
        padding-bottom: max(20px, env(safe-area-inset-bottom, 20px));
    }

    @media (max-width: 520px) {
        .pwa-install-content {
            padding-bottom: max(18px, env(safe-area-inset-bottom, 18px));
        }
    }
}


/* =====================================================
   STANDALONE — Hide
   ===================================================== */

@media (display-mode: standalone) {
    .pwa-install-banner {
        display: none !important;
    }
}