/* PWA Install Prompt */
.pwa-install-prompt {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    max-width: 400px;
    width: 90%;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(100px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.pwa-install-content {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    position: relative;
    text-align: center;
}

.pwa-install-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.pwa-install-close:hover {
    background: #f0f0f0;
    color: #000;
}

.pwa-install-icon img {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pwa-install-content h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.pwa-install-content p {
    margin: 0 0 15px 0;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

#pwa-install-button {
    background-color: #000;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

#pwa-install-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#pwa-install-button:active {
    transform: scale(0.98);
}

/* PWA iOS Install Guide */
.pwa-ios-install-guide {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.pwa-ios-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

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

.pwa-ios-content {
    position: relative;
    background: white;
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 25px;
    animation: slideUpIOS 0.4s ease;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.3);
}

@keyframes slideUpIOS {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.pwa-ios-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #f0f0f0;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 10;
}

.pwa-ios-close:hover {
    background: #e0e0e0;
    color: #000;
    transform: scale(1.1);
}

.pwa-ios-header {
    text-align: center;
    margin-bottom: 30px;
    padding-top: 10px;
}

.pwa-ios-icon img {
    width: 70px;
    height: 70px;
    border-radius: 16px;
    margin-bottom: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.pwa-ios-header h3 {
    margin: 0 0 5px 0;
    font-size: 22px;
    font-weight: 700;
    color: #1a1a1a;
}

.pwa-ios-header p {
    margin: 0;
    color: #666;
    font-size: 15px;
}

.pwa-ios-steps {
    margin: 0 0 25px 0;
}

.pwa-ios-step {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    margin-bottom: 0;
}

.pwa-ios-step-number {
    flex-shrink: 0;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background-color: #000;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

.pwa-ios-step-content {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    padding: 8px 0;
}

.pwa-ios-step-text {
    flex: 1;
}

.pwa-ios-step-text strong {
    display: block;
    font-size: 16px;
    color: #1a1a1a;
    margin-bottom: 4px;
    font-weight: 600;
}

.pwa-ios-step-text span {
    display: block;
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

.pwa-ios-step-icon {
    flex-shrink: 0;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f8f8;
    border-radius: 10px;
}

.pwa-ios-step-divider {
    width: 2px;
    height: 25px;
    background: linear-gradient(to bottom, #e0e0e0, transparent);
    margin-left: 17px;
}

.pwa-ios-footer {
    padding-top: 10px;
}

#pwa-ios-understood {
    width: 100%;
    padding: 15px;
    background-color: #000;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#pwa-ios-understood:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

#pwa-ios-understood:active {
    transform: scale(0.98);
}

/* PWA Update Notification */
.pwa-update-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    max-width: 350px;
    animation: slideInRight 0.4s ease;
}

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

.pwa-update-content {
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
}

.pwa-update-content span {
    flex: 1;
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

#pwa-update-reload {
    background-color: #000;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

#pwa-update-reload:hover {
    transform: scale(1.05);
}

.pwa-update-close {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.pwa-update-close:hover {
    background: #f0f0f0;
    color: #000;
}

/* Offline Indicator */
.pwa-offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #ff9800;
    color: white;
    text-align: center;
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
    z-index: 99998;
    animation: slideDown 0.4s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

.pwa-offline-indicator.online {
    background: #4caf50;
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .pwa-install-content,
    .pwa-update-content,
    .pwa-ios-content {
        background: #1e1e1e;
        color: #ffffff;
    }
    
    .pwa-install-content h3,
    .pwa-update-content span,
    .pwa-ios-header h3 {
        color: #ffffff;
    }
    
    .pwa-install-content p,
    .pwa-ios-header p {
        color: #cccccc;
    }
    
    .pwa-ios-step-text strong {
        color: #ffffff;
    }
    
    .pwa-ios-step-text span {
        color: #aaaaaa;
    }
    
    .pwa-ios-step-icon {
        background: #2a2a2a;
    }
    
    .pwa-install-close,
    .pwa-update-close {
        color: #cccccc;
    }
    
    .pwa-install-close:hover,
    .pwa-update-close:hover,
    .pwa-ios-close {
        background: #333;
        color: #ffffff;
    }
    
    .pwa-ios-overlay {
        background: rgba(0, 0, 0, 0.85);
    }
    
    .pwa-ios-step-divider {
        background: linear-gradient(to bottom, #444, transparent);
    }
}

/* Mobile optimizations */
@media screen and (max-width: 768px) {
    .pwa-install-prompt {
        bottom: 10px;
        width: 95%;
    }
    
    .pwa-install-content {
        padding: 15px;
    }
    
    .pwa-install-icon img {
        width: 60px;
        height: 60px;
    }
    
    .pwa-update-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .pwa-update-content {
        flex-direction: column;
        text-align: center;
    }
    
    #pwa-update-reload {
        width: 100%;
    }
    
    .pwa-ios-content {
        border-radius: 25px 25px 0 0;
        padding: 20px;
        max-height: 85vh;
    }
    
    .pwa-ios-header h3 {
        font-size: 20px;
    }
    
    .pwa-ios-step-text strong {
        font-size: 15px;
    }
    
    .pwa-ios-step-text span {
        font-size: 13px;
    }
}

/* iOS specific styles */
@supports (-webkit-touch-callout: none) {
    .pwa-install-prompt {
        bottom: 30px;
    }
}

/* Animations pour PWA standalone mode */
@media all and (display-mode: standalone) {
    body {
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
    }
    
    .pwa-install-prompt,
    .pwa-ios-install-guide {
        display: none !important;
    }
}

/* Pull to refresh indicator */
.pwa-pull-refresh {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    z-index: 99997;
}

.pwa-pull-refresh.active {
    transform: translateY(0);
}

.pwa-pull-refresh-icon {
    width: 30px;
    height: 30px;
    border: 3px solid #ddd;
    border-top-color: #000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}