/**
 * PWA Installation UI Styles
 * استایل‌های دیالوگ و UI نصب PWA
 * @version 1.0.0
 */

/* فونت فارسی - وراثت از سایت */
.pwa-install-container,
.pwa-install-container * {
    font-family: inherit !important;
}

/* Container & Overlay */
.pwa-install-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.pwa-install-container.pwa-install-show {
    opacity: 1;
    visibility: visible;
}

.pwa-install-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: pwa-fade-in 0.3s ease;
}

/* Dialog */
.pwa-install-dialog {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to bottom, #ffffff 0%, #f8fafb 100%);
    border-radius: 36px 36px 0 0;
    box-shadow: 
        0 -8px 32px rgba(0, 0, 0, 0.12),
        0 -4px 16px rgba(0, 0, 0, 0.08),
        0 0 1px rgba(0, 0, 0, 0.05);
    max-width: 600px;
    margin: 0 auto;
    padding: 32px 28px 36px 28px;
    transform: translateY(100%);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 90vh;
    overflow-y: auto;
    direction: rtl;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.pwa-install-show .pwa-install-dialog {
    transform: translateY(0);
}

/* برای دسکتاپ */
@media (min-width: 768px) {
    .pwa-install-dialog {
        bottom: auto;
        top: 50%;
        transform: translateY(-50%) scale(0.9);
        border-radius: 24px;
        max-height: 80vh;
    }
    
    .pwa-install-show .pwa-install-dialog {
        transform: translateY(-50%) scale(1);
    }
}

/* Close Button */
.pwa-install-close {
    position: absolute;
    top: 24px;
    left: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.04) 0%, rgba(0, 0, 0, 0.08) 100%);
    color: #666;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 10;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.pwa-install-close:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    color: #667eea;
    transform: scale(1.15) rotate(90deg);
    box-shadow: 
        0 4px 16px rgba(102, 126, 234, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.pwa-install-close:active {
    transform: scale(0.95) rotate(90deg);
    box-shadow: 
        0 1px 4px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Header */
.pwa-install-header {
    text-align: center;
    margin-bottom: 28px;
    padding-top: 12px;
    position: relative;
}

/* لوگوی الواپل */
.pwa-install-logo {
    width: 88px;
    height: 88px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    border-radius: 24px;
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.1),
        0 4px 12px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        inset 0 -1px 0 rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 2px solid rgba(0, 0, 0, 0.05);
    animation: pwa-logo-entrance 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.pwa-install-logo::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0));
    border-radius: 24px 24px 0 0;
}

@keyframes pwa-logo-entrance {
    0% {
        opacity: 0;
        transform: scale(0.5) rotate(-10deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.pwa-install-logo img {
    width: 70%;
    height: 70%;
    object-fit: contain;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.pwa-install-icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: pwa-bounce 2s ease infinite;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

@keyframes pwa-bounce {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-12px) scale(1.05);
    }
}

.pwa-install-title {
    font-size: 28px;
    font-weight: 800;
    color: #1a1a1a;
    margin: 0 0 12px 0;
    letter-spacing: -0.6px;
}

.pwa-install-subtitle {
    font-size: 16px;
    color: #555;
    margin: 0;
    line-height: 1.6;
    font-weight: 500;
}

/* Body */
.pwa-install-body {
    margin-top: 28px;
}

.pwa-install-description {
    font-size: 15px;
    line-height: 1.7;
    color: #555;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 400;
}

/* Steps */
.pwa-install-steps {
    margin: 0;
}

.pwa-install-step {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 16px;
    transition: all 0.3s ease;
}

.pwa-install-step:hover {
    background: #f0f2f5;
    transform: translateX(-4px);
}

.pwa-install-step:last-child {
    margin-bottom: 0;
}

.pwa-install-step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: 12px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.pwa-install-step-content {
    flex: 1;
    display: flex;
    align-items: flex-start;
}

.pwa-install-step-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 12px;
    color: #667eea;
    font-size: 20px;
    flex-shrink: 0;
}

.pwa-install-step-text {
    flex: 1;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}

.pwa-install-step-text strong {
    color: #667eea;
    font-weight: 600;
}

/* List */
.pwa-install-list {
    list-style: none;
    padding: 0;
    margin: 16px 0;
}

.pwa-install-list li {
    position: relative;
    padding: 12px 12px 12px 32px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    color: #444;
}

.pwa-install-list li:before {
    content: '•';
    position: absolute;
    right: 12px;
    color: #667eea;
    font-size: 20px;
    font-weight: 700;
}

/* Features Grid */
.pwa-install-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 28px 0;
}

