/**
 * PWA Install Button - CSS Styles
 * Design Preserved - v3.1.0
 */

/* RESET & BASE */
.pwa-install-wrapper *,
.pwa-install-wrapper *::before,
.pwa-install-wrapper *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.pwa-install-wrapper {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2147483647;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* MAIN BUTTON */
.pwa-install-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px 14px 24px;
    min-width: 148px;
    height: 56px;
    border: none;
    border-radius: 56px;
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 50%, #FF6B6B 100%);
    background-size: 200% 200%;
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    box-shadow: 0 8px 32px rgba(255, 107, 107, 0.35), 
                0 0 40px rgba(255, 107, 107, 0.15), 
                0 0 0 2px rgba(255, 255, 255, 0.12);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), 
                box-shadow 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                background 0.4s ease;
    will-change: transform, box-shadow;
    animation: pwa-gradient-shift 4s ease-in-out infinite, 
               pwa-neon-breathe 3s ease-in-out infinite;
}

@keyframes pwa-neon-breathe {
    0%, 100% { 
        box-shadow: 0 8px 32px rgba(255, 107, 107, 0.35), 0 0 40px rgba(255, 107, 107, 0.15), 0 0 0 2px rgba(255, 255, 255, 0.12); 
    }
    50% { 
        box-shadow: 0 12px 48px rgba(255, 107, 107, 0.55), 0 0 70px rgba(255, 107, 107, 0.35), 0 0 0 3px rgba(255, 255, 255, 0.2); 
    }
}

@keyframes pwa-gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@media (hover: hover) {
    .pwa-install-btn:hover {
        transform: translateY(-4px) scale(1.03);
        box-shadow: 0 16px 48px rgba(255, 107, 107, 0.45), 
                    0 0 80px rgba(255, 107, 107, 0.2),
                    0 0 0 3px rgba(255, 255, 255, 0.25);
        background: linear-gradient(135deg, #FF5252 0%, #FF7B53 50%, #FF5252 100%);
    }
}

.pwa-install-btn:active {
    transform: translateY(-2px) scale(0.97);
    transition-duration: 0.1s;
}

.pwa-install-btn:focus-visible {
    outline: 3px solid #2196F3;
    outline-offset: 4px;
}

/* RIPPLE EFFECT */
.pwa-ripple {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 56px;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}
.pwa-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s, opacity 0.6s;
    opacity: 0;
}
.pwa-install-btn:active .pwa-ripple::after {
    width: 600px;
    height: 600px;
    opacity: 1;
    transition: 0s;
}

.pwa-btn-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.pwa-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

@media (hover: hover) {
    .pwa-install-btn:hover .pwa-icon {
        transform: translateY(-2px) rotate(-4deg) scale(1.1);
    }
}

.pwa-label {
    font-weight: 800;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: 1.2px;
    position: relative;
    z-index: 1;
}

