/* Chamaly PWA Frontend Styles */

/* PWA Install Prompt */
.pwa-install-prompt {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999999;
    max-width: 400px;
    width: calc(100% - 40px);
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(100px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.pwa-install-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    text-align: center;
}

.pwa-close,
.push-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pwa-close:hover,
.push-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.pwa-install-icon,
.push-notification-icon {
    font-size: 48px;
    margin-bottom: 15px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.pwa-install-content h3,
.push-notification-content h3 {
    margin: 0 0 10px 0;
    font-size: 22px;
    font-weight: bold;
}

.pwa-install-content p,
.push-notification-content p {
    margin: 0 0 20px 0;
    opacity: 0.95;
    line-height: 1.6;
}

.pwa-install-btn,
.push-enable-btn {
    background: white;
    color: #667eea;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.pwa-install-btn:hover,
.push-enable-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Push Notification Prompt */
.push-notification-prompt {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 999999;
    max-width: 350px;
    width: calc(100% - 40px);
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.push-notification-content {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    text-align: center;
}

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #dc2626;
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 999998;
    display: none;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.offline-indicator.show {
    display: flex;
    align-items: center;
    gap: 10px;
}

.offline-indicator::before {
    content: "⚠️";
    font-size: 20px;
}

/* Loading Spinner */
.pwa-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Success Message */
.pwa-success-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #059669;
    color: white;
    padding: 15px 25px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 999999;
    display: none;
    animation: fadeIn 0.5s ease-out;
}

.pwa-success-message.show {
    display: block;
}

/* RTL Support */
[dir="rtl"] .pwa-install-prompt {
    direction: rtl;
}

[dir="rtl"] .push-notification-prompt {
    right: auto;
    left: 20px;
}

[dir="rtl"] .offline-indicator {
    right: auto;
    left: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .pwa-install-prompt {
        bottom: 10px;
        max-width: calc(100% - 20px);
    }
    
    .push-notification-prompt {
        top: 10px;
        right: 10px;
        max-width: calc(100% - 20px);
    }
    
    .pwa-install-content,
    .push-notification-content {
        padding: 20px;
    }
    
    .pwa-install-icon,
    .push-notification-icon {
        font-size: 40px;
    }
    
    .pwa-install-content h3,
    .push-notification-content h3 {
        font-size: 18px;
    }
    
    .pwa-install-content p,
    .push-notification-content p {
        font-size: 14px;
    }
    
    .offline-indicator {
        bottom: 10px;
        right: 10px;
        padding: 10px 15px;
        font-size: 14px;
    }
}

/* Add to home screen iOS banner fix */
@media (display-mode: standalone) {
    .pwa-install-prompt {
        display: none !important;
    }
}

/* Print styles */
@media print {
    .pwa-install-prompt,
    .push-notification-prompt,
    .offline-indicator,
    .pwa-success-message {
        display: none !important;
    }
}

/* Accessibility */
.pwa-install-btn:focus,
.push-enable-btn:focus,
.pwa-close:focus,
.push-close:focus {
    outline: 3px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .pwa-install-prompt,
    .push-notification-prompt,
    .offline-indicator,
    .pwa-success-message {
        animation: none;
    }
    
    .pwa-install-icon,
    .push-notification-icon {
        animation: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .pwa-install-content,
    .push-notification-content {
        border: 2px solid white;
    }
    
    .pwa-install-btn,
    .push-enable-btn {
        border: 2px solid #667eea;
    }
}