/**
 * ═══════════════════════════════════════════════════════
 *  Advanced PWA Install Banner Styles
 *  Modern, Beautiful Mobile-First Design
 * ═══════════════════════════════════════════════════════
 */

/* ========================================
   INSTALL BANNER
   ======================================== */

#pwa-install-banner {
    position: fixed;
    bottom: -300px;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    transition: bottom 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    backdrop-filter: blur(10px);
}

#pwa-install-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="20" height="20" patternUnits="userSpaceOnUse"><path d="M 20 0 L 0 0 0 20" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
    pointer-events: none;
}

#pwa-install-banner.show {
    bottom: 0;
    animation: slideUpBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes slideUpBounce {
    0% {
        bottom: -300px;
        opacity: 0;
    }
    60% {
        bottom: 10px;
    }
    80% {
        bottom: -5px;
    }
    100% {
        bottom: 0;
        opacity: 1;
    }
}

.pwa-banner-content {
    display: flex;
    align-items: center;
    gap: 15px;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.pwa-banner-icon {
    font-size: 48px;
    flex-shrink: 0;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    25% {
        transform: translateY(-5px) rotate(-2deg);
    }
    50% {
        transform: translateY(-10px) rotate(0deg);
    }
    75% {
        transform: translateY(-5px) rotate(2deg);
    }
}

.pwa-banner-text {
    flex: 1;
    min-width: 0;
}

.pwa-banner-text strong {
    display: block;
    font-size: 17px;
    margin-bottom: 4px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.pwa-banner-text p {
    font-size: 13px;
    opacity: 0.95;
    margin: 0;
    line-height: 1.4;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.pwa-install-button {
    background: white;
    color: #667eea;
    border: none;
    padding: 14px 28px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.pwa-install-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.pwa-install-button:active::before {
    width: 300px;
    height: 300px;
}

.pwa-install-button:active {
    transform: scale(0.95);
}

.pwa-install-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.pwa-close-button {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.pwa-close-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.pwa-close-button:active {
    background: rgba(255, 255, 255, 0.4);
    transform: rotate(90deg) scale(0.9);
}

/* ========================================
   SUCCESS MESSAGE
   ======================================== */

.pwa-success-message {
    position: fixed;
    top: -150px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    transition: top 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    max-width: 90%;
}

.pwa-success-message.show {
    top: 20px;
    animation: successBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes successBounce {
    0% {
        top: -150px;
        opacity: 0;
    }
    60% {
        top: 25px;
    }
    80% {
        top: 15px;
    }
    100% {
        top: 20px;
        opacity: 1;
    }
}

.pwa-success-content {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 18px 35px;
    border-radius: 50px;
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.4);
    font-weight: 700;
    white-space: nowrap;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 8px 32px rgba(16, 185, 129, 0.4);
    }
    50% {
        box-shadow: 0 8px 40px rgba(16, 185, 129, 0.6);
    }
}

/* ========================================
   FLOATING INSTALL BUTTON
   ======================================== */

.pwa-floating-install {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 28px;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    animation: floatButton 3s ease-in-out infinite;
}

@keyframes floatButton {
    0%, 100% {
        transform: translateY(0px);
        box-shadow: 0 8px 32px rgba(102, 126, 234, 0.4);
    }
    50% {
        transform: translateY(-10px);
        box-shadow: 0 12px 40px rgba(102, 126, 234, 0.6);
    }
}

.pwa-floating-install:active {
    transform: scale(0.9);
}

.pwa-floating-install:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.6);
}

.pwa-floating-install::before {
    content: '';
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    border-radius: 50%;
    border: 3px solid white;
    animation: ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
    75%, 100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* ========================================
   CUSTOM ALERT
   ======================================== */

.pwa-custom-alert {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
    backdrop-filter: blur(5px);
}

.pwa-custom-alert.show {
    opacity: 1;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.pwa-alert-content {
    background: white;
    padding: 35px;
    border-radius: 20px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    overflow: hidden;
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.pwa-alert-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.pwa-alert-content h3 {
    margin: 0 0 15px 0;
    color: #1f2937;
    font-size: 22px;
    font-weight: 700;
}

.pwa-alert-content p {
    margin: 0 0 25px 0;
    color: #6b7280;
    line-height: 1.6;
    font-size: 15px;
}

.pwa-alert-content button {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.pwa-alert-content button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.pwa-alert-content button:active {
    transform: translateY(0);
}

/* ========================================
   UPDATE NOTIFICATION
   ======================================== */

.pwa-update-notification {
    position: fixed;
    top: -150px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    transition: top 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    max-width: 450px;
    width: calc(100% - 40px);
}

.pwa-update-notification.show {
    top: 20px;
}

.pwa-update-content {
    background: white;
    padding: 18px 22px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    border: 2px solid #667eea;
    animation: slideDown 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes slideDown {
    from {
        transform: translateY(-100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.pwa-update-content span {
    color: #1f2937;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pwa-update-content button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 22px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.pwa-update-content button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.pwa-update-content button:active {
    transform: translateY(0);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Hide on desktop */
@media (min-width: 768px) {
    #pwa-install-banner,
    .pwa-floating-install {
        display: none !important;
    }
}

/* Mobile optimizations */
@media (max-width: 767px) {
    #pwa-install-banner {
        bottom: -300px;
        padding: 18px 15px 22px;
    }
    
    #pwa-install-banner.show {
        bottom: 60px; /* Above bottom nav */
    }
    
    .pwa-banner-content {
        gap: 12px;
    }
    
    .pwa-banner-icon {
        font-size: 40px;
    }
    
    .pwa-banner-text strong {
        font-size: 15px;
    }
    
    .pwa-banner-text p {
        font-size: 12px;
    }
    
    .pwa-install-button {
        padding: 12px 22px;
        font-size: 13px;
    }
    
    .pwa-floating-install {
        bottom: 140px; /* Above bottom nav and banner */
        right: 15px;
        width: 56px;
        height: 56px;
        font-size: 26px;
    }
    
    .pwa-alert-content {
        padding: 25px 20px;
    }
    
    .pwa-alert-content h3 {
        font-size: 19px;
    }
    
    .pwa-alert-content p {
        font-size: 14px;
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    .pwa-banner-content {
        flex-wrap: wrap;
    }
    
    .pwa-install-button {
        width: 100%;
        margin-top: 8px;
    }
    
    .pwa-close-button {
        position: absolute;
        top: 10px;
        right: 10px;
    }
}

/* iOS specific adjustments */
@supports (-webkit-touch-callout: none) {
    #pwa-install-banner {
        padding-bottom: calc(22px + env(safe-area-inset-bottom));
    }
    
    #pwa-install-banner.show {
        bottom: calc(60px + env(safe-area-inset-bottom));
    }
    
    .pwa-floating-install {
        bottom: calc(140px + env(safe-area-inset-bottom));
    }
}

/* Standalone mode (when installed) */
@media (display-mode: standalone) {
    #pwa-install-banner,
    .pwa-floating-install {
        display: none !important;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

/* Focus styles */
.pwa-install-button:focus,
.pwa-close-button:focus,
.pwa-floating-install:focus,
.pwa-alert-content button:focus,
.pwa-update-content button:focus {
    outline: 3px solid rgba(102, 126, 234, 0.5);
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    #pwa-install-banner,
    .pwa-success-message,
    .pwa-floating-install,
    .pwa-banner-icon,
    .pwa-alert-content,
    .pwa-update-content {
        animation: none !important;
        transition: none !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    #pwa-install-banner {
        border: 2px solid white;
    }
    
    .pwa-install-button {
        border: 2px solid #667eea;
    }
    
    .pwa-close-button {
        border: 2px solid white;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .pwa-alert-content {
        background: #1f2937;
        color: white;
    }
    
    .pwa-alert-content h3 {
        color: white;
    }
    
    .pwa-alert-content p {
        color: #d1d5db;
    }
    
    .pwa-update-content {
        background: #1f2937;
        border-color: #667eea;
    }
    
    .pwa-update-content span {
        color: white;
    }
}
