/* PWA Online/Offline Indicator Styles */

/* Offline indicator banner */
body.offline::before {
    content: '?? You are offline - Some features may not be available';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    padding: 12px 20px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    z-index: 10000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Adjust main content when offline banner is visible */
body.offline .page-header {
    margin-top: 48px;
}

/* Online indicator (subtle, brief) */
body.online.was-offline::before {
    content: '? Back online';
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    animation: slideInRight 0.3s ease-out, fadeOut 0.3s ease-out 2.7s forwards;
}

@keyframes slideInRight {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(120%);
    }
}

/* PWA Install Prompt */
.pwa-install-prompt {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 16px 24px;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 9999;
    animation: slideUp 0.3s ease-out;
    max-width: 90%;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(120%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.pwa-install-prompt .icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pwa-install-prompt .icon svg {
    width: 28px;
    height: 28px;
    fill: white;
}

.pwa-install-prompt .content {
    flex: 1;
}

.pwa-install-prompt .title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
    color: #1e293b;
}

.pwa-install-prompt .message {
    font-size: 13px;
    color: #64748b;
}

.pwa-install-prompt .actions {
    display: flex;
    gap: 8px;
}

.pwa-install-prompt .btn-install {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pwa-install-prompt .btn-install:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--color-primary-light), 0.3);
}

.pwa-install-prompt .btn-dismiss {
    background: transparent;
    color: #64748b;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pwa-install-prompt .btn-dismiss:hover {
    background: #f1f5f9;
    color: #1e293b;
}

/* Mobile responsive */
@media (max-width: 640px) {
    .pwa-install-prompt {
        flex-direction: column;
        text-align: center;
        padding: 16px;
    }

    .pwa-install-prompt .actions {
        width: 100%;
        flex-direction: column;
    }

    .pwa-install-prompt .btn-install,
    .pwa-install-prompt .btn-dismiss {
        width: 100%;
    }

    body.offline::before {
        font-size: 12px;
        padding: 10px 16px;
    }
}

/* Loading indicator for PWA */
.pwa-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10001;
}

.pwa-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(var(--color-primary-light), 0.2);
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