.pwa-install-feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 14px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 18px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 2px solid rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.pwa-install-feature::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pwa-install-feature:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 
        0 12px 24px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 1);
    border-color: rgba(102, 126, 234, 0.25);
}

.pwa-install-feature:hover::before {
    opacity: 1;
}

.pwa-install-feature-icon {
    font-size: 40px;
    margin-bottom: 12px;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.12));
    position: relative;
    z-index: 1;
    animation: feature-float 3s ease-in-out infinite;
}

@keyframes feature-float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-3px);
    }
}

.pwa-install-feature-text {
    font-size: 14px;
    font-weight: 700;
    color: #333;
    text-align: center;
    position: relative;
    z-index: 1;
}

/* Note Box */
.pwa-install-note {
    background: #e7f3ff;
    border-right: 4px solid #2196F3;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 16px;
    font-size: 14px;
    color: #0c5460;
    line-height: 1.5;
}

/* Browser Suggestions */
.pwa-install-browser-suggestions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 16px 0;
}

.pwa-install-browser {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.pwa-install-browser:hover {
    background: #e9ecef;
    transform: translateX(-4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.pwa-install-browser-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.pwa-install-browser strong {
    display: block;
    font-size: 16px;
    color: #333;
    margin-bottom: 2px;
}

.pwa-install-browser small {
    display: block;
    font-size: 12px;
    color: #666;
}

/* موبایل - Features Grid */
@media (max-width: 767px) {
    .pwa-install-features {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .pwa-install-feature {
        padding: 12px 8px;
    }
    
    .pwa-install-feature-icon {
        font-size: 28px;
        margin-bottom: 6px;
    }
    
    .pwa-install-feature-text {
        font-size: 12px;
    }
}

/* Buttons */
.pwa-install-button {
    width: 100%;
    padding: 18px 28px;
    border: none;
    border-radius: 18px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 14px;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.pwa-install-button:first-of-type {
    margin-top: 20px;
}

.pwa-install-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow: 
        0 6px 20px rgba(102, 126, 234, 0.4),
        0 3px 10px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.pwa-install-btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pwa-install-btn-primary:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: 
        0 8px 28px rgba(102, 126, 234, 0.5),
        0 4px 14px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.pwa-install-btn-primary:hover::before {
    opacity: 1;
}

.pwa-install-btn-primary:active {
    transform: translateY(-1px) scale(0.99);
    box-shadow: 
        0 3px 12px rgba(102, 126, 234, 0.4),
        0 2px 6px rgba(0, 0, 0, 0.15);
}

.pwa-install-btn-secondary {
    background: #f8f9fa;
    color: #555;
    border: 2px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.pwa-install-btn-secondary:hover {
    background: #f0f2f5;
    color: #333;
    border-color: #d0d0d0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.pwa-install-btn-secondary:active {
    background: #e8eaed;
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

/* Toast Notifications */
.pwa-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #fff;
    padding: 16px 20px;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 400px;
    z-index: 1000000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    direction: rtl;
}

.pwa-toast.pwa-toast-show {
    opacity: 1;
    transform: translateY(0);
}

.pwa-toast-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.pwa-toast-success .pwa-toast-icon {
    background: #d4edda;
    color: #155724;
}

.pwa-toast-info .pwa-toast-icon {
    background: #d1ecf1;
    color: #0c5460;
}

.pwa-toast-message {
    flex: 1;
    font-size: 14px;
    color: #333;
    line-height: 1.4;
}

.pwa-toast-action {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background: #667eea;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pwa-toast-action:hover {
    background: #5568d3;
    transform: scale(1.05);
}

.pwa-toast-action:active {
    transform: scale(0.95);
}

/* موبایل */
@media (max-width: 767px) {
    .pwa-toast {
        bottom: 16px;
        right: 16px;
        left: 16px;
        min-width: auto;
        max-width: none;
    }
}

/* دکمه نصب شناور */
.pwa-install-fab-container {
    position: fixed;
    bottom: 28px;
    left: 28px;
    z-index: 999998;
    opacity: 0;
    transform: translateY(30px) scale(0.7);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pwa-install-fab-container.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.pwa-install-fab {
    min-width: 170px;
    height: 58px;
    border-radius: 29px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    box-shadow: 
        0 8px 24px rgba(102, 126, 234, 0.4),
        0 4px 12px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0 28px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
    font-family: inherit;
}

.pwa-install-fab::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pwa-install-fab:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 
        0 12px 32px rgba(102, 126, 234, 0.5),
        0 6px 16px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.pwa-install-fab:hover::before {
    opacity: 1;
}

.pwa-install-fab:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 
        0 4px 16px rgba(102, 126, 234, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.15);
}

.pwa-install-fab svg {
    width: 26px;
    height: 26px;
    fill: currentColor;
    flex-shrink: 0;
    animation: pwa-fab-bounce 2.5s ease-in-out infinite;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    position: relative;
    z-index: 1;
}

.pwa-install-fab-text {
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    font-family: inherit;
    letter-spacing: -0.2px;
    position: relative;
    z-index: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

@keyframes pwa-fab-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

/* حذف شد - دکمه بستن و tooltip دیگر نیازی نیستند */

/* موبایل */
@media (max-width: 767px) {
    .pwa-install-fab-container {
        bottom: 20px;
        left: 20px;
    }
    
    .pwa-install-fab {
        min-width: 140px;
        height: 52px;
        padding: 0 20px;
        gap: 8px;
    }
    
    .pwa-install-fab svg {
        width: 22px;
        height: 22px;
    }
    
    .pwa-install-fab-text {
        font-size: 14px;
    }
}

/* RTL Support */
[dir="rtl"] .pwa-install-fab-container {
    left: auto;
    right: 24px;
}

@media (max-width: 767px) {
    [dir="rtl"] .pwa-install-fab-container {
        right: 20px;
        left: auto;
    }
}

/* انیمیشن‌ها */
@keyframes pwa-slide-up {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pwa-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* حالت Dark Mode */
@media (prefers-color-scheme: dark) {
    .pwa-install-dialog {
        background: #1a1a1a;
        color: #fff;
    }
    
    .pwa-install-title {
        color: #fff;
    }
    
    .pwa-install-subtitle,
    .pwa-install-description {
        color: #aaa;
    }
    
    .pwa-install-close {
        background: #2a2a2a;
        color: #aaa;
    }
    
    .pwa-install-close:hover {
        background: #333;
        color: #fff;
    }
    
    .pwa-install-step {
        background: #2a2a2a;
    }
    
    .pwa-install-step:hover {
        background: #333;
    }
    
    .pwa-install-step-text {
        color: #ddd;
    }
    
    .pwa-install-list li {
        background: #2a2a2a;
        color: #ddd;
    }
    
    .pwa-toast {
        background: #2a2a2a;
        color: #fff;
    }
    
    .pwa-toast-message {
        color: #ddd;
    }
}

/* RTL Support - اضافی برای اطمینان */
[dir="rtl"] .pwa-install-step {
    flex-direction: row-reverse;
}

[dir="rtl"] .pwa-install-step-number {
    margin-left: 0;
    margin-right: 12px;
}

[dir="rtl"] .pwa-install-step-icon {
    margin-left: 0;
    margin-right: 12px;
}

[dir="rtl"] .pwa-install-list li {
    padding: 12px 32px 12px 12px;
}

[dir="rtl"] .pwa-install-list li:before {
    right: auto;
    left: 12px;
}

[dir="rtl"] .pwa-toast {
    right: auto;
    left: 24px;
}

@media (max-width: 767px) {
    [dir="rtl"] .pwa-toast {
        left: 16px;
        right: 16px;
    }
}

/* Accessibility */
.pwa-install-container:focus-within .pwa-install-close {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.pwa-install-button:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Smooth Scrolling */
.pwa-install-dialog {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Print */
@media print {
    .pwa-install-container,
    .pwa-toast,
    .pwa-install-fab {
        display: none !important;
    }
}