.pwa-badge {
    position: absolute;
    top: -14px;
    right: -16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 20px;
    padding: 0 8px;
    border-radius: 20px;
    background: linear-gradient(135deg, #FF3366 0%, #FF0040 100%);
    color: #ffffff;
    font-size: 8px;
    font-weight: 900;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-align: center;
    line-height: 1;
    box-shadow: 0 4px 16px rgba(255, 51, 102, 0.45);
    border: 2px solid #ffffff;
    z-index: 10;
    animation: pwa-badge-pulse 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes pwa-badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.pwa-progress {
    margin-top: 12px;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    min-width: 140px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.pwa-progress-track {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    overflow: hidden;
}

.pwa-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #FF6B6B, #FF8E53);
    border-radius: 4px;
    animation: pwa-progress-load 1.8s ease-in-out infinite;
    will-change: transform;
}

@keyframes pwa-progress-load {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.pwa-progress-label {
    display: block;
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
    letter-spacing: 0.5px;
}

.pwa-success {
    margin-top: 12px;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 14px;
    border: 1px solid rgba(76, 175, 80, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 120px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: pwa-success-fade 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pwa-success-icon {
    font-size: 18px;
}

.pwa-success-text {
    color: rgba(255, 255, 255, 0.95);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

@keyframes pwa-success-fade {
    0% { opacity: 0; transform: scale(0.8) translateY(10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.pwa-install-btn.success {
    background: linear-gradient(135deg, #00CDAC 0%, #02AAB0 100%);
    animation: none;
    box-shadow: 0 8px 32px rgba(0, 205, 172, 0.4);
}

.pwa-install-btn.success .pwa-badge {
    display: none;
}

.pwa-install-btn.dismissed {
    opacity: 0.4;
    transform: scale(0.92);
    pointer-events: none;
    animation: none;
}

@keyframes pwa-spring-pop {
    0% { opacity: 0; transform: translateY(60px) scale(0.8); }
    60% { opacity: 1; transform: translateY(-10px) scale(1.02); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pwa-spring-pop-down {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(60px) scale(0.9); }
}

.pwa-install-wrapper.show {
    display: block !important;
    animation: pwa-spring-pop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.pwa-install-wrapper.hide {
    animation: pwa-spring-pop-down 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
}

@media (prefers-color-scheme: dark) {
    .pwa-install-btn {
        box-shadow: 0 8px 32px rgba(255, 107, 107, 0.25), 
                    0 0 40px rgba(255, 107, 107, 0.1),
                    0 0 0 2px rgba(255, 255, 255, 0.05);
    }
    
    .pwa-progress,
    .pwa-success {
        background: rgba(0, 0, 0, 0.85);
    }
}

@media (max-width: 820px) {
    .pwa-install-wrapper {
        top: 12px;
        right: 12px;
    }

    .pwa-install-btn {
        padding: 12px 26px 12px 20px;
        min-width: 126px;
        height: 50px;
        font-size: 13px;
        gap: 8px;
    }
    
    .pwa-icon svg {
        width: 19px;
        height: 19px;
    }

    .pwa-badge {
        top: -12px;
        right: -14px;
        min-width: 30px;
        height: 18px;
        font-size: 7px;
        padding: 0 6px;
    }
}

@media (max-width: 480px) {
    .pwa-install-wrapper {
        top: 10px;
        right: 10px;
    }
    
    .pwa-install-btn {
        padding: 10px 18px 10px 14px;
        min-width: 106px;
        height: 44px;
        font-size: 11px;
        gap: 6px;
        border-radius: 44px;
    }
    
    .pwa-icon svg {
        width: 16px;
        height: 16px;
    }
    
    .pwa-label {
        font-size: 11px;
        letter-spacing: 0.8px;
    }

    .pwa-badge {
        top: -10px;
        right: -10px;
        min-width: 26px;
        height: 16px;
        font-size: 6px;
        padding: 0 5px;
        border-width: 1.5px;
    }

    .pwa-progress {
        min-width: 110px;
        padding: 8px 12px;
    }

    .pwa-success {
        min-width: 100px;
        padding: 8px 12px;
    }
}

@media (max-width: 375px) {
    .pwa-install-wrapper {
        top: 8px;
        right: 8px;
    }
    
    .pwa-install-btn {
        padding: 8px 14px 8px 12px;
        min-width: 90px;
        height: 38px;
        font-size: 10px;
        gap: 5px;
    }
    
    .pwa-icon svg {
        width: 14px;
        height: 14px;
    }
    
    .pwa-badge {
        top: -8px;
        right: -8px;
        min-width: 22px;
        height: 14px;
        font-size: 5px;
        padding: 0 4px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pwa-install-wrapper,
    .pwa-install-btn,
    .pwa-icon,
    .pwa-badge,
    .pwa-progress-bar {
        animation: none !important;
        transition: none !important;
    }
    
    .pwa-install-wrapper.show {
        animation: none !important;
        opacity: 1 !important;
    }
    
    .pwa-install-wrapper.hide {
        animation: none !important;
        opacity: 0 !important;
    }
    
    .pwa-install-btn {
        transition: opacity 0.2s ease !important;
    }
    
    @media (hover: hover) {
        .pwa-install-btn:hover {
            transform: none !important;
        }
    }
}

@media print {
    .pwa-install-wrapper {
        display: none !important;
    }
}