/* PWA Specific Styles for Sắp Tết */

/* Install button animations and styles */
@keyframes slideInUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 4px 20px rgba(211, 47, 47, 0.3);
    }
    50% {
        box-shadow: 0 6px 30px rgba(211, 47, 47, 0.5);
    }
    100% {
        box-shadow: 0 4px 20px rgba(211, 47, 47, 0.3);
    }
}

/* PWA Install Button */
.pwa-install-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 1000;
    display: none;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    animation: slideInUp 0.5s ease, pulse 2s infinite;
    font-family: 'Nunito', sans-serif;
}

.pwa-install-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0,0,0,0.4);
    animation: pulse 1s infinite;
}

.pwa-install-button:active {
    transform: translateY(1px) !important;
}

.pwa-install-button .install-icon {
    font-size: 16px;
    animation: bounce 2s infinite;
}

.pwa-install-button .install-text {
    font-weight: 600;
    letter-spacing: 0.5px;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-3px);
    }
    60% {
        transform: translateY(-1px);
    }
}

/* PWA Modal Styles */
.pwa-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.pwa-modal-content {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    max-width: 400px;
    margin: 1rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    text-align: center;
    animation: slideInScale 0.3s ease;
    font-family: 'Nunito', sans-serif;
}

.pwa-modal h2 {
    color: var(--color-primary);
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.pwa-modal h3 {
    color: var(--color-primary);
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.pwa-modal ol {
    text-align: left;
    padding-left: 1.5rem;
    line-height: 1.6;
}

.pwa-modal li {
    margin-bottom: 0.5rem;
    color: #333;
}

.pwa-modal button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    background: var(--color-primary);
    color: white;
    transition: all 0.3s ease;
    font-family: 'Nunito', sans-serif;
    margin: 0.25rem;
}

.pwa-modal button:hover {
    background: var(--color-secondary);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInScale {
    from {
        transform: scale(0.8) translateY(20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* Responsive adjustments for PWA */
@media (max-width: 768px) {
    .pwa-install-button {
        bottom: 15px;
        right: 15px;
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .pwa-modal-content {
        margin: 0.5rem;
        padding: 1.5rem;
    }
    
    .pwa-modal h2 {
        font-size: 1.3rem;
    }
    
    .pwa-modal h3 {
        font-size: 1.1rem;
    }
}

/* PWA specific adjustments when running in standalone mode */
@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    .pwa-install-button {
        display: none !important;
    }
    
    /* Add some top padding for devices with notches */
    .header {
        padding-top: calc(1rem + env(safe-area-inset-top));
    }
}

/* iOS specific adjustments */
@supports (-webkit-touch-callout: none) {
    .pwa-install-button {
        bottom: calc(20px + env(safe-area-inset-bottom));
    }
}

/* Support section install button styling */
#support-install-btn {
    background: rgba(255,255,255,0.2) !important;
    color: white !important;
    border: 2px solid white !important;
    padding: 1rem 2rem !important;
    border-radius: 50px !important;
    cursor: pointer !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
    backdrop-filter: blur(10px) !important;
    font-family: 'Nunito', sans-serif !important;
    text-decoration: none !important;
    display: inline-block !important;
}

#support-install-btn:hover {
    background: white !important;
    color: var(--color-primary) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2) !important;
}

/* Update notification styles */
.update-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--color-primary);
    color: white;
    padding: 1rem;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 9999;
    animation: slideInRight 0.5s ease;
    max-width: 300px;
    font-family: 'Nunito', sans-serif;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loading spinner for PWA operations */
.pwa-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}