/*
 * === Version 5.1: Refined Glass with Icon Shine ===
 * A polished UI component featuring clean glassmorphism, an interactive icon shine,
 * advanced micro-interactions, and a streamlined mobile design.
 */

/* --- CSS Custom Properties --- */
.pwa-install-banner {
    --bg-color: hsl(225 15% 15% / 0.65);
    --border-color: hsl(225 15% 50% / 0.3);
    --primary-btn-bg: hsl(218, 98%, 54%);
    --primary-btn-glow: hsl(218, 98%, 65%);
    --animation-bezier: cubic-bezier(0.16, 1, 0.3, 1);
    --animation-duration: 0.7s;
}

/* --- Keyframe Animations --- */
@keyframes subtleFloat {
    50% { transform: translateY(-3px); }
}

@keyframes staggeredFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Main Banner Styling (Glassmorphism) --- */
.pwa-install-banner {
    position: fixed;
    inset: auto 20px 20px 20px;
    z-index: 10000;
    display: none;
    
    background: var(--bg-color);
    backdrop-filter: blur(22px) saturate(1.3);
    border: 1px solid var(--border-color);
    
    border-radius: 18px;
    padding: 16px;
    box-shadow: 0 0.75rem 2.5rem -0.75rem hsl(0 0% 0% / 0.3);
    
    animation: staggeredFadeIn var(--animation-duration) var(--animation-bezier) 0.1s backwards;
}

/* --- Content Layout & Staggered Animations --- */
.pwa-install-banner .banner-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.banner-content > * {
    animation: staggeredFadeIn var(--animation-duration) var(--animation-bezier) backwards;
}

.pwa-install-banner .banner-icon { animation-delay: 0.3s; }
.pwa-install-banner .banner-text-wrapper { animation-delay: 0.4s; }
.pwa-install-banner .banner-actions { animation-delay: 0.5s; }

/* --- App Icon with Subtle Float & NEW Shine Effect --- */
.pwa-install-banner .banner-icon {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    animation-name: staggeredFadeIn, subtleFloat;
    animation-duration: var(--animation-duration), 5s;
    animation-timing-function: var(--animation-bezier), ease-in-out;
    animation-iteration-count: 1, infinite;
    
    /* NEW: Add positioning context and clip the shine effect */
    position: relative;
    border-radius: 28%; /* Match the image's radius */
    overflow: hidden; /* This is key to containing the shine */
    -webkit-mask-image: -webkit-radial-gradient(white, black); /* Fix for overflow in some browsers */
}

.pwa-install-banner .banner-icon img {
    width: 100%;
    height: 100%;
    border-radius: 28%;
    box-shadow: 0 4px 12px -2px hsl(0 0% 0% / 0.35);
    background-color: aliceblue;
}

/* --- NEW: The Shine Pseudo-Element --- */
.pwa-install-banner .banner-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    
    /* The shine itself: a soft, angled gradient */
    background-image: linear-gradient(
        110deg,
        transparent 20%,
        hsl(0 0% 100% / 0.15) 50%,
        transparent 80%
    );
    
    /* Start the shine off-screen to the left */
    transform: translateX(-150%);
    
    /* Define the animation timing */
    transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.3, 1);
}

/* --- NEW: Trigger the Shine on Banner Hover --- */
.pwa-install-banner:hover .banner-icon::after {
    /* Move the shine across to the right */
    transform: translateX(150%);
    transition-delay: 0.2s; /* Add a slight delay for a more premium feel */
}


/* --- Text Styling (Unchanged) --- */
.banner-text-wrapper { flex-grow: 1; min-width: 0; }
.pwa-install-banner h4 { margin: 0 0 4px; font-size: 1.1rem; font-weight: 600; color: #fff; }
.pwa-install-banner p { margin: 0; font-size: 0.9rem; color: hsl(225 15% 75%); }

/* --- Interactive Buttons (Unchanged) --- */
.pwa-install-banner .banner-actions { display: flex; gap: 8px; }
.pwa-install-banner button {
    position: relative; overflow: hidden; -webkit-tap-highlight-color: transparent;
    border: none; border-radius: 12px; cursor: pointer; font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
#hd-pwa-install-btn {
    background: var(--primary-btn-bg); color: white; padding: 10px 20px; font-size: 15px;
    box-shadow: inset 0 1px 1px hsl(0 0% 100% / 0.1),
                0 4px 8px hsl(0 0% 0% / 0.25), 0 0 20px -5px var(--primary-btn-glow);
}
#hd-pwa-install-btn:hover {
    transform: translateY(-3px);
    box-shadow: inset 0 1px 1px hsl(0 0% 100% / 0.15),
                0 7px 14px hsl(0 0% 0% / 0.3), 0 0 30px -5px var(--primary-btn-glow);
}
#hd-pwa-install-btn:active { transform: translateY(0); transition-duration: 0.1s; }
#hd-pwa-close-banner {
    background: hsl(225 15% 85% / 0.1); color: hsl(225 15% 65%); font-size: 18px;
    width: 40px; height: 40px; display: grid; place-content: center;
    transition: all 0.3s ease;
}
#hd-pwa-close-banner:hover {
    background: hsl(225 15% 10% / 0.4); color: #fff; transform: rotate(90deg);
}

/* --- Mobile View: Compact & Refined (Unchanged) --- */
@media (max-width: 768px) {
    .pwa-install-banner {
        inset: auto 0 0 0; border-radius: 24px 24px 0 0;
        padding: 12px 16px calc(env(safe-area-inset-bottom, 12px));
        transform: translateY(100%); animation: slideUp 0.6s var(--animation-bezier) forwards;
    }
    @keyframes slideUp { to { transform: translateY(0); } }
    .pwa-install-banner .banner-content { gap: 12px; }
    .pwa-install-banner .banner-icon { width: 42px; height: 42px; animation: none; }
    .pwa-install-banner h4 { font-size: 0.95rem; }
    .pwa-install-banner p { font-size: 0.8rem; }
    #hd-pwa-install-btn { padding: 8px 16px; font-size: 14px; border-radius: 10px; }
    #hd-pwa-close-banner { width: 34px; height: 34px; border-radius: 10px; }
}