/* PWA Components Styles */

/* Update Banner */
.pwa-update-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.4);
    padding: 20px;
    max-width: 500px;
    width: calc(100% - 40px);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }

    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.pwa-update-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.pwa-update-icon {
    font-size: 2rem;
    animation: rotate 2s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.pwa-update-text {
    flex: 1;
}

.pwa-update-text strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.pwa-update-text p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.9rem;
}

.pwa-update-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pwa-update-actions .btn {
    white-space: nowrap;
}

/* Install Button */
.pwa-install-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9998;
    animation: fadeInScale 0.3s ease;
}

.pwa-install-button.hidden {
    animation: fadeOutScale 0.3s ease;
    opacity: 0;
    transform: scale(0.8);
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes fadeOutScale {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.8);
    }
}

.pwa-install-button .btn {
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    border-radius: 30px;
    padding: 12px 30px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.pwa-install-button .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.6);
}

.pwa-install-close {
    position: absolute;
    top: -8px;
    right: -8px;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.pwa-install-close:hover {
    background: #f7fafc;
    transform: rotate(90deg);
}

/* Connection Indicator */
.connection-indicator {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 9997;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.connection-indicator.online {
    background: #c6f6d5;
    color: #22543d;
}

.connection-indicator.offline {
    background: #fed7d7;
    color: #742a2a;
}

.connection-indicator.auto-hide.online {
    opacity: 0;
    transform: translateX(100px);
}

.connection-indicator i {
    margin-right: 6px;
}

/* iOS Install Prompt */
.pwa-ios-prompt {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.pwa-ios-prompt.hidden {
    animation: fadeOut 0.3s ease;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

.pwa-ios-content {
    background: white;
    border-radius: 20px 20px 0 0;
    padding: 25px 20px 30px;
    position: relative;
    animation: slideUpFromBottom 0.3s ease;
    max-width: 600px;
    margin: 0 auto;
}

@keyframes slideUpFromBottom {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.pwa-ios-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #f0f0f0;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #666;
    transition: all 0.3s ease;
    font-size: 18px;
}

.pwa-ios-close:hover {
    background: #e0e0e0;
    transform: rotate(90deg);
}

.pwa-ios-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.pwa-ios-header i {
    font-size: 3rem;
    color: #007AFF;
    margin-bottom: 10px;
}

.pwa-ios-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a1a;
}

.pwa-ios-body p {
    text-align: center;
    color: #666;
    margin-bottom: 25px;
    font-size: 1rem;
    line-height: 1.5;
}

.pwa-ios-steps {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.pwa-ios-step {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.pwa-ios-step:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.pwa-ios-step .step-number {
    background: #007AFF;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.pwa-ios-step .step-text {
    flex: 1;
    color: #333;
    font-size: 1rem;
    font-weight: 500;
}

.pwa-ios-step i {
    font-size: 1.5rem;
    flex-shrink: 0;
}


/* Mobile Responsive */
@media (max-width: 768px) {
    .pwa-update-banner {
        bottom: 10px;
        width: calc(100% - 20px);
        padding: 15px;
    }

    .pwa-update-content {
        flex-direction: column;
        text-align: center;
    }

    .pwa-update-actions {
        width: 100%;
    }

    .pwa-update-actions .btn {
        width: 100%;
    }

    .pwa-install-button {
        bottom: 10px;
        right: 10px;
    }

    .pwa-install-button .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .connection-indicator {
        top: auto;
        bottom: 10px;
        left: 10px;
        right: auto;
    }

    .pwa-ios-content {
        padding: 20px 15px 25px;
    }

    .pwa-ios-header i {
        font-size: 2.5rem;
    }

    .pwa-ios-header h3 {
        font-size: 1.3rem;
    }

    .pwa-ios-step {
        padding: 12px;
    }

    .pwa-ios-step .step-text {
        font-size: 0.9rem;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .pwa-update-banner {
        background: linear-gradient(135deg, #4c5fd7 0%, #5a3d7e 100%);
    }

    .pwa-install-close {
        background: #2d3748;
        color: #a0aec0;
    }

    .pwa-install-close:hover {
        background: #1a202c;
    }

    .pwa-ios-content {
        background: #1a1a1a;
    }

    .pwa-ios-close {
        background: #2d2d2d;
        color: #a0aec0;
    }

    .pwa-ios-close:hover {
        background: #3d3d3d;
    }

    .pwa-ios-header h3 {
        color: #ffffff;
    }

    .pwa-ios-body p {
        color: #b0b0b0;
    }

    .pwa-ios-step {
        background: #2d2d2d;
    }

    .pwa-ios-step:hover {
        background: #3d3d3d;
    }

    .pwa-ios-step .step-text {
        color: #e0e0e0;
    }
}

/* Accessibility */
.pwa-update-banner:focus-within,
.pwa-install-button:focus-within,
.pwa-ios-prompt:focus-within {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

.pwa-install-close:focus,
.pwa-ios-close:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Print - Hide PWA elements */
@media print {

    .pwa-update-banner,
    .pwa-install-button,
    .pwa-ios-prompt,
    .connection-indicator {
        display: none !important;
    }
}