/* PWA Installation Styles */

/* دکمه نصب PWA */
.pwa-install-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    background: linear-gradient(45deg, #03173d, #1976d2);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: none;
    transition: all 0.3s ease;
    direction: rtl;
    gap: 8px;
    align-items: center;
    backdrop-filter: blur(10px);
}

.pwa-install-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    background: linear-gradient(45deg, #1976d2, #03173d);
}

.pwa-install-button:active {
    transform: scale(0.95);
}

/* alert نصب PWA */
.pwa-install-alert {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
    direction: rtl;
    animation: slideInRight 0.5s ease-out;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* انیمیشن ورود */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* انیمیشن خروج */
@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.pwa-install-alert.hiding {
    animation: slideOutRight 0.5s ease-in;
}

/* بهبود ظاهر در موبایل */
@media (max-width: 768px) {
    .pwa-install-alert {
        right: 10px;
        left: 10px;
        max-width: none;
        top: 60px;
    }
    
    .pwa-install-button {
        right: 10px;
        bottom: 10px;
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* ظاهر در حالت تاریک */
.mud-theme-dark .pwa-install-button {
    background: linear-gradient(45deg, #1e3a8a, #3b82f6);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.mud-theme-dark .pwa-install-button:hover {
    background: linear-gradient(45deg, #3b82f6, #1e3a8a);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.8);
}

/* بهبود accessibility */
.pwa-install-button:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.pwa-install-button:focus:not(:focus-visible) {
    outline: none;
}

/* لودینگ در حالت نصب */
.pwa-install-button.installing {
    pointer-events: none;
    opacity: 0.7;
}

.pwa-install-button.installing::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* آیکن نصب */
.pwa-install-icon {
    width: 16px;
    height: 16px;
    margin-left: 8px;
}

/* متن کمکی */
.pwa-install-helper-text {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 4px;
}

/* نشان موفقیت نصب */
.pwa-install-success {
    background: linear-gradient(45deg, #10b981, #059669);
    animation: successPulse 0.6s ease-out;
}

@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}
